Jump to content

 

tzifman

Member Since 23 Apr 2014
Offline Last Active Jun 08 2016 08:10 AM
-----

Topics I've Started

Smarty Variables On Checkout Complete

07 June 2016 - 10:55 AM

Hello 

 

I try to write code for a loop on checkout complete. My code at the moment is: 

 

<script>
test("setCurrency", "978");
 
{foreach from=$order_info.products item="product" key="key"}
test("addItem", {
id: "{$product.product_id}"
,price: {math equation="x / y" x=$product.price y=1.24 format="%.2f"}
,quantity: "{$product.amount}"
,payout: "1"
,category: "{$product.main_category.category_id}"
});
 
{/foreach}
</script>
 
1. Product ID is ok.
2. Price is ok.
3. Quantity is ok
4. Category isnt ok. I need to show category id of each product but i cant. Any idea? 
5. Payout istnt ok. I need to show number based on category ID.
 
 
Any help is more than welcome 
 
Thanks

Facebook Pixel Dynamic Events

12 February 2016 - 08:52 AM

Hello 

 

i am trying to configure facebook dynamic events on my site. I have installed Pageview event that works great on all pages. 

 

Only on product pages i need to insert that code: 

 

<!-- Custom Audience Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
// Insert Your Custom Audience Pixel ID below.
fbq('init', '<FB_PIXEL_ID>');
fbq('track', 'PageView');
fbq('track', 'ViewContent', {
content_name: 'Really Fast Running Shoes',
content_category: 'Apparel & Accessories > Shoes',
content_ids: ['1234'],
content_type: 'product',
value: 0.50,
currency: 'USD'
});
</script>

 

Content_name, Content_Category, Content_Ids and Value must be variables. I have tried almost anything but it doesnt work. For example i tried: 

content_name: '{/literal}{$item.product}{literal}',

content_ids: ['{/literal}{$product_id}{literal}'],

value: '{$item.price}',

<?php echo $product_id; ?>

 

 

but nothing worked. 

 

Could you help me? 

 

Thanks in advance