diff --git a/Helper/Data.php b/Helper/Data.php
index dbcb417..603746e 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -88,7 +88,7 @@ public function getMatchingOrders($storeId = null, $limit = 1000)
}
if ($total = $this->getOrderTotalConfig($storeId)) {
- $orderCollection->addFieldToFilter('grand_total', ['lteq' => $total]);
+ $orderCollection->addFieldToFilter('base_grand_total', ['lteq' => $total]);
}
if ($dayBefore = $this->getPeriodConfig($storeId)) {
diff --git a/Model/Config/Backend/Order/Frequency.php b/Model/Config/Backend/Order/Frequency.php
index 9c034a7..cab53fe 100644
--- a/Model/Config/Backend/Order/Frequency.php
+++ b/Model/Config/Backend/Order/Frequency.php
@@ -111,9 +111,9 @@ public function __construct(
public function afterSave()
{
$time = $this->getData('groups/schedule/fields/time/value');
- $frequency = (int) $this->getData('groups/schedule/fields/schedule_for/value');
+ $frequency = $this->getData('groups/schedule/fields/frequency/value');
- if ($frequency !== ValueConfig::DISABLE) {
+ if ($frequency != (string)ValueConfig::DISABLE) {
$cronExprArray = [
(int) $time[1], //Minute
(int) $time[0], //Hour
diff --git a/Plugin/Model/Order.php b/Plugin/Model/Order.php
new file mode 100644
index 0000000..69c70ae
--- /dev/null
+++ b/Plugin/Model/Order.php
@@ -0,0 +1,64 @@
+helper = $helper;
+ }
+
+ /**
+ * @param CoreOrder $order
+ * @return array
+ */
+ public function beforeUnhold(CoreOrder $order)
+ {
+ if (!$this->helper->isEnabled()) {
+ return [];
+ }
+
+ if ($order->getStatus() !== $order->getState() && $order->getStatus() === CoreOrder::STATE_HOLDED) {
+ $order->setState(CoreOrder::STATE_HOLDED);
+ }
+
+ return [];
+ }
+}
diff --git a/README.md b/README.md
index 9b76530..86a706a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Magento 2 Delete Orders free by Mageplaza
+# Magento 2 Delete Orders extension Free
-**Magento 2 Delete Orders** by Mageplaza helps admins completely remove unnecessary orders, invoices, shipments and credit memos which are arised during testing process. This helps simplify order management and get these arranged neater.
+**[Magento 2 Delete Orders](https://www.mageplaza.com/magento-2-delete-orders/)** by Mageplaza helps admins completely remove unnecessary orders, invoices, shipments and credit memos which are arised during testing process. This helps simplify order management and get these arranged neater.
## Highlight features
@@ -13,7 +13,7 @@
[![Latest Stable Version](https://poser.pugx.org/mageplaza/module-delete-orders/v/stable)](https://packagist.org/packages/mageplaza/module-delete-orders)
[![Total Downloads](https://poser.pugx.org/mageplaza/module-delete-orders/downloads)](https://packagist.org/packages/mageplaza/module-delete-orders)
-**IMPORTANT NOTE:** This version of Mageplaza Delete Orders extension on Github is free as a contribution to the Magento community from Mageplaza. This package does not include the technical support. Should you need technical support for this extension, you will have to buy a license from Mageplaza. [Click here to buy](https://www.mageplaza.com/magento-2-delete-orders/).
+**IMPORTANT NOTE:** This version of Magento 2 Delete Orders extension on Github is free as a contribution to the Magento community from Mageplaza. This package does not include the technical support. Should you need technical support for this extension, you will have to buy a license from Mageplaza. [Click here to buy](https://www.mageplaza.com/magento-2-delete-orders/).
## 1. Documentation
@@ -31,12 +31,20 @@
A: Read solution: https://github.com/mageplaza/module-core/issues/3
-## 3. How to install
+## 3. How to install Magento 2 Delete Orders
## ✓ Install via composer (recommend)
Run the following command in Magento 2 root folder:
+With Marketing Automation (recommend):
+```
+composer require mageplaza/module-delete-orders mageplaza/module-smtp
+php bin/magento setup:upgrade
+php bin/magento setup:static-content:deploy
+```
+
+Without Marketing Automation:
```
composer require mageplaza/module-delete-orders
php bin/magento setup:upgrade
@@ -44,13 +52,13 @@ php bin/magento setup:static-content:deploy
```
-## 4. Problems & Solutions
+## 4. Magento 2 Delete Orders: Problems & Solutions
Before applying any new changes in an online store, store admins have to carry quite many tests. This testing process can arise a number of orders, invoices, shipments and credit memos which are obviously unnecessary in long term and they can cause difficulties in management. Unfortunately, default Magento 2 doesn’t support any functionalities to remove them from the backend. This consequently causes frustration and inconvenience in administration.
There should be a way to deal with this problem, Mageplaza Delete Orders extension is developed to help store admins simplify this task. The module helps delete orders, invoices, shipments and credit memos from the backend but keeps the retire data safe. The job can be done in the blink of an eye with mass deleting feature and ability to delete all.
-## 5. Why online stores must have Mageplaza Delete Orders
+## 5. Why online stores must have Mageplaza's Delete Orders
### To keep the backend well-arranged and neat
The appearance of test orders makes a store’s backend look like a mess. Thus cuts in unnecessary orders, shipments, invoices and credit memos created for testing will make everything neater, easier to follow and less confusing.
@@ -59,7 +67,7 @@ The appearance of test orders makes a store’s backend look like a mess. Thus c
The large number of test orders can confuse store admins and this can cause inconvenience or mistakes in managing. Having a neater backend will simplify order management.
-## 6. Features
+## 6. Magento 2 Delete Orders Features
![magento 2 delete orders](https://cdn.mageplaza.com/media/general/GKcj6HQ.png)
@@ -81,7 +89,7 @@ While deleting orders, invoices, shipments and credit memos, their related data
- The module supports multi stores
- Multiple languages are supported
- It’s easy to customize
-- Mageplaza provides a well-documented user guide for Delete Orders extension
+- Mageplaza provides a well-documented user guide for Magento 2 Delete Orders extension
**People also search:**
- magento 2 delete order
@@ -104,3 +112,18 @@ While deleting orders, invoices, shipments and credit memos, their related data
- [Magento 2 blog extension](https://github.com/mageplaza/magento-2-blog)
- [Magento 2 Ajax Layered Navigation](https://github.com/mageplaza/magento-2-ajax-layered-navigation)
- [Magento 2 security](https://github.com/mageplaza/magento-2-security)
+
+
+**Get more [Magento 2 extension on Marketplace](https://marketplace.magento.com/partner/Mageplaza):**
+- [Magento 2 OneStepCheckout](https://marketplace.magento.com/mageplaza-magento-2-one-step-checkout-extension.html)
+- [Magento 2 Payment Restriction](https://marketplace.magento.com/mageplaza-module-payment-restriction.html)
+- [Magento 2 Frequently Bought Together](https://marketplace.magento.com/mageplaza-module-frequently-bought-together.html)
+- [Magento 2 Shipping Rules](https://marketplace.magento.com/mageplaza-module-shipping-rules.html)
+- [Magento 2 Abandoned Cart Email](https://marketplace.magento.com/mageplaza-module-abandoned-cart-email.html)
+- [Magento 2 SMTP](https://marketplace.magento.com/mageplaza-module-smtp.html)
+- [Magento 2 Shipping Restrictions](https://marketplace.magento.com/mageplaza-module-shipping-restriction.html)
+- [Magento 2 Gift Card](https://marketplace.magento.com/mageplaza-module-gift-card.html)
+- [Magento 2 Order Attributes](https://marketplace.magento.com/mageplaza-module-order-attributes.html)
+- [Magento 2 Layer Navitaion](https://marketplace.magento.com/mageplaza-layered-navigation-m2.html)
+- [Magento 2 SEO All-in-one](https://marketplace.magento.com/mageplaza-magento-2-seo-extension.html)
+
diff --git a/composer.json b/composer.json
index 8de51fd..05995d0 100644
--- a/composer.json
+++ b/composer.json
@@ -1,26 +1,26 @@
-{
- "name": "mageplaza/module-delete-orders",
- "description": "Magento 2 Delete Orders extension",
- "require": {
- "mageplaza/module-core": "^1.4.5"
- },
- "type": "magento2-module",
- "version": "1.2.1",
- "license": "proprietary",
- "authors": [
- {
- "name": "Mageplaza",
- "email": "support@mageplaza.com",
- "homepage": "https://www.mageplaza.com",
- "role": "Technical Support"
- }
- ],
- "autoload": {
- "files": [
- "registration.php"
- ],
- "psr-4": {
- "Mageplaza\\DeleteOrders\\": ""
- }
- }
-}
+{
+ "name": "mageplaza/module-delete-orders",
+ "description": "Magento 2 Delete Orders extension",
+ "require": {
+ "mageplaza/module-core": "^1.4.5"
+ },
+ "type": "magento2-module",
+ "version": "1.2.2",
+ "license": "proprietary",
+ "authors": [
+ {
+ "name": "Mageplaza",
+ "email": "support@mageplaza.com",
+ "homepage": "https://www.mageplaza.com",
+ "role": "Technical Support"
+ }
+ ],
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Mageplaza\\DeleteOrders\\": ""
+ }
+ }
+}
diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml
index 6e9841d..6eb0331 100644
--- a/etc/adminhtml/di.xml
+++ b/etc/adminhtml/di.xml
@@ -1,30 +1,33 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 37bdfc5..0f803bd 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -1,120 +1,122 @@
-
-
-
-
- separator-top
-
- mageplaza
- Mageplaza_DeleteOrders::configuration
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- Select Yes to enable this module
-
-
-
-
-
-
- Mageplaza\DeleteOrders\Model\Config\Source\Frequency
- Mageplaza\DeleteOrders\Model\Config\Backend\Order\Frequency
- Set up the schedule in which orders are deleted automatically.
-
-
-
-
- D|W|M
-
-
-
-
- validate-number
- For example, today is Sunday this week. If you set the period as 7 days, all the orders before Sunday last week will be deleted (if they meet the below conditions).
-
-
-
- Magento\Sales\Model\Config\Source\Order\Status
-
-
-
- Magento\Customer\Model\ResourceModel\Group\Collection
-
-
-
- Magento\Store\Model\System\Store
-
-
-
- Mageplaza\DeleteOrders\Model\Config\Source\Country
-
-
-
- Magento\Directory\Model\Config\Source\Country
-
- 1
-
-
-
-
- validate-number
- Less than or equal this amount
-
-
- Mageplaza\DeleteOrders\Block\Adminhtml\System\Config\Manually
- Click Run Manually to delete the orders which meet the above conditions anytime
- In case you want to delete a specific order, you can use command line
- php bin/magento order:delete order_id
- ]]>
-
-
-
-
-
-
-
- Magento\Config\Model\Config\Source\Yesno
- Email can be sent only when orders are deleted automatically by schedule.
- Install Mageplaza_SMTP to avoid sending to spam box.
- ]]>
-
-
-
-
- Magento\Config\Model\Config\Source\Email\Identity
-
-
-
- Magento\Config\Model\Config\Source\Email\Template
-
-
-
- Separated by comma(s)
-
-
-
-
-
+
+
+
+
+ separator-top
+
+ mageplaza
+ Mageplaza_DeleteOrders::configuration
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ Yes to enable this module.
+ 1. It helps to reduce abandonment cart with One Step Checkout.
+ 2. Magento stores see upwards of 30% revenue 💰 with AVADA. Learn more]]>
+
+
+
+
+
+
+ Mageplaza\DeleteOrders\Model\Config\Source\Frequency
+ Mageplaza\DeleteOrders\Model\Config\Backend\Order\Frequency
+ Set up the schedule in which orders are deleted automatically.
+
+
+
+
+ D|W|M
+
+
+
+
+ validate-number
+ For example, today is Sunday this week. If you set the period as 7 days, all the orders before Sunday last week will be deleted (if they meet the below conditions).
+
+
+
+ Magento\Sales\Model\Config\Source\Order\Status
+
+
+
+ Magento\Customer\Model\ResourceModel\Group\Collection
+
+
+
+ Magento\Store\Model\System\Store
+
+
+
+ Mageplaza\DeleteOrders\Model\Config\Source\Country
+
+
+
+ Magento\Directory\Model\Config\Source\Country
+
+ 1
+
+
+
+
+ validate-number
+ Less than or equal this amount
+
+
+ Mageplaza\DeleteOrders\Block\Adminhtml\System\Config\Manually
+ Click Run Manually to delete the orders which meet the above conditions anytime
+ In case you want to delete a specific order, you can use command line
+ php bin/magento order:delete order_id
+ ]]>
+
+
+
+
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ Email can be sent only when orders are deleted automatically by schedule.
+ Install Mageplaza_SMTP to avoid sending to spam box.
+ ]]>
+
+
+
+
+ Magento\Config\Model\Config\Source\Email\Identity
+
+
+
+ Magento\Config\Model\Config\Source\Email\Template
+
+
+
+ Separated by comma(s)
+
+
+
+
+
diff --git a/etc/config.xml b/etc/config.xml
index a4b73ee..2013864 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -1,44 +1,44 @@
-
-
-
-
-
- 1
-
-
- 1
-
-
- 0
- 0
- 0
- 2
-
-
- 0
- general
- delete_orders_email_template
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+ 0
+ 0
+ 2
+
+
+ 0
+ general
+ delete_orders_email_template
+
+
+
+
diff --git a/etc/crontab.xml b/etc/crontab.xml
index 1415a8a..4268f6c 100644
--- a/etc/crontab.xml
+++ b/etc/crontab.xml
@@ -1,29 +1,29 @@
-
-
-
-
-
- crontab/default/jobs/delete_orders_cron_manually_email/schedule/cron_expr
-
-
-
+
+
+
+
+
+ crontab/default/jobs/delete_orders_cron_manually_email/schedule/cron_expr
+
+
+