Page 1 of 1

[Solved]Products Module: syntax error

Posted: Thu Aug 08, 2013 6:19 am
by jasnick
Using 1.11.7 and up-to-date modules

I have this code in a Products Module template:

{cge_have_module m='CGEcommerceBase' assign='tmp'}
{if $tmp}
{ if isset($entry->fields.mto->value) && $entry->fields.mto->value == 'true'}

<p>Note:This item is made to order. Please add requirements in the Order Notes box when checking out.</p>

{else}
<div>
{cgecomm_form_addtocart product=$entry->id}
</div>
{/if}
{/if}

This is rendering an "unexpected closing tag {/if}" syntax error - the last one above.

If I remove it, the page loads but it shows { if isset($entry->fields.mto->value) && $entry->fields.mto->value == 'true'} on the online page above the text "Note:This item is made to order. Please add requirements in the Order Notes box when checking out."

Is this closing tag in the wrong place?

Thanks

Re: Products Module: syntax error

Posted: Thu Aug 08, 2013 7:03 am
by Jo Morg

Code: Select all

{ if isset($entry->fields.mto->value) && $entry->fields.mto->value == 'true'}
Note the spave just after the { ... Smarty 3 interprets that as {literal} opening tag. Remove the space and it should work.

Re: Products Module: syntax error

Posted: Thu Aug 08, 2013 7:04 am
by velden
No, remove the space after the {
In Smarty 2, you had to escape occurances of {} characters by surrounding them with {literal}{/literal} blocks or replacing them with {ldelim}{rdelim} tags. With Smarty 3, the braces will be ignored so long as they are surrounded by white space.
http://www.smarty.net/v3_overview

Re: Products Module: syntax error

Posted: Thu Aug 08, 2013 7:57 am
by jasnick
;) Velden - I think that's what Jo Morg said!

Anyway, thanks to you both - I struggle enough with $Smarty without making typos. :'(