![]() |
Passing multiple cart items to Javascript code?
I have some Javascript code I need to install on my order success page for conversion tracking, and am not sure how to modify to code to account for multiple items. The code needs a separate line for every item in the order. How do I tell Smarty to do this? See example of the code below.
Code:
order.addItem("[sku-item-1]","[quantity-item-1]","[per-item-cost-item-1]"); |
Re: Passing multiple cart items to Javascript code?
This usually goes inside the foreach loop in customer/main/order_message.tpl. You'll have to create a new loop for $order.products like:
PHP Code:
|
Re: Passing multiple cart items to Javascript code?
I appreciate the response, but I may have misled you. I am a complete novice when it comes to editing Smarty. Could you elaborate more on what you mean?
|
Re: Passing multiple cart items to Javascript code?
{$op.productcode} is the Smarty variable in this foreach loop to use in place of your sku-item-X. You would want to look inside the $order.products array to see what other variables to use for your quantity-item-X and per-item-cost-item-X, such as $op.amount and $op.display_price, respectively.
|
Re: Passing multiple cart items to Javascript code?
I am trying to incorporate Commission Junction tracking pixels in /common_files/customer/main/order_message.tpl and here is the pixel:
<img src=“https://www.emjcd.com/u?CID=xxxxxxx&OID={$order.order.orderid}&TYPE=5634 &ITEM1=3 214sku&AMT1=13.49&QTY1=1&ITEM2=6577sku&AMT2=7.99&Q TY2=2&CURRENCY=USD& METHOD=IMG“ height=”1” width=“20”> I need to pass multiple ITEM1, ITEM2, ITEM3, ITEM4 and AMT1, AMT2, AMT3, AMT4, QTY1, QTY2, QTY3 QTY4 etc. If someone could post the exact code I would greatly appreciate it, thanks! We have a similar pixel on this page (Part of it below) that works properly but I could not figure out how to incorporate the multiple items in the string above: mpuid={$order.order.orderid}{foreach from=$order.products item="product"}:{$product.productcode|wm_remove|es cape:javascript}:{$product.amount}{/foreach}" Thanks!! |
All times are GMT -8. The time now is 04:34 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.