sportkid Posted August 19, 2015 Share Posted August 19, 2015 Hello guys,Here is the Story: I need to add affiliate tracking of paydot.com network for my store.I had to create override and then add tracking to order confirmation page.Dont know how but i managed to make it work.Here is whole storyhttps://www.prestashop.com/forums/topic/462041-implementing-paydot-tracking/ Now i have another problem. When client pays through PayPal after payment is complete.PayPal redirects to its own confirmation pageP.S I mean the page where client is redirected after he completed all the step on PayPals website.So page looks likehttp://sportkid.eu/ru/module/paypal/submit?key=b1f827954882cc8c706f1b6761337ca5&id_module=103&id_cart=803&id_order=104And at this moment tracking docent works obviously.My question how do i add tracking for PrestaShop PayPal module.Should i add Same Override file to /htdocs/modules/paypal/controllers/front <?phpclass OrderConfirmationController extends OrderConfirmationControllerCore { public function initContent() { $cart = $this->context->cart; $order = new Order($this->id_order); $this->context->smarty->assign(array( 'shippingCost' => $cart->getOrderShippingCost(), 'id_order' => $this->id_order, 'orderTotal'=>$order->total_products_wt, )); parent::initContent(); }} And then add tracking code to /htdocs/modules/paypal/views/templates/front <img src="https://track.paydot.com/sale.php?value={$orderTotal}&oid={$id_order}&sid=1904&pid=DEFAULT" width="1" height="1"> to files order-confirmation.tpl or order-summary.tpl (dont know which one)P.S Have no idea how override works. If added it ones should i add it again in PayPal Module Directory? Link to comment Share on other sites More sharing options...
sportkid Posted August 19, 2015 Author Share Posted August 19, 2015 Would appreciate a lot if some one could help me with this problem!! Link to comment Share on other sites More sharing options...
sportkid Posted August 19, 2015 Author Share Posted August 19, 2015 EDIT: FOUND THE SOLUTION Go to /modules/paypal/views/templates/front/order-confirmation.tpl and put your affiliate tracking code. Mine is like: <script type="text/javascript"> affiliate.load_action("11628", "{Tools::getvalue('id_order')}", "1::{$total_wt_fpa}", "", "pending"); </script> Then go to /modules/paypal/controllers/front/submit.php near line 67, says $price = Tools::convertPriceFull($paypal_order['total_paid'], $order_currency, $display_currency);at the next line insert $total_wt_fpa = round((($order->total_products - $order->total_discounts) / 1.23), 2);and also at the next array (lines 72-80) put one more line to send to tpl. 'total_wt_fpa' => $total_wt_fpa,This is it! kalua, on 04 May 2015 - 11:56 PM, said: I'am getting closer to the problem and also fixed the problem with the currency. I can get it out with {$currency->iso_code} But the problem with paypal is somewhere else. I just made a testorder via paypal and the final page wil be like this: ..../de/module/paypal/submit?key=c5842c59... I took a look at the controllers in the paypal module and there is a reference to the order-confirmation.tpl ... take a look: if ($this->context->getMobileDevice() == true) $this->setTemplate('order-confirmation-mobile.tpl'); else $this->setTemplate('order-confirmation.tpl'); } related to this I change the code like vekia said before in the OrderConfirmationController.php to this in the submit.php in Paypal. if ($this->context->getMobileDevice() == true) $this->setTemplate('order-confirmation-mobile.tpl'); else $order = new Order($this->id_order); $cart = new Cart($order->id_cart); $description=""; foreach ($cart->getProducts() AS $k=>$v){ $description.=$v['name']."X".$v['quantity']; } $description=urlencode($description); $total_wt_disc = round(($order->total_products - $order->total_discounts) , 2); $this->context->smarty->assign(array( 'total_to_pay'=>$order->getOrdersTotalPaid(), 'total_products'=>$total_wt_disc, 'description'=>$description )); $this->setTemplate('order-confirmation.tpl'); } But I did not get any data out?? Any idea to that? Found that somebody had same problem. But different variables any one can give advice how to re do this steps so that they would work with my tracking case 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