Jump to content

Only getting numeric id from field


opalepatrick
 Share

Recommended Posts

$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

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).

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...