Skip to content

Commit

Permalink
Merge pull request #19 from mageplaza/2.3-develop
Browse files Browse the repository at this point in the history
merge branch 2.3 develop into 2.3
  • Loading branch information
phamcuongmp authored Aug 16, 2021
2 parents 7c51f1c + cfd0c37 commit daf27e7
Show file tree
Hide file tree
Showing 9 changed files with 352 additions and 260 deletions.
2 changes: 1 addition & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions Model/Config/Backend/Order/Frequency.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 64 additions & 0 deletions Plugin/Model/Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_DeleteOrder
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/

namespace Mageplaza\DeleteOrders\Plugin\Model;

use Mageplaza\DeleteOrders\Helper\Data;
use Magento\Sales\Model\Order as CoreOrder;

/**
* Class Order
* @package Mageplaza\DeleteOrders\Plugin\Model
*/
class Order
{
/**
* @var Data
*/
protected $helper;

/**
* Order constructor.
* @param Data $helper
*/
public function __construct(
Data $helper
) {
$this->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 [];
}
}
39 changes: 31 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -31,26 +31,34 @@
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
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.
Expand All @@ -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)

Expand All @@ -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
Expand All @@ -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)

52 changes: 26 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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": "[email protected]",
"homepage": "https://www.mageplaza.com",
"role": "Technical Support"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Mageplaza\\DeleteOrders\\": ""
}
}
}
63 changes: 33 additions & 30 deletions etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<?xml version="1.0"?>
<!--
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_DeleteOrders
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Adminhtml\Order\View">
<plugin name="delete_order_add_button_delete" type="Mageplaza\DeleteOrders\Plugin\Order\AddDeleteButton"/>
</type>
<type name="Magento\Ui\Component\MassAction">
<plugin name="delete_order_add_massaction_delete" type="Mageplaza\DeleteOrders\Plugin\Order\AddDeleteAction"/>
</type>
</config>
<?xml version="1.0"?>
<!--
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_DeleteOrders
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Sales\Block\Adminhtml\Order\View">
<plugin name="delete_order_add_button_delete" type="Mageplaza\DeleteOrders\Plugin\Order\AddDeleteButton"/>
</type>
<type name="Magento\Ui\Component\MassAction">
<plugin name="delete_order_add_massaction_delete" type="Mageplaza\DeleteOrders\Plugin\Order\AddDeleteAction"/>
</type>
<type name="Magento\Sales\Model\Order">
<plugin name="delete_order_hold_on" type="Mageplaza\DeleteOrders\Plugin\Model\Order"/>
</type>
</config>
Loading

0 comments on commit daf27e7

Please sign in to comment.