[Solved]Products Module: syntax error

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

[Solved]Products Module: syntax error

Post 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
Last edited by jasnick on Thu Aug 08, 2013 7:58 am, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Products Module: syntax error

Post 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.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Products Module: syntax error

Post 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
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: Products Module: syntax error

Post by jasnick »

;) Velden - I think that's what Jo Morg said!

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

Return to “Modules/Add-Ons”