Skip to content

Commit

Permalink
Fixed issue #4 and added recovery url to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mediabeastnz committed Apr 9, 2019
1 parent bb25c53 commit 4d98222
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Expand Down
1 change: 1 addition & 0 deletions src/models/AbandonedCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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 +
Expand Down
8 changes: 8 additions & 0 deletions src/templates/settings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br /><i>Note: it should just be the slug e.g. shop/cart and not the full URL.</i>',
errors: settings.getErrors('recoveryUrl')
}) }}


{% endnamespace %}

Expand Down

0 comments on commit 4d98222

Please sign in to comment.