mdgates Posted March 22, 2016 Share Posted March 22, 2016 (edited) I need to place the following code on the purchase confirmation page of my site just above the closing "</body>" tag for my affiliate advertising. <img src="https://www..........&amount={order_subtotal}&cr={currency_code}&ref={order_ref}&parts={commission_group}:{sale_amount}&vc={discount_code}&ch={marketing_channel}> <!-- Product Level Tracking - Optional --> <form style="display:none;" name="aw_basket_form"> <textarea wrap="physical" id="aw_basket"> AW:P|6951|{order_ref}|{product_id}|{product_name}|{unit_price}|{quantity}|{sku}|{commission_group}|{category} AW:P|6951|{order_ref}|{product_id}|{product_name}|{unit_price}|{quantity}|{sku}|{commission_group}|{category} AW:P|6951|{order_ref}|{product_id}|{product_name}|{unit_price}|{quantity}|{sku}|{commission_group}|{category} </textarea> </form> <!-- Javascript Tracking - Mandatory --> <script type="text/javascript"> //<![CDATA[ /*** Do not change ***/ var AWIN = {}; AWIN.Tracking = {}; AWIN.Tracking.Sale = {}; /*** Set your transaction parameters ***/ AWIN.Tracking.Sale.amount = '{order_subtotal}'; AWIN.Tracking.Sale.orderRef = 'order_ref}'; AWIN.Tracking.Sale.parts = '{commission_group}:{sale_amount}'; AWIN.Tracking.Sale.voucher = '{discount_code}'; AWIN.Tracking.Sale.currency = '{currency_code}'; AWIN.Tracking.Sale.test = '0'; AWIN.Tracking.Sale.channel = '{marketing_channel}'; //]]> </script> But I'm not sure what to replace the variables with. The following is what each variable represents: {order_subtotal} : Must be replaced by the total transaction amount, in most cases excluding VAT (or other taxes), delivery and discounts. The value must be a float, no thousand separator is allowed and finally the decimal place has to be a standard dot character, for example: "1083.29" If the transaction type is a lead, then instead declare the number of leads, for example: "1" {currency_code}} : Populate with the ISO currency code of the currency that was used in the transaction e.g. "GBP" {{order_ref}} : Must be replaced with the unique order reference ID from your system Default:{sale_amount}} : Here {sale_amount} must be replaced with the price amount that falls under this commission. If only one commission group (Default) is always being used then the format is 'Default:Order_Subtotoal'. Note the colon ":" between the two values! {voucher_code} : If a voucher code is used in the order it should be populated in this parameter {channel} : Should be replaced with the name of the channel that is deemed as last click referrer. "aw" should always be utilised for Affiliate Window. Please refer to separate information about the Channel Parameter for more guidance {order_ref} : Must be replaced by the unique booking / order reference testmode parameter Should be populated with "0" when tracking is in live mode or alternatively "1" if in test mode. When set to the latter, the incoming tracking requests will not be processed {product_id} : Must be replaced with the individual product unique id from your system {product_name} : Should be replaced with the individual product's name {unit_price} : Must be replaced with the individual product's price. It must be consistent with how you parse the total price (NET excluding VAT or GROSS including VAT). Please also note that it should reflect deductions if a voucher code or any other promotion is used {quantity} : Should be replaced with the quantity of the individual product in the basket {sku} : Should be replaced with the individual prodcut's SKU code {category} : Should be replaced with the category that the product falls under. order_ref, for example, would I replace with {Tools::getvalue('id_order')} ? Edited March 22, 2016 by mdgates (see edit history) Link to comment Share on other sites More sharing options...
mdgates Posted March 22, 2016 Author Share Posted March 22, 2016 (edited) So far what's below is what I've tried to do myself. Is this correct? Paste code into: themes/your_theme/order-confirmation.tpl <!-- Fallback Image Pixel Tracking - Mandatory --> <img src="https://www......amount={$total_products}&cr={$currency}&ref={Tools::getvalue(id_order')}&parts=DEFAULT:{$total_products}&vc={$vc}&ch=aw&testmode=0" border="0" width="0" height="0"> <!-- Javascript Tracking - Mandatory --> <script type="text/javascript"> //<![CDATA[ /*** Do not change ***/ var AWIN = {}; AWIN.Tracking = {}; AWIN.Tracking.Sale = {}; /*** Set your transaction parameters ***/ AWIN.Tracking.Sale.amount = '{$total_products}'; AWIN.Tracking.Sale.orderRef = '{Tools::getvalue('id_order')}'; AWIN.Tracking.Sale.parts = 'DEFAULT:{$total_products}'; AWIN.Tracking.Sale.voucher = '{$vc}'; AWIN.Tracking.Sale.currency = '{$currency}'; AWIN.Tracking.Sale.test = '0'; AWIN.Tracking.Sale.channel = 'aw'; //]]> </script> ************************************************** ************************************************** open the file: controllers/front/OrderConfirmationController.php Before this code: $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl'); Paste this: $order = new Order($this->id_order); $cart = new Cart($order->id_cart); $description=""; foreach ($cart->getProducts() AS $k=>$v){ $description.=$v['name']; } $description=urlencode($description); $this->context->smarty->assign(array( 'total_products'=>$order->total_products, 'description'=>$description, 'currency'=>$order->currency->iso_code, 'vc'=>$cart->cart_rule->code )); Edited March 22, 2016 by mdgates (see edit history) Link to comment Share on other sites More sharing options...
cyssoo Posted December 5, 2018 Share Posted December 5, 2018 Or you can try this modulehttps://www.team-ever.com/produit/prestashop-module-de-tracking-awin/ Also available on Prestashop Addons :https://addons.prestashop.com/fr/fidelisation-parrainage/42304-tracking-awin.html 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