Jump to content

Cumul de bons de réduction Parrainage


Recommended Posts

Bonjour,

Je voudrais savoir s'il est possible pour un parrain qui a plusieurs filleuls, et qui donc va recevoir plusieurs bons de réduction, de cumuler ses réductions sur une seule commande. Donc en résumé, est ce que les codes réductions parrainage sont cumulables entre eux ?

Merci de votre réponse

Isa13 ;)

Link to comment
Share on other sites

Salut,

 

A priori pas de pb, le module parrainage utilise la fonction native de presta pour générer les bons de réduction, donc les options sont disponibles : cumul ou non avec les promos, cumul ou non avec d'autres bons...

Link to comment
Share on other sites

Bonjour et merci de votre réponse. Cependant, je ne vois pas du tout à quel endroit paramétrer le cumul ou non avec les promos ou les autres bons...lorsque je paramètre le parrainage, je n'ai aucun champ qui me le propose...

Isabelle

Link to comment
Share on other sites

  • 7 months later...

Bonjour,

Même problème, aucunes option pour cumul des bons de réduction, et aucunes option pour cumul avec les promos. Peut on régler cela ailleurs que dans le module parrainage?

Ce que je souhaite faire: Donner la possibilité de cumuler les bons de reduction gagnés par le parrainage, et interdire le cumul avec les promos encours.

Vous en pensez quoi?

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Je viens de créer un compte sur votre site en rentrant votre adresse email en tant que parrain. Aucun code ne m'est adressé. En avez-vous reçu un ? (j'ai pris l'email de votre profil sur le forum)

 

Votre site ne détaille pas les conditions de l'opération "Parrainage", c'est pourtant prioritaire si vous souhaitez le mettre en avant comme vous le faîtes dans l'espace perso de vos clients.

 

Par ailleurs, il y a un problème de scroll au niveau de votre footer, qu'on ne peut pas regarder plus de 3secondes avant que l'écran ne scroll up tout seul.

Link to comment
Share on other sites

Dans : /modules/referralprogram/ReferralProgramModule.php

Rajouter à la ligne 98 :

$cartRule->cart_rule_restriction = 1;

 

Courtesy of our CTO ;)

bonjour comment faire pour retrouver les options cumulable ou non dans le module en admin car depuis le passage en 1.5.4.1 cette option a disparue

Link to comment
Share on other sites

voici mon fichier si quelqu'un a une idée ? ReferralProgramModule.php

 

<?php

/*

* 2007-2013 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.org/licenses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2013 PrestaShop SA

* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*/

 

if (!defined('_PS_VERSION_'))

exit;

 

class ReferralProgramModule extends ObjectModel

{

public $id_sponsor;

public $email;

public $lastname;

public $firstname;

public $id_customer;

public $id_cart_rule;

public $id_cart_rule_sponsor;

public $date_add;

public $date_upd;

 

/**

* @see ObjectModel::$definition

*/

public static $definition = array(

'table' => 'referralprogram',

'primary' => 'id_referralprogram',

'fields' => array(

'id_sponsor' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),

'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 255),

'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),

'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),

'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'id_cart_rule_sponsor' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),

'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),

),

);

 

public static function getDiscountPrefix()

{

return 'SP';

}

 

public function registerDiscountForSponsor($id_currency)

{

if ((int)$this->id_cart_rule_sponsor > 0)

return false;

return $this->registerDiscount((int)$this->id_sponsor, 'sponsor', (int)$id_currency);

}

 

public function registerDiscountForSponsored($id_currency)

{

if (!(int)$this->id_customer OR (int)$this->id_cart_rule > 0)

return false;

return $this->registerDiscount((int)$this->id_customer, 'sponsored', (int)$id_currency);

}

 

public function registerDiscount($id_customer, $register = false, $id_currency = 0)

{

$configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency));

 

$cartRule = new CartRule();

if ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::PERCENT)

$cartRule->reduction_percent = (float)$configurations['REFERRAL_PERCENTAGE'];

elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::AMOUNT AND isset($configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency]))

$cartRule->reduction_amount = (float)$configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency];

 

$cartRule->quantity = 1;

$cartRule->quantity_per_user = 1;

$cartRule->date_from = date('Y-m-d H:i:s', time());

$cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000); // + 1 year

$cartRule->code = $this->getDiscountPrefix().Tools::passwdGen(6);

$cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');

$cartRule->id_customer = (int)$id_customer;

