Skip to content

Commit

Permalink
Composer version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mediabeastnz committed Feb 16, 2019
1 parent 7e1103d commit da83b0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "mediabeastnz/craft-commerce-abandoned-cart",
"description": "Abandoned Cart plugin for Craft Commerce 2",
"type": "craft-plugin",
"version": "0.0.1",
"version": "1.0.0",
"keywords": [
"craft",
"cms",
"craftcms",
"commerce",
"craft-plugin",
"abandoned cart"
],
Expand Down
10 changes: 8 additions & 2 deletions src/services/Carts.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public function scheduleReminders()
// Completed being: reminders have already been sent
$carts = CartRecord::find()->where('isScheduled = 0')->all();

$firstDelay = AbandonedCart::$plugin->getSettings()->firstReminderDelay;
$secondDelay = AbandonedCart::$plugin->getSettings()->secondReminderDelay;

$firstDelayInSeconds = $firstDelay * 3600;
$secondDelayInSeconds = $secondDelay * 3600;

if ($carts && ($carts) > 0) {
$i = 0;
foreach ($carts as $cart) {
Expand All @@ -53,7 +59,7 @@ public function scheduleReminders()
// and then push it to the queue based on $firstReminderDelay setting
if ($cart->firstReminder == 0) {

Craft::$app->queue->delay(10)->push(new SendEmailReminder([
Craft::$app->queue->delay($firstDelayInSeconds)->push(new SendEmailReminder([
'cartId' => $cart->id,
'reminder' => 1
]));
Expand All @@ -67,7 +73,7 @@ public function scheduleReminders()
// and then push it to the queue based on $secondReminderDelay setting
} elseif ($cart->secondReminder == 0) {

Craft::$app->queue->delay(10)->push(new SendEmailReminder([
Craft::$app->queue->delay($secondDelayInSeconds)->push(new SendEmailReminder([
'cartId' => $cart->id,
'reminder' => 2
]));
Expand Down

0 comments on commit da83b0a

Please sign in to comment.