fix conflict

This commit is contained in:
Marion Muszynski 2016-10-07 15:05:20 +02:00
commit b50bcf4848
5 changed files with 104 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<div class="inner">
<div class="input_radio">
<div class="hidden">
<form action="{$pbx_link}" method="post" name="paybox_form">
<form data-module-name="paybox" action="{$pbx_link}" method="post" name="paybox_form">
<input type="hidden" name="save_paybox" id="save_paybox" value="0"/>
<input type="hidden" name="PBX_MODE" value="{$PBX_MODE}" />
<input type="hidden" name="PBX_TOTAL" value="{$PBX_TOTAL}" />

View File

@ -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');
}
</script>
{/literal}
{/if}

View File

@ -28,7 +28,7 @@
<div class="inner">
<div class="input_radio">
<div class="hidden">
<form id="paypal_payment_form" action="{$base_dir_ssl}modules/paypal/express_checkout/payment.php" data-ajax="false" title="{l s='Pay with PayPal' mod='paypal'}" method="post">
<form data-module-name="paypal" id="paypal_payment_form" action="{$base_dir_ssl}modules/paypal/express_checkout/payment.php" data-ajax="false" title="{l s='Pay with PayPal' mod='paypal'}" method="post">
<input type="hidden" name="save_billing" id="save_billing_paypal" value="0"/>
<input type="hidden" name="express_checkout" value="{$PayPal_payment_type|escape:'htmlall':'UTF-8'}"/>
<input type="hidden" name="current_shop_url" value="{$PayPal_current_page|escape:'htmlall':'UTF-8'}" />
@ -59,11 +59,11 @@
</span>
</div>
</div>
{if $accounts}
<div class="account_payment">
<p class="title">{l s='You have registered accounts, you can use them to pay' mod='paypal'}</p>
{foreach from=$accounts item=account}
{foreach from=$accounts item=account}
<div class="box_account">
<div class="hidden">
<form id="paypal_payment_form" action="{$base_dir_ssl}modules/paypal/express_checkout/payment.php" data-ajax="false" title="{l s='Pay with PayPal' mod='paypal'}" method="post">
@ -102,7 +102,7 @@
</div>
</div>
</div>
</div>

View File

@ -93,7 +93,7 @@
{include file="$tpl_dir./errors.tpl"}
<form id="form" action="{$link->getPageLink('order.php', true)}" method="post" onsubmit="return submitCarrier();return !ga.loaded;">
<form id="form" action="{$link->getPageLink('order.php', true)}" method="post" onsubmit="return submitCarrier(); return ((window.ga && ga.create)? !ga.loaded : true);">
{else}
<h2>2. {l s='Delivery methods'}</h2>
<div id="opc_delivery_methods" class="opc-main-block">

View File

@ -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}
@ -99,7 +99,7 @@
{/if}
<p class="cart_navigation">
<a href="{$link->getPageLink('order.php', true)}?step=2" title="{l s='Previous'}" class="button">{l s='Previous'}</a>
<a class="exclusive submitPayment" title="{l s='Valider ma commande'}" class="button" onclick="submitPayment(); return !ga.loaded;">{l s='Valider ma commande'}</a>
<a class="exclusive submitPayment" title="{l s='Valider ma commande'}" class="button" onclick="submitPayment(); return ((window.ga && ga.create)? !ga.loaded : true);">{l s='Valider ma commande'}</a>
</p>
{else}
</div>