From ee598b667da73c0980f3b5fe80ab73cef128d717 Mon Sep 17 00:00:00 2001 From: Valentine Kulikov Date: Thu, 22 Nov 2018 17:48:54 +0000 Subject: [PATCH 1/2] Allowinf 0% discount (no discount) for abandoned cart reminders --- mails/en/followup_1_0.html | 121 +++++++++++++++++++++++++++++++++++++ mails/en/followup_1_0.txt | 16 +++++ ps_reminder.php | 19 +++--- 3 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 mails/en/followup_1_0.html create mode 100644 mails/en/followup_1_0.txt diff --git a/mails/en/followup_1_0.html b/mails/en/followup_1_0.html new file mode 100644 index 0000000..cb17e57 --- /dev/null +++ b/mails/en/followup_1_0.html @@ -0,0 +1,121 @@ + + + + + + + Message from {shop_name} + + + + + + + + + + + + +
  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Hi {firstname} {lastname}, +
+

+ Your cart at {shop_name}

+ + We noticed that during your last visit on {shop_name}, you did not complete the order you had started.

+ Your cart has been saved, you can resume your order by visiting our shop: {shop_url}

+
+
+

+ Your {shop_name} login details

+
+
 
+ + \ No newline at end of file diff --git a/mails/en/followup_1_0.txt b/mails/en/followup_1_0.txt new file mode 100644 index 0000000..9adf004 --- /dev/null +++ b/mails/en/followup_1_0.txt @@ -0,0 +1,16 @@ + +[{shop_url}] + +Hi {firstname} {lastname}, + +We noticed that during your last visit on {shop_name}, you did not +complete the order you had started. + +Your cart has been saved, you can resume your order by visiting our +shop: {shop_name} [{shop_url}] + +Your {shop_name} login details + +{shop_name} [{shop_url}] powered by +PrestaShop(tm) [http://www.prestashop.com/] + diff --git a/ps_reminder.php b/ps_reminder.php index 14df5cc..e7f91ca 100644 --- a/ps_reminder.php +++ b/ps_reminder.php @@ -222,20 +222,21 @@ private function cancelledCart($count = false) array(), 'Modules.Reminder.Admin') ); - if (false !== $voucher) { + // allowing to use 0 discount + //if (false !== $voucher) { $template_vars = array( '{email}' => $email['email'], '{lastname}' => $email['lastname'], '{firstname}' => $email['firstname'], '{amount}' => $conf['PS_FOLLOW_UP_AMOUNT_1'], '{days}' => $conf['PS_FOLLOW_UP_DAYS_1'], - '{voucher_num}' => $voucher->code + '{voucher_num}' => $voucher ? $voucher->code : null ); Mail::Send( (int)$email['id_lang'], - 'followup_1', + $voucher ? 'followup_1' : 'followup_1_0', Mail::l( - 'Your cart and your discount', + $voucher ? 'Your cart and your discount' : 'Your cart', (int)$email['id_lang'] ), $template_vars, @@ -253,7 +254,7 @@ private function cancelledCart($count = false) (int)$email['id_customer'], (int)$email['id_cart'] ); - } + //} } } @@ -597,6 +598,10 @@ private function createDiscount( $date_validity, $description ) { + if ($amount <= 0) { + return false; + } + $cart_rule = new CartRule(); $cart_rule->reduction_percent = (float)$amount; $cart_rule->id_customer = (int)$id_customer; @@ -749,7 +754,7 @@ public function renderForm() array(), 'Modules.Reminder.Admin' ).'
' . $this->context->shop->getBaseURL() . - 'modules/followup/cron.php?secure_key=' . + 'modules/ps_reminder/cron.php?secure_key=' . Configuration::get('PS_FOLLOWUP_SECURE_KEY') . '

'; } @@ -782,7 +787,7 @@ public function renderForm() 'icon' => 'icon-cogs', ), 'description' => $this->trans( - 'For each cancelled cart (with no order), generate a discount and send it to the customer.', + 'For each cancelled cart (with no order), generate a discount and send it to the customer. Use 0% to disable discount and just send a reminder email.', array(), 'Modules.Reminder.Admin' ), From b9c0196be8b3645c5192c122f3dc6210f10ad1c9 Mon Sep 17 00:00:00 2001 From: Valentine Date: Thu, 16 Apr 2020 11:12:47 +0100 Subject: [PATCH 2/2] Update ps_reminder.php Co-Authored-By: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> --- ps_reminder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_reminder.php b/ps_reminder.php index e7f91ca..7ecb3f8 100644 --- a/ps_reminder.php +++ b/ps_reminder.php @@ -787,7 +787,7 @@ public function renderForm() 'icon' => 'icon-cogs', ), 'description' => $this->trans( - 'For each cancelled cart (with no order), generate a discount and send it to the customer. Use 0% to disable discount and just send a reminder email.', + 'For each canceled cart (with no order), generate a discount and send it to the customer. Set it to 0% to disable the discount and just send a reminder email.', array(), 'Modules.Reminder.Admin' ),