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

View File

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