Jump to content

Bug dans la configuration d'un email autaumatique


Recommended Posts

Bonjour,

Étant entrain de finaliser un site, je suis entrain de vérifier le module PARRAINAGE.

Il a été décider d'appliquer une remise en % et non en montant d'euro.

Il y a un bug dans un des emails envoyés au filleul la valeur de la remise s'exprime en montant d'euro, voir la copie ci-dessous :

Voici le numéro de votre bon de réduction : {voucher_num}, de {voucher_amount}

Il faut juste changer la {variable} qui n'est pas la bonne :
{voucher_amount} = 10 € alors que l'on voudrait {voucher_???} = 10 %

Si quelqu'un connait la bonne variable car n'etant pas développeur … c'est pas simple :)

Link to comment
Share on other sites

  • 2 months later...

Bonjour,

je pense que le problème se situe à la ligne 440 du fichier referralprogram.php :

$data = array(
   '{firstname}' => $newCustomer->firstname,
   '{lastname}' => $newCustomer->lastname,
   '{voucher_num}' => $discount->name,
   '{voucher_amount}' => Tools::displayPrice(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency))), intval(Configuration::get('PS_CURRENCY_DEFAULT'))));



je changerai de cette manière :

$data = array(
   '{firstname}' => $newCustomer->firstname,
   '{lastname}' => $newCustomer->lastname,
   '{voucher_num}' => $discount->name,
   '{voucher_amount}' => Configuration::get('REFERRAL_DISCOUNT_TYPE') == 2 ? Tools::displayPrice(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency)), intval(Configuration::get('PS_CURRENCY_DEFAULT')))) : Configuration::get('REFERRAL_DISCOUNT_VALUE')."%");



à essayer...

Link to comment
Share on other sites

Pardon, une erreur s'est glissée dans ma modification :

$data = array(
   '{firstname}' => $newCustomer->firstname,
   '{lastname}' => $newCustomer->lastname,
   '{voucher_num}' => $discount->name,
   '{voucher_amount}' => Configuration::get('REFERRAL_DISCOUNT_TYPE') == 2 ? Tools::displayPrice(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency)), intval(Configuration::get('PS_CURRENCY_DEFAULT')))) : Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency)."%"); 

Link to comment
Share on other sites

J'ai trouvé une solution qui fonctionne pour moi dans les 2 cas (Pourcentage et Montant):
v1.3.1

if (Validate::isLoadedObject($discount))
{
   if (Configuration::get('REFERRAL_DISCOUNT_TYPE') == 2)
   {
        $data = array(
        '{firstname}' => $newCustomer->firstname,
        '{lastname}' => $newCustomer->lastname,
        '{voucher_num}' => $discount->name,
        '{voucher_amount}' => Tools::displayPrice(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency))), intval(Configuration::get('PS_CURRENCY_DEFAULT'))));
     }
     else
      {
         $data = array(
          '{firstname}' => $newCustomer->firstname,
          '{lastname}' => $newCustomer->lastname,
          '{voucher_num}' => $discount->name,
          '{voucher_amount}' =>  Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency))."%");
        }


Mail::Send(intval($cookie->id_lang), 'referralprogram-voucher', $this->l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
}



A confirmer...

Link to comment
Share on other sites

Salut BVince,
J'ai testé ton code mais lorsqu'on passe en Type de bon "Montant", la valeur affichée est à 0.


'{voucher_amount}' => Configuration::get('REFERRAL_DISCOUNT_TYPE') == 2 ? Tools::displayPrice(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency)), intval(Configuration::get('PS_CURRENCY_DEFAULT')))) : Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency)."%"));



PS : Il faut ajouter une parenthèse fermante à la ligne de code que tu nous as proposé.

Link to comment
Share on other sites

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...