Page 1 of 1

Smarty tag not working with Products Module

Posted: Wed Feb 29, 2012 10:12 pm
by barry cooper
Hi All, I need to add {Gallery dir='comfort'} smarty tag to a product in CG products module. But its does not work. I have run a {debug} tag from the template but the Gallery tag does not show up. I have increase the PHP memory to 128MB and get no change.
Please goto http://baby.motivatedtraining.co.uk/Pro ... %20blanket to see an example.

Any ideas?

Thanks for your help
Cheers, Barry

Re: Smarty tag not working with Products Module

Posted: Thu Mar 01, 2012 4:21 am
by jmcgin51
In the product description, try replacing
{Gallery dir='comfort'}
with
{capture name='gallery'}{Gallery dir='comfort'}{/capture}{eval var=$gallery}

Re: Smarty tag not working with Products Module

Posted: Thu Mar 01, 2012 6:22 pm
by barry cooper
Hi,

Thanks for that, but no joy.

The gallery tag works if its placed in the template. Which is fine but I need to add different gallery dir to products. It look as if the smarty tag is not being read by the product page - is there some thing I can do to the template to correct this?

I have looked at http://forum.cmsmadesimple.org/viewtopic.php?t=18011 but I have little working knowledge of smarty and don't understand.

Thank for your help

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 2:24 am
by jmcgin51
When you say that the Gallery tag works if placed in the template, are you talking about the page template or the Products summary/detail template?

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 6:44 am
by barry cooper
The tag works when placed onto the product details template.

Thanks for your help, Barry

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 7:33 am
by uniqu3
Create extra field in Products like "my_dir"
Then in Products template:

Code: Select all

{if !empty($entry->fields.my_dir->value)}
    {Gallery dir=$entry->fields.my_dir->value}
{/if}

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 8:23 am
by barry cooper
Thanks for that - I have had a look and am not sure what is supposed to happen.

Any other ideas - cheers

Barry

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 8:29 am
by uniqu3
In created extra field you enter "comfort" and Gallery should show up if you have the line i posted above in you "Products Template".

Otherwise edit your Products template where it says:

{$entry->details} to {eval var=$entry->details}

Then you are able to add {Gallery} in your WYSIWYG Products area and it will return Module instead of plain text.

Re: Smarty tag not working with Products Module

Posted: Fri Mar 02, 2012 12:07 pm
by jmcgin51
uniqu3 wrote: Otherwise edit your Products template where it says:

{$entry->details} to {eval var=$entry->details}

Then you are able to add {Gallery} in your WYSIWYG Products area and it will return Module instead of plain text.
Thank you, uniqu3! That's what I was trying to say in my post above, but I'd forgotten the correct syntax...