PrestaShop Integration

Updated 9 days ago

Integrating Fanplayr with your PrestaShop Store

Integration is easy using our provided module. Currently we support PrestaShop 1.6 and above. The latest version can be downloaded here:


  • Log into your PrestaShop admin
  • Go to Modules and Services

  • Click the Add a new module button at the top right

  • Click Choose a file and select the PrestaShop module you downloaded.

  • Click Upload this module

The module should now be added to your PrestaShop store. You still need to find it and _Install _it though.

  • Scroll down and click on the Pricing and Promotion section of modules

  • You should now see Fanplayr Conversions listed.
  • Click the Install button.

  • Once installed you should see the configuration screen for Fanplayr.
  • Enter your Account Key and a Session Offer Prefix (see below)
  • Click Save

Fanplayr should now be tracking users and orders on your site!

Session Offers

Fanplayr has the ability to stop your users from using Fanplayr coupon codes that they were not given through the Fanplayr system. For details on how this works please see the implementation here:

Because PrestaShop does not allow modification of core functionality via modules you will need to add the following code to one of your controllers.

The controller can be found here: controllers/front/ParentOrderController.php

Around line 102 you will find the following code:

if ($this->nbProducts) {
    if (CartRule::isFeatureActive()) {
        if (Tools::isSubmit('submitAddDiscount')) {

Please enter the following Fanplayr code directly below this line:

    begin Fanplayr Session Offers
$fanplayrSessionOfferPrefix = strtolower(Tools::getValue('fanplayr_prefix', Configuration::get('FANPLAYR_CONFIG_PREFIX')));
@$allowedCoupons = (array)json_decode($_COOKIE['fanplayr_so']);
$code = strtolower(trim(Tools::getValue('discount_name')));
if ( !is_array($allowedCoupons) ) {
    $allowedCoupons = [];
// if we have a Session Offer Prefix AND the code entered has this prefix AND the code is not in allowed coupons
if (strlen($fanplayrSessionOfferPrefix) > 0 &&
    strpos($code, $fanplayrSessionOfferPrefix) === 0 &&
    !array_key_exists($code, $allowedCoupons)
) {
    // then we clear the coupon from GET and POST variables
    $_POST['discount_name'] = '';
    $_GET['discount_name'] = '';
    end Fanplayr Session Offers

You should now not be able to use coupons which start with the Session Offer Prefix set when configuration your Fanplayr module, unless you have collected this coupon from a Fanplayr campaign.

Testing Session Offers

To test that Session Offers has been implemented correctly try the following:

  1. In the Fanplayr Configuration set a value for "Session Offer Prefix". For example "FP_".
  2. Create a coupon with this prefix ie "FP_10OFF".
  3. Apply this coupon to the cart. It should fail.
  4. Visit the URL that allows this coupon ie "". This should allow the coupon to be used in the current session.
  5. Apply this coupon again. This time it should apply successfully.

If the coupon does not fail at step 3. you may have to change another line of code. Try changing the following line in your "init" method:




Once this is complete you may need to clear your cache, remove the coupon, and try applying it again. Note that if you have already gone through step 4. you will first have to remove all cookies on the site to clear the current session.