31 lines
1.1 KiB
Smarty
31 lines
1.1 KiB
Smarty
{switch $pageType}
|
|
{case "product"}
|
|
<script>
|
|
// facebook pixel, posila se po zvoleni aktivovani konkretni varianty
|
|
var sendPixel = function() {
|
|
var variation = $('.table-variations [data-variation-id].active'),
|
|
varId = variation.data('variation-id'),
|
|
price = { },
|
|
code = variation.data('code');
|
|
|
|
{foreach $body.product.variations.variations as $id => $var}
|
|
price[{$id}] = {$var.price.price_with_vat} ;
|
|
{/foreach}
|
|
|
|
if (variation.find('form.buy-form').length) {
|
|
fbq('track', 'ViewContent', {
|
|
content_ids: [ code ],
|
|
content_type: 'product',
|
|
currency: '{$ctrl.currency|default:$dbcfg.currency_code}',
|
|
value: price[varId]
|
|
});
|
|
}
|
|
};
|
|
|
|
sendPixel();
|
|
|
|
$('.table-variations').on('click', '[data-variation-id]:not(.active)', sendPixel);
|
|
|
|
</script>
|
|
{/case}
|
|
{/switch} |