Validation

This commit is contained in:
Michael RICOIS 2018-01-23 17:10:17 +01:00
parent 9b3f4d087b
commit 85f4874ac8
2 changed files with 20 additions and 17 deletions

View File

@ -28,24 +28,24 @@
ga('require', 'ec'); ga('require', 'ec');
{foreach from=$items item=item} {foreach from=$items item=item}
ga('ec:addProduct', { // Provide product details in an productFieldObject. ga('ec:addProduct', { // Provide product details in an productFieldObject.
'id': '{$item.SKU}', // Product ID (string). 'id': '{$item.SKU}', // Product ID (string).
'name': '{$item.Product}', // Product name (string). 'name': '{$item.Product}', // Product name (string).
'category': '{$item.Category}', // Product category (string). 'category': '{$item.Category}', // Product category (string).
'brand': '{$item.Category}', // Product brand (string). 'brand': '{$item.Category}', // Product brand (string).
'price': '{$item.Price}', // Product price (currency). 'price': '{$item.Price}', // Product price (currency).
'quantity': {$item.Quantity} // Product quantity (number). 'quantity': {$item.Quantity} // Product quantity (number).
}); });
{/foreach} {/foreach}
{if $analytics_timeover == 0} {if $cookie->transCpt < 2}
ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject. ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
'id': '{$trans.id}', // (Required) Transaction id (string). 'id': '{$trans.id}', // (Required) Transaction id (string).
'affiliation': '{$trans.store}', // Affiliation (string). 'affiliation': '{$trans.store}', // Affiliation (string).
'revenue': '{$trans.total}', // Revenue (currency). 'revenue': '{$trans.total}', // Revenue (currency).
'tax': '{$trans.tax}', // Tax (currency). 'tax': '{$trans.tax}', // Tax (currency).
'shipping': '{$trans.shipping}', // Shipping (currency). 'shipping': '{$trans.shipping}', // Shipping (currency).
}); });
{/if} {/if}
{literal} {literal}

View File

@ -52,8 +52,6 @@ class OrderConfirmationController extends OrderConfirmationControllerCore
$transCpt = (int) $cookie->transCpt; $transCpt = (int) $cookie->transCpt;
} }
$transCpt++; $transCpt++;
$cookie->transCpt = $transCpt;
$cookie->write();
if ($transCpt > 1) { if ($transCpt > 1) {
$analytics_timeover = 1; $analytics_timeover = 1;
} }
@ -67,9 +65,14 @@ class OrderConfirmationController extends OrderConfirmationControllerCore
if (time() > $timestamp) { if (time() > $timestamp) {
$analytics_timeover = 1; $analytics_timeover = 1;
$transCpt++;
} }
} }
// Write cookie
$cookie->transCpt = $transCpt;
$cookie->write();
self::$smarty->assign( self::$smarty->assign(
array( array(
'customer' => $customer, 'customer' => $customer,