opalepatrick Posted June 24, 2014 Share Posted June 24, 2014 $products = $pages->find("parent=/fabrics/"); foreach ($products as $product) { echo $product->code; //Produces the correct alphanumeric value echo $product->collection; //This produces a number. Should be something like 'Avanti' } Hey there, as the title suggests I am only getting a numeric id from the above code. You can assume that all other code and values for this template work fine and that there is a field in this template called collections. So I thought I would get the value of this field. What am I missing? Thanks in advance! Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 24, 2014 Share Posted June 24, 2014 Looks fine from here. What field is it, that you called collection? Did you doublecheck for spelling issues, in your post you mention "collections", while in the code it's "collection". Link to comment Share on other sites More sharing options...
teppo Posted June 24, 2014 Share Posted June 24, 2014 Sounds a bit like "collection" might be a Page type field. If that's the case, try something like $page->collection->title (if it's set to contain one Page) or $page->collection->first()->title (if it's set to contain multiple Pages). 2 Link to comment Share on other sites More sharing options...
opalepatrick Posted June 24, 2014 Author Share Posted June 24, 2014 Thanks to you both! The $page->collection->first()->title solution was the one that worked as you were quite right it was a page field. Thanks a lot Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now