$cartRule->reduction_currency = (int)$id_currency;

 

if ($cartRule->add())

{

if ($register != false)

{

if ($register == 'sponsor')

$this->id_cart_rule_sponsor = (int)$cartRule->id;

elseif ($register == 'sponsored')

$this->id_cart_rule = (int)$cartRule->id;

return $this->save();

}

return true;

}

return false;

}

 

/**

* Return sponsored friends

*

* @return array Sponsor

*/

public static function getSponsorFriend($id_customer, $restriction = false)

{

if (!(int)($id_customer))

return array();

 

$query = '

SELECT s.*

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_sponsor` = '.(int)$id_customer;

if ($restriction)

{

if ($restriction == 'pending')

$query.= ' AND s.`id_customer` = 0';

elseif ($restriction == 'subscribed')

$query.= ' AND s.`id_customer` != 0';

}

 

return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);

}

 

/**

* Return if a customer is sponsorised

*

* @return boolean

*/

public static function isSponsorised($id_customer, $getId=false)

{

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_customer` = '.(int)$id_customer);

 

if (isset($result['id_referralprogram']) AND $getId === true)

return (int)$result['id_referralprogram'];

 

return isset($result['id_referralprogram']);

}

 

public static function isSponsorFriend($id_sponsor, $id_friend)

{

if (!(int)($id_sponsor) OR !(int)($id_friend))

return false;

 

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_sponsor` = '.(int)($id_sponsor).' AND s.`id_referralprogram` = '.(int)($id_friend));

 

return isset($result['id_referralprogram']);

}

 

/**

* Return if an email is already register

*

* @return boolean OR int idReferralProgram

*/

public static function isEmailExists($email, $getId = false, $checkCustomer = true)

{

if (empty($email) OR !Validate::isEmail($email))

die (Tools::displayError('The email address is invalid.'));

 

if ($checkCustomer === true AND Customer::customerExists($email))

return false;

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`email` = \''.pSQL($email).'\'');

if ($getId)

return (int)$result['id_referralprogram'];

return isset($result['id_referralprogram']);

}

}

Link to comment
Share on other sites

  • 2 weeks later...

Plutôt que de faire du bidouillage sur un module plein de bugs, je vous invite à découvrir mon module de récompense (fidélité, parrainage, like facebook, cagnotte unique...) qui est également un bestseller sur addons, gage de sa qualité.

 

Il vous permet de régler très finement tout un tas de paramètres, et apporte surtout un réel effet incitatif pour le client via un système de popin l'invitant à parrainer à la fin de sa commande. Ca marche du tonnerre, il vous suffit de lire les avis des clients pour vous en rendre compte ;-)

 

Il s'agit du module [modéré]

Edited by Xavier du Tertre
Mauvais forum, liens externes, pub caractérisée, etc etc (see edit history)
Link to comment
Share on other sites

voici mon fichier si quelqu'un a une idée ? ReferralProgramModule.php

 

<?php

/*

* 2007-2013 PrestaShop

*

* NOTICE OF LICENSE

*

* This source file is subject to the Academic Free License (AFL 3.0)

* that is bundled with this package in the file LICENSE.txt.

* It is also available through the world-wide-web at this URL:

* http://opensource.or...ses/afl-3.0.php

* If you did not receive a copy of the license and are unable to

* obtain it through the world-wide-web, please send an email

* to [email protected] so we can send you a copy immediately.

*

* DISCLAIMER

*

* Do not edit or add to this file if you wish to upgrade PrestaShop to newer

* versions in the future. If you wish to customize PrestaShop for your

* needs please refer to http://www.prestashop.com for more information.

*

* @author PrestaShop SA <[email protected]>

* @copyright 2007-2013 PrestaShop SA

* @license http://opensource.or...ses/afl-3.0.php Academic Free License (AFL 3.0)

* International Registered Trademark & Property of PrestaShop SA

*/

 

if (!defined('_PS_VERSION_'))

exit;

 

class ReferralProgramModule extends ObjectModel

{

public $id_sponsor;

public $email;

public $lastname;

public $firstname;

public $id_customer;

public $id_cart_rule;

public $id_cart_rule_sponsor;

public $date_add;

public $date_upd;

 

/**

* @see ObjectModel::$definition

*/

public static $definition = array(

'table' => 'referralprogram',

'primary' => 'id_referralprogram',

'fields' => array(

'id_sponsor' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),

'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'required' => true, 'size' => 255),

'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),

'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 128),

'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'id_cart_rule' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'id_cart_rule_sponsor' =>array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),

'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),

'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),

),

);

 

public static function getDiscountPrefix()

{

return 'SP';

}

 

public function registerDiscountForSponsor($id_currency)

{

if ((int)$this->id_cart_rule_sponsor > 0)

return false;

return $this->registerDiscount((int)$this->id_sponsor, 'sponsor', (int)$id_currency);

}

 

public function registerDiscountForSponsored($id_currency)

{

if (!(int)$this->id_customer OR (int)$this->id_cart_rule > 0)

return false;

return $this->registerDiscount((int)$this->id_customer, 'sponsored', (int)$id_currency);

}

 

public function registerDiscount($id_customer, $register = false, $id_currency = 0)

{

$configurations = Configuration::getMultiple(array('REFERRAL_DISCOUNT_TYPE', 'REFERRAL_PERCENTAGE', 'REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency));

 

$cartRule = new CartRule();

if ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::PERCENT)

$cartRule->reduction_percent = (float)$configurations['REFERRAL_PERCENTAGE'];

elseif ($configurations['REFERRAL_DISCOUNT_TYPE'] == Discount::AMOUNT AND isset($configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency]))

$cartRule->reduction_amount = (float)$configurations['REFERRAL_DISCOUNT_VALUE_'.(int)$id_currency];

 

$cartRule->quantity = 1;

$cartRule->quantity_per_user = 1;

$cartRule->date_from = date('Y-m-d H:i:s', time());

$cartRule->date_to = date('Y-m-d H:i:s', time() + 31536000); // + 1 year

$cartRule->code = $this->getDiscountPrefix().Tools::passwdGen(6);

$cartRule->name = Configuration::getInt('REFERRAL_DISCOUNT_DESCRIPTION');

$cartRule->id_customer = (int)$id_customer;

$cartRule->reduction_currency = (int)$id_currency;

 

if ($cartRule->add())

{

if ($register != false)

{

if ($register == 'sponsor')

$this->id_cart_rule_sponsor = (int)$cartRule->id;

elseif ($register == 'sponsored')

$this->id_cart_rule = (int)$cartRule->id;

return $this->save();

}

return true;

}

return false;

}

 

/**

* Return sponsored friends

*

* @return array Sponsor

*/

public static function getSponsorFriend($id_customer, $restriction = false)

{

if (!(int)($id_customer))

return array();

 

$query = '

SELECT s.*

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_sponsor` = '.(int)$id_customer;

if ($restriction)

{

if ($restriction == 'pending')

$query.= ' AND s.`id_customer` = 0';

elseif ($restriction == 'subscribed')

$query.= ' AND s.`id_customer` != 0';

}

 

return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);

}

 

