Posted on 1 Comment

Add affiliate tracking code in Prestashop

Affiliate Marketing

In the example below I am using the tracking code for the 2Parale platform (www.2performant.com affiliate marketing network in Romania and Bulgaria). The tracking code received from them looks something like this:

Affiliate Marketing

The above tracking code is used to track if a sale has been completed successfully. In order to do that you must provide some variables:

  • __ADD_SALE_VALUE__ represents the total value of the sale (without taxes and shipping)
  •  __ADD_TRANSACTION_ID__ represents the unique transaction ID that identifies the transaction in your store
  •  __ADD_DESCRIPTION__  this is an informative message about the transaction (or the actual product description)

This tracking code must be added to your Thank You page, or order-confirmation.tpl file, which is located  in themes/theme/order-confirmation.tpl

Since Prestashop does not have the above variables they must be defined so we need to edit the OrderConfirmationController.php file located in controllers/front/OrderConfirmationController.php. Open the file and look for this line:

and add the following code right below it:

Save the file and go back to the tracking code to replace the variables:

__ADD_SALE_VALUE__ will be replaced with {$total_products}

__ADD_DESCRIPTION__ will be replaced with {$description}

__ADD_TRANSACTION_ID__ will be replaced with id_order {Tools::getvalue(‘id_order’)}

Download

You can download the files from here:

 

1 thought on “Add affiliate tracking code in Prestashop

  1. Exact ce imi trebuia. Multumesc pentru postare.

Leave a Reply

Your email address will not be published. Required fields are marked *