Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Single quotes doesn't evaluate in google remarketing tag

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
proc
Smarty n00b


Joined: 29 Dec 2016
Posts: 2

PostPosted: Thu Dec 29, 2016 1:59 pm    Post subject: Single quotes doesn't evaluate in google remarketing tag Reply with quote

Hello,

I am new to smarty. I have the following remarketing code in smarty for cs cart. I need single quotes for product codes in variable ecomm_prodid. But quotes are displayed as '
I have tried escape, html_entity_decode but do not know what exactly needs to be done

Any help would be appreciated.

{capture name="checkout_order_info"}
{foreach from=$order_info.products item="item" name="products"}
'{$item.product_code}'{if not $smarty.foreach.products.last},{/if}
{/foreach}
{/capture}

{capture name="prodId"}{if $runtime.controller eq 'products'}{$product.product_code}{elseif $runtime.controller eq 'checkout' && $runtime.mode ne 'complete'}[{$smarty.capture.cart_order_info nofilter}]{elseif $runtime.controller eq 'checkout' && $runtime.mode eq 'complete'}[{$smarty.capture.checkout_order_info nofilter}]{/if}{/capture}

var google_tag_params = {
ecomm_prodid: ['KTTY01P5','KTBD01P1','BMC00671'],
ecomm_pagetype: 'cart',
ecomm_totalvalue: 66.00
};
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Dec 29, 2016 5:42 pm    Post subject: Reply with quote

It seems you are using default modifier.
Also, I would strongly suggest json_encode instead of that foreach loop.
Back to top
View user's profile Send private message
proc
Smarty n00b


Joined: 29 Dec 2016
Posts: 2

PostPosted: Fri Dec 30, 2016 4:56 am    Post subject: Reply with quote

Thanks for the reply. But if you could provide some example it would be very helpful.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Dec 30, 2016 7:10 pm    Post subject: Reply with quote

http://www.smarty.net/docs/en/variable.default.modifiers.tpl
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP