Page 1 of 1

[SOLVED] Displaying Individual Custom Fields in Products 2.1.2

Posted: Wed Dec 31, 2008 9:52 pm
by Daryn
This has been absolutely driving me up the wall for the past couple of hours. Instead of doing a foreach to display all of the product fields, I want to input them into their own areas 1 at a time because I only want to display certain ones on the summary template, and everything else on the detail template.

Absolutely nothing I've tried works. Any idea on how I need to write it?

I've tried things like

Code: Select all

{$entry->customnamehere}
TIA

Re: Displaying Individual Custom Fields in Products 2.1.2

Posted: Wed Dec 31, 2008 10:00 pm
by Daryn
BTW, I've done

Code: Select all

{$entry->fields|print_r}
but I guess I'm just not sure on how I need to structure the string to call to the specific field and its value to output them on the front end.

Re: Displaying Individual Custom Fields in Products 2.1.2

Posted: Wed Jan 07, 2009 4:19 pm
by bryan
Hey, Daryn. Try something like this...

Code: Select all

{foreach from=$items item=entry}
{assign var='field' value=$entry->fields}
{foreach from=$field item=thisfield}
{assign var=$thisfield->name value=$thisfield->value}
{/foreach}

{$customnamehere}

{/foreach}

Re: Displaying Individual Custom Fields in Products 2.1.2

Posted: Wed Jan 07, 2009 4:23 pm
by Daryn
Hey Bryan,

Thanks, I'll give that a try. I appreciate you not replying with something like "RTFM" or flaming me.  8)

Re: [SOLVED] Displaying Individual Custom Fields in Products 2.1.2

Posted: Wed Jan 07, 2009 4:24 pm
by bryan
I'll leave that to the professionals  ;)

Re: [SOLVED] Displaying Individual Custom Fields in Products 2.1.2

Posted: Thu Jan 08, 2009 3:49 pm
by porridj
{$entry->fields.Brand->value}

{$entry->fields.FIELDNAMEHERE->value}

try that... i think it works (it works for me and im pretty sure thats what your after!)

saved me i was looking for ages.

Im running into walls left right and centre trying to follow the design ive been given...let me know how you get on :)

Re: [SOLVED] Displaying Individual Custom Fields in Products 2.1.2

Posted: Thu Jan 08, 2009 7:13 pm
by GBR
porridj wrote: {$entry->fields.Brand->value}

{$entry->fields.FIELDNAMEHERE->value}

try that... i think it works (it works for me and im pretty sure thats what your after!)

saved me i was looking for ages.
Thanks porridj - that was exactly what I was looking for.

Regards