jlweb Posted February 29, 2016 Share Posted February 29, 2016 Bonjour, Je cherche à mettre en place un script de tracking sur une boutique Ps en version 1.6 mais uniquement pour le module Paypal. Je dois donc mettre le script dans modules/paypal/views/template/front/order-confirmation.tpl {if $smarty.const._PS_VERSION_ < 1.5 && isset($use_mobile) && $use_mobile} {include file="$tpl_dir./modules/paypal/views/templates/front/order-confirmation.tpl"} {else} {capture name=path}{l s='Order confirmation' mod='paypal'}{/capture} {if $smarty.const._PS_VERSION_ < 1.6} {include file="$tpl_dir./breadcrumb.tpl"} {/if} <h1>{l s='Order confirmation' mod='paypal'}</h1> {assign var='current_step' value='payment'} {include file="$tpl_dir./order-steps.tpl"} {include file="$tpl_dir./errors.tpl"} {$HOOK_ORDER_CONFIRMATION} {$HOOK_PAYMENT_RETURN} <br /> {if $order} <p>{l s='Total of the transaction (taxes incl.) :' mod='paypal'} <span class="bold">{$price|escape:'htmlall':'UTF-8'}</span></p> <p>{l s='Your order ID is :' mod='paypal'} <span class="bold"> {if $smarty.const._PS_VERSION_ >= 1.5} {if isset($reference_order)} {$reference_order|escape:'htmlall':'UTF-8'} {else} {$order.id_order|intval} {/if} {else} {$order.id_order|intval} {/if} </span> </p> <p>{l s='Your PayPal transaction ID is :' mod='paypal'} <span class="bold">{$order.id_transaction|escape:'htmlall':'UTF-8'}</span></p> {/if} <br /> {if $is_guest} <a href="{$link->getPageLink('guest-tracking.php', true)}?id_order={$order_reference}" title="{l s='Follow my order' mod='paypal'}" data-ajax="false"> {if $smarty.const._PS_VERSION_ < 1.6} <img src="{$img_dir}icon/order.gif" alt="{l s='Follow my order' mod='paypal'}" class="icon" /> {else} <i class="icon-chevron-left"></i> {/if} </a> <a href="{$link->getPageLink('guest-tracking.php', true)}?id_order={$order_reference}" title="{l s='Follow my order' mod='paypal'}" data-ajax="false">{l s='Follow my order' mod='paypal'}</a> {else} <a href="{$link->getPageLink('history.php', true)}" title="{l s='Back to orders' mod='paypal'}" data-ajax="false">{if $smarty.const._PS_VERSION_ < 1.6} <img src="{$img_dir}icon/order.gif" alt="{l s='Follow my order' mod='paypal'}" class="icon" /> {else} <i class="icon-chevron-left"></i> {/if}</a> <a href="{$link->getPageLink('history.php', true)}" title="{l s='Back to orders' mod='paypal'}" data-ajax="false">{l s='Back to orders' mod='paypal'}</a> {/if} {/if} Voici le code de tracking concerné : <script> (function (w, d, namespace, domain, progId, tagId, undefined) { w[namespace] = w[namespace] || {}; var act = w[namespace], payload = []; act.tags = act.tags || []; act.tags.push(tagId, payload); var protocol = d.location.protocol; // Start editable part payload.push({ module: 'OrderTracking', event: 'Sale', net_price: %ORDER_VALUE%, order_id: '%TRACKING_NUMBER%', rate_number: 1, program_subid1: '%ADVERTISER_SUBID_1%', program_subid2: '%ADVERTISER_SUBID_2%', voucher_code: '%VOUCHERCODE%' }); // End editable part if (act.get === undefined) { var s = d.createElement('script'); s.type = 'text/javascript'; s.src = protocol + '//' + domain + '/' + 'affadvc.aspx?ns=' + namespace + '&dm=' + domain + '&site=' + progId + '&tag=' + tagId; s.async = false; // always keep false for standard tracking (d.getElementsByTagName('body')[0] || d.getElementsByTagName('head')[0]).appendChild(s); } else { act.get(w, d, progId, tagId); } })(window, document, // Start editable part 'aff_act_1.0', 'act.reussissonsensemble.fr', XXXXX, 'TAG-ID-1'); // End editable part </script> <noscript> <img src="https://clic.reussissonsensemble.fr/TrackOrder.aspx?site=XXXXX&event=sale&net_price=%ORDER_VALUE%&order_id=%TRACKING_NUMBER%&rate_number=1&program_subid1=%ADVERTISER_SUBID_1%&program_subid2=%ADVERTISER_SUBID_2%&voucher_code=%VOUCHERCODE%" /> </noscript> Le problème est que je ne sais pas comment passer les variables suivantes : %ORDER_VALUE% (montant de la commande) %TRACKING_NUMBER% (numéro de la commande) %VOUCHERCODE% (éventuel bon de réduction) Si quelqu'un sait comment passer ces variables ... merci d'avance :-) Link to comment Share on other sites More sharing options...
jlweb Posted March 1, 2016 Author Share Posted March 1, 2016 J'ai un peu avancé sur mon script mais je rencontre à nouveau un blocage. Pour faire mes tests j'ai placé le script sur modules/cheques/views/template/hook/payment_return.tpl {literal} <script> (function (w, d, namespace, domain, progId, tagId, undefined) { w[namespace] = w[namespace] || {}; var act = w[namespace], payload = []; act.tags = act.tags || []; act.tags.push(tagId, payload); var protocol = d.location.protocol; // Start editable part payload.push({ module: 'OrderTracking', event: 'Sale', net_price: {/literal}{$total_to_pay}{literal}, order_id: {/literal}{$id_order}{literal}, rate_number: 1, program_subid1: '', program_subid2: '', voucher_code: 'VOUCHERCODE' }); // End editable part if (act.get === undefined) { var s = d.createElement('script'); s.type = 'text/javascript'; s.src = protocol + '//' + domain + '/' + 'affadvc.aspx?ns=' + namespace + '&dm=' + domain + '&site=' + progId + '&tag=' + tagId; s.async = false; // always keep false for standard tracking (d.getElementsByTagName('body')[0] || d.getElementsByTagName('head')[0]).appendChild(s); } else { act.get(w, d, progId, tagId); } })(window, document, // Start editable part 'aff_act_1.0', 'act.reussissonsensemble.fr', XXXXXX, 'TAG-ID-1'); // End editable part </script> <!--<noscript> <img src="https://clic.reussissonsensemble.fr/TrackOrder.aspx?site=XXXXXX&event=sale&net_price={$total_to_pay}&order_id=99999&rate_number=1&program_subid1=&program_subid2=&voucher_code=VOUCHERCODE" /> </noscript>--> {/literal} Lorsque je remplace {$total_to_pay} et {$id_order} par des valeur fixe (par exemple 99999), le tracking s'effectue correctement. Par contre avec les variable {$id_order} et {$total_to_pay} le script ne passe pas. Ai-je bien placé les balises {literal}{/literal} ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now