diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e1580f..44c1aaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Release Notes for Abandoned Cart +## 1.1.2 - 2019-04-10 +### Fixed issue [#4] +- Fixed a bug that was introduced in version 1.1.1 + +[#4]: https://github.com/mediabeastnz/craft-commerce-abandoned-cart/issues/4 + +### Added +- Added the ability to change recovery url to soemthing other than shop/cart + ## 1.1.1 - 2019-03-23 ### Added - Added pagination to the dashboard to handle sites with large amounts of orders diff --git a/composer.json b/composer.json index b875945..a59abc7 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mediabeastnz/craft-commerce-abandoned-cart", "description": "Abandoned Cart plugin for Craft Commerce 2", "type": "craft-plugin", - "version": "1.1.1", + "version": "1.1.2", "keywords": [ "craft", "cms", diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 5aabcf9..8e98784 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -126,6 +126,11 @@ public function actionRestoreCart() $abandonedCartRecord->clicked = true; $abandonedCartRecord->save($abandonedCartRecord); + $recoveryUrl = AbandonedCart::$plugin->getSettings()->recoveryUrl; + if($recoveryUrl) { + return $this->redirect($recoveryUrl); + } + return $this->redirect('shop/cart'); } } diff --git a/src/models/AbandonedCart.php b/src/models/AbandonedCart.php index 9d152fa..66a2e5c 100644 --- a/src/models/AbandonedCart.php +++ b/src/models/AbandonedCart.php @@ -7,6 +7,7 @@ namespace mediabeastnz\abandonedcart\models; use mediabeastnz\abandonedcart\AbandonedCart as Plugin; +use mediabeastnz\abandonedcart\records\AbandonedCart as CartRecord; use craft\base\Model; use craft\validators\HandleValidator; diff --git a/src/models/Settings.php b/src/models/Settings.php index 87f4384..4ef8e10 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -28,6 +28,8 @@ class Settings extends Model public $secondReminderSubject = "Your items are still waiting - don't miss out"; + public $recoveryUrl = "shop/cart"; + public function rules() { return [ @@ -39,7 +41,8 @@ public function rules() 'firstReminderTemplate', 'secondReminderTemplate', 'firstReminderSubject', - 'secondReminderSubject' + 'secondReminderSubject', + 'recoveryUrl' ], 'required'], ['restoreExpiryHours', 'integer', 'min' => 24, 'max' => '168'], // Atleast 24hrs ['firstReminderDelay', 'integer', 'min' => 1, 'max' => 24], // 1hr + diff --git a/src/templates/settings.twig b/src/templates/settings.twig index 6c1b99c..c76aa31 100644 --- a/src/templates/settings.twig +++ b/src/templates/settings.twig @@ -99,6 +99,14 @@ errors: settings.getErrors('discountCode') }) }} +{{ forms.textField({ + label: "Recovery Redirect URL", + name: 'recoveryUrl', + value: settings.recoveryUrl, + instructions: 'By default recovered carts will be redirected to shop/cart, use this field if you use something different.
Note: it should just be the slug e.g. shop/cart and not the full URL.', + errors: settings.getErrors('recoveryUrl') +}) }} + {% endnamespace %}