Jump to content

[SOLVED] How to change expiration date voucher and minimum purchase from referral program


Recommended Posts

Hi,

I wanna ask regarding referral program.
when A refer B to purchase order in my webstore, B will get voucher automatically from referral program module. expiration date will be 1 year from the date when voucher generate.

can i change expiration date to 1 week after he/she get the voucher?

I realize that I can change expiration date at Tab Payment > Voucher but since the voucher generate automatically, it's not polite if I change expiration date when my new customer already saw the expiration date.

-------------------

second question: where can I set minimum purchase for using voucher from referral program?

let's say I give them $10 voucher but minimum purchase to use the voucher is $50 so my buyer will pay $40 when he/she submit order.

I wish I can do some way that automatically when prestashop generate the voucher not I set them one by one.

please help me... and sorry for my bad english

thank you so much

Link to comment
Share on other sites

Change line 84 (in PrestaShop v1.3) of modules/referralprogram/ReferralProgramModule.php from:

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



to:

$discount->date_to = date('Y-m-d H:i:s', time() + 604800); // + 1 week
$discount->minimal = 50;

Link to comment
Share on other sites

one more question,

in my default inviitaion email, I can't get the discount value (i attached pict)


Get sponsored and win a discount voucher of {discount}!



referralprogram-program.php line 25

$file = str_replace('{discount}', Discount::Display(floatval(Configuration::get('referralprogram_DISCOUNT_VALUE')), intval(Configuration::get('referralprogram_DISCOUNT_TYPE')), new Currency($cookie->id_currency)), $file);



what's wrong with that? please help me

24458_60DuvLHsi9uBB6Fsfa4f_t

Link to comment
Share on other sites

What version of PrestaShop are you using? Here's what I have on line 22 of modules/referralprogram/referralprogram-program.php in PrestaShop v1.2.5:

$discount = Discount::display(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE')), intval(Configuration::get('REFERRAL_DISCOUNT_TYPE')), new Currency($cookie->id_currency));



and in PrestaShop v1.3:

$discount = Discount::display(floatval(Configuration::get('REFERRAL_DISCOUNT_VALUE_'.intval($cookie->id_currency))), intval(Configuration::get('REFERRAL_DISCOUNT_TYPE')), new Currency($cookie->id_currency));



and on line 82 in both:

'{discount}' => $discount,

Link to comment
Share on other sites

im using PrestaShop v1.2.5

i already try the code, but i think the problem is my referralprogram-ivitation.html can not get the discount value.

but the others that also use discount value can get it. for example, i attached the pict

at page ..../modules/referralprogram/referralprogram-program.php << can get the discount value

24461_xJtpqaUcZI6evreCJCod_t

Link to comment
Share on other sites

I'm not sure what's happened to your module, but you should check the value in $discount. If that contains the correct discount, and '{discount}' => $discount is being passed in to the mail template, then the discount should display wherever {discount} is in the mail template.

Link to comment
Share on other sites

  • 1 month later...
I'm not sure what's happened to your module, but you should check the value in $discount. If that contains the correct discount, and '{discount}' => $discount is being passed in to the mail template, then the discount should display wherever {discount} is in the mail template.


same case with my module. but just not appear in preview, in actual email its working.
Link to comment
Share on other sites

another issue when send referral email, below is the email eg.

Your friend xxx xxxx wants to sponsor you on Yourshop.com! << this link click-able and user will not authenticate if reg via this link

Get sponsored and win a discount voucher of RM 5.00!

It's very easy to sign up. Just click here! << the user only authenticate with this link

When signing up, don't forget to provide the e-mail address of your sponsoring friend: [email protected]

Am i right? Could be the above link also need to include {shop_url}{link} originally just {shop_url}

Link to comment
Share on other sites

  • 3 months later...
  • 2 years later...

Hello, I know that my question is not exactly related with the thread.

 

But I am modifying the prestashop referral module a bit, in order to make the vouchers generated by referral system, "incompatible"with some other defaults voucher code I have...

 

But looking on the cartRule class, I don't see any rule to find out how to do this .... any idea ?

 

 

Thanks a lot in advance

Link to comment
Share on other sites

  • 3 years later...

I'm using the latest version of the module and the changes needed to the code have changed a little:

 

 

$cartRule->minimum_amount = 25;

 

and

 

$cartRule->date_to = date('Y-m-d H:i:s', time() + 1209600); // + 14 days

Link to comment
Share on other sites

×
×
  • Create New...