Jump to content

Discount code (voucher) for tracking code


fairdesign

Recommended Posts

Hi there,

 

I'm trying to integrate a tracking code of an affiliate network. We need to insert a javascript code in confirmation page of each payment platform. We have to provide 3 values to this code, we've got two of them by doing this:

 

(prestashop v1.6.1.4)

 

Edit .tpl file of order confirmation page of each payment module and insert the affiliate tracking code.

 

Insert order reference and price value to this script:

var OrderReference = "{$reference_order}";

var OrderValue = "{$ordersTotalPaid}";

 

In order to have both reference_order and ordersTotalPaid available in .tpl file we need  to assign previously in orderConfirmationController.php by injecting on smarty.

 

 $this->context->smarty->assign(array(

                'ordersTotalPaid' => $order->getOrdersTotalPaid(),

                'reference_order' => $this->reference

                ));

 

This code is inserted on displayPaymentReturn() function.

 

Now we have to provide also the voucher (discount code) used by the client so the question is how can we get this value?

 

I hope I'm not wrong section. Thanks in advance.

Edited by fairdesign (see edit history)
Link to comment
Share on other sites

you will need to read discount information from database and then assign to Smarty variables.

 

the table you need to read is 

ps_order_cart_rule

 

The about table, you can get the ID/Name/Value of voucher. but if you need the code, you will need to read(join) wih this table too.

ps_cart_rule

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...