From 71a4bcdd529fecd54c570cddc4b096095d0dc4e5 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 6 Oct 2016 15:58:50 +0200 Subject: [PATCH 1/3] fix name of payment type --- modules/paybox/hookpayment.tpl | 6 +++--- themes/site/modules/paypal/express_checkout_payment.tpl | 8 ++++---- themes/site/order-payment.tpl | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/paybox/hookpayment.tpl b/modules/paybox/hookpayment.tpl index 8599ebd1..01a60740 100755 --- a/modules/paybox/hookpayment.tpl +++ b/modules/paybox/hookpayment.tpl @@ -2,8 +2,8 @@
{$pbx_text} -
+
\ No newline at end of file diff --git a/themes/site/modules/paypal/express_checkout_payment.tpl b/themes/site/modules/paypal/express_checkout_payment.tpl index 5cb15ffc..effb627a 100644 --- a/themes/site/modules/paypal/express_checkout_payment.tpl +++ b/themes/site/modules/paypal/express_checkout_payment.tpl @@ -28,7 +28,7 @@
- + {if $accounts} - +
diff --git a/themes/site/order-payment.tpl b/themes/site/order-payment.tpl index 39b3f75d..d5b6eb74 100755 --- a/themes/site/order-payment.tpl +++ b/themes/site/order-payment.tpl @@ -57,7 +57,7 @@ } $form = $input.parent().children('div.hidden').children('form'); // submit form by GA send event - onStepComplete(4, $input.attr('data-module-name'),null,$form); + onStepComplete(4, $form.attr('data-module-name'),null,$form); } } {/literal} From 2b7ee09f888244ad903f37b707ddb259e395f809 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Fri, 7 Oct 2016 13:57:01 +0200 Subject: [PATCH 2/3] fix --- themes/site/header.tpl | 97 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/themes/site/header.tpl b/themes/site/header.tpl index dd04094a..5262868b 100755 --- a/themes/site/header.tpl +++ b/themes/site/header.tpl @@ -193,7 +193,102 @@ })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-68580471-1', 'auto'); - ga('send', 'pageview'); + + {/literal}{if isset($page_name) && $page_name == 'category'}{literal} + ga('require', 'ec'); + + {/literal}{else if isset($page_name) && $page_name == 'product'}{literal} + ga('require', 'ec'); + ga('ec:addProduct', { + 'id': {/literal}{$product->id}{literal}, + 'name': "{/literal}{$product->name|escape:'htmlall':'UTF-8'}{literal}", + 'category': "{/literal}{$sale->title[$cookie->id_lang]}{literal}" + }); + + ga('ec:setAction', 'detail'); + + {/literal}{else if isset($page_name) && $page_name == 'order'}{literal} + ga('require', 'ec'); + + {/literal} + {if $step == 0 || $step == 1} + {if $cart} + {assign var='cartProducts' value=$cart->getProducts()} + {foreach from=$cartProducts item=cartProduct} + {literal} + ga('ec:addProduct', { + 'id': {/literal}{$cartProduct['id_product']}{literal}, + 'name': "{/literal}{$cartProduct['name']}{literal}", + 'category': "{/literal}{$cartProduct['category']}{literal}", + 'price': {/literal}{Tools::ps_round(Product::getPriceStatic((int)$cartProduct['id_product'], true, ((isset($cartProduct['id_product_attribute']) AND !empty($cartProduct['id_product_attribute'])) ? (int)($cartProduct['id_product_attribute']) : NULL), 2), 2)}{literal}, + 'quantity': {/literal}{$cartProduct['cart_quantity']}{literal} + }); + {/literal} + {/foreach} + {/if} + {/if} + {literal} + + {/literal}{if $step == 0}{literal} + //cart + ga('ec:setAction','checkout', { + 'step': 1, + }); + {/literal}{else if $step == 1}{literal} + // address + ga('ec:setAction','checkout', { + 'step': 2, + }); + {/literal}{else if $step == 2}{literal} + // carrier + ga('ec:setAction','checkout', { + 'step': 3, + }); + {/literal}{else if $step == 3}{literal} + // payment + ga('ec:setAction','checkout', { + 'step': 4, + }); + {/literal}{/if} + {/if}{literal} + + {/literal}{if isset($page_name) && (($page_name == 'order-confirmation' && $isEC==0) || $page_name != 'order-confirmation')}{literal} + // send pageview via header.tpl du module GA si isEC=1 and $page_name == 'order-confirmation' + ga('send', 'pageview'); + {/literal}{/if}{literal} + + function onStepComplete(stepNumber, option, redirect, form) { + ga('ec:setAction', 'checkout_option', { + 'step': stepNumber, + 'option': option + }); + if (redirect != null) { + ga('send', 'event', 'Checkout', 'Option', { + hitCallback: function() { + document.location = redirect; + } + }); + } else if (form != null) { + ga('send', 'event', 'Checkout', 'Option', { + hitCallback: function() { + form.submit(); + } + }); + } else { + ga('send', 'event', 'Checkout', 'Option', {}); + } + } + function addToCartToGA(product) { + ga('ec:addProduct', { + 'id': product.id, + 'name': product.name, + 'variant' : product.variant, + 'price': product.price, + 'quantity': product.qty + }); + ga('ec:setAction', 'add'); + ga('send', 'event', 'UX', 'click', 'add to cart'); + } {/literal} {/if} From 0f666b08fc33c02fde9356cf4a3fa7aa9b1f17c6 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Fri, 7 Oct 2016 15:03:45 +0200 Subject: [PATCH 3/3] fix when ga is blocked --- themes/site/order-carrier.tpl | 2 +- themes/site/order-payment.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/site/order-carrier.tpl b/themes/site/order-carrier.tpl index 61ac9ed5..2b1f9288 100755 --- a/themes/site/order-carrier.tpl +++ b/themes/site/order-carrier.tpl @@ -93,7 +93,7 @@ {include file="$tpl_dir./errors.tpl"} - + {else}

2. {l s='Delivery methods'}

diff --git a/themes/site/order-payment.tpl b/themes/site/order-payment.tpl index d5b6eb74..6858f86d 100755 --- a/themes/site/order-payment.tpl +++ b/themes/site/order-payment.tpl @@ -99,7 +99,7 @@ {/if}

{l s='Previous'} - {l s='Valider ma commande'} + {l s='Valider ma commande'}

{else}