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:

https://fanplayr.com/files/prestashop-1.0.15.zip

Installation

  • 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:

https://fanplayr.gitbooks.io/integration-custom/content/session-offers.html

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.

results matching ""

    No results matching ""