/**

* Return if a customer is sponsorised

*

* @return boolean

*/

public static function isSponsorised($id_customer, $getId=false)

{

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_customer` = '.(int)$id_customer);

 

if (isset($result['id_referralprogram']) AND $getId === true)

return (int)$result['id_referralprogram'];

 

return isset($result['id_referralprogram']);

}

 

public static function isSponsorFriend($id_sponsor, $id_friend)

{

if (!(int)($id_sponsor) OR !(int)($id_friend))

return false;

 

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`id_sponsor` = '.(int)($id_sponsor).' AND s.`id_referralprogram` = '.(int)($id_friend));

 

return isset($result['id_referralprogram']);

}

 

/**

* Return if an email is already register

*

* @return boolean OR int idReferralProgram

*/

public static function isEmailExists($email, $getId = false, $checkCustomer = true)

{

if (empty($email) OR !Validate::isEmail($email))

die (Tools::displayError('The email address is invalid.'));

 

if ($checkCustomer === true AND Customer::customerExists($email))

return false;

$result = Db::getInstance()->getRow('

SELECT s.`id_referralprogram`

FROM `'._DB_PREFIX_.'referralprogram` s

WHERE s.`email` = \''.pSQL($email).'\'');

if ($getId)

return (int)$result['id_referralprogram'];

return isset($result['id_referralprogram']);

}

}

toujours pas d'idée ?
Link to comment
Share on other sites

  • 1 month later...

bonjour comment faire pour retrouver les options cumulable ou non dans le module en admin car depuis le passage en 1.5.4.1 cette option a disparue

This doesnt fix the problem, just set that value to "1", but doesnt allow admin to set cartRule compatibility conditions ...

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks 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...