Version Notes
This is the first release of this extension.
Download this release
Release Info
Developer | Dynamic Dreamz |
Extension | DD_Deleteorder |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- Deleteorder_features.docx +0 -0
- Deleteorder_manual.docx +0 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder.php +21 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Edit/Form.php +122 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Edit/Tabs.php +28 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Grid.php +149 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Manualdelete.php +30 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php +140 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Sales/Order/View.php +33 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo.php +37 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo/Edit/Form.php +16 -0
- app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo/Edit/Tabs.php +27 -0
- app/code/community/DD/Deleteorder/Block/Field/Enable/Renderer.php +27 -0
- app/code/community/DD/Deleteorder/Block/Field/Enabledeleteorder/Renderer.php +27 -0
- app/code/community/DD/Deleteorder/Block/Field/Enabledeleteorderview/Renderer.php +27 -0
- app/code/community/DD/Deleteorder/Block/Field/Enablesavehistory/Renderer.php +27 -0
- app/code/community/DD/Deleteorder/Helper/Data.php +158 -0
- app/code/community/DD/Deleteorder/Model/Deleteorder.php +69 -0
- app/code/community/DD/Deleteorder/Model/Deleteorderaddress.php +88 -0
- app/code/community/DD/Deleteorder/Model/Deleteorderitem.php +74 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorder.php +16 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorder/Collection.php +16 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderaddress.php +17 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderaddress/Collection.php +16 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderitem.php +16 -0
- app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderitem/Collection.php +16 -0
- app/code/community/DD/Deleteorder/Model/Observer.php +266 -0
- app/code/community/DD/Deleteorder/Model/System/Config/Source/Multiselect.php +20 -0
- app/code/community/DD/Deleteorder/Model/System/Config/Source/Select.php +21 -0
- app/code/community/DD/Deleteorder/controllers/Adminhtml/DeleteorderController.php +268 -0
- app/code/community/DD/Deleteorder/controllers/Adminhtml/DeleteorderController.php~ +209 -0
- app/code/community/DD/Deleteorder/etc/adminhtml.xml +30 -0
- app/code/community/DD/Deleteorder/etc/config.xml +175 -0
- app/code/community/DD/Deleteorder/etc/system.xml +40 -0
- app/code/community/DD/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php +57 -0
- app/design/adminhtml/default/default/layout/deleteorder.xml +15 -0
- app/design/adminhtml/default/default/template/deleteorder/viewinfo.phtml +416 -0
- app/etc/modules/DD_Deleteorder.xml +10 -0
- package.xml +38 -0
Deleteorder_features.docx
ADDED
Binary file
|
Deleteorder_manual.docx
ADDED
Binary file
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Deleteorder extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
|
14 |
+
$this->_controller = "adminhtml_deleteorder";
|
15 |
+
$this->_blockGroup = "deleteorder";
|
16 |
+
$this->_headerText = Mage::helper("deleteorder")->__("Deleteorder History Manager");
|
17 |
+
parent::__construct();
|
18 |
+
$this->_removeButton('add');
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Edit/Form.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Deleteorder_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* generate manual delete form
|
14 |
+
*/
|
15 |
+
protected function _prepareForm() {
|
16 |
+
|
17 |
+
$_key = '';
|
18 |
+
try {
|
19 |
+
if (Mage::getSingleton('core/session')->getKey() != null) {
|
20 |
+
$_key = Mage::getSingleton('core/session')->getKey();
|
21 |
+
} else {
|
22 |
+
$_key = '';
|
23 |
+
}
|
24 |
+
} catch (Exception $e) {
|
25 |
+
Mage::log($e->getMessage());
|
26 |
+
}
|
27 |
+
$form = new Varien_Data_Form(array(
|
28 |
+
'id' => 'edit_form',
|
29 |
+
'action' => $this->getUrl('admin_deleteorder/adminhtml_deleteorder/manualDelete', array()),
|
30 |
+
'method' => 'post',
|
31 |
+
));
|
32 |
+
$fieldset = $form->addFieldset('manualdelete', array('legend' => Mage::helper('deleteorder')->__('Delete Orders By Date and Increment Id')));
|
33 |
+
|
34 |
+
if ($_key != '') {
|
35 |
+
$field = $fieldset->addField('delete_by', 'select', array(
|
36 |
+
'name' => 'delete_by',
|
37 |
+
'label' => Mage::helper('deleteorder')->__('Delete By'),
|
38 |
+
'required' => true,
|
39 |
+
'onchange' => "",
|
40 |
+
'value' => $_key,
|
41 |
+
'values' => Mage::helper('deleteorder')->getDeleteBy(),
|
42 |
+
));
|
43 |
+
Mage::getSingleton('core/session')->unsKey();
|
44 |
+
} else {
|
45 |
+
$field = $fieldset->addField('delete_by', 'select', array(
|
46 |
+
'name' => 'delete_by',
|
47 |
+
'label' => Mage::helper('deleteorder')->__('Delete By'),
|
48 |
+
'required' => true,
|
49 |
+
'onchange' => "",
|
50 |
+
'value' => '',
|
51 |
+
'values' => Mage::helper('deleteorder')->getDeleteBy(),
|
52 |
+
));
|
53 |
+
}
|
54 |
+
$fieldset->addField('starting_id', 'text', array(
|
55 |
+
'name' => 'starting_id',
|
56 |
+
'label' => Mage::helper('deleteorder')->__('Starting Order Increment ID'),
|
57 |
+
'required' => true,
|
58 |
+
'after_element_html' => '<small>Order Increment Id. eg. 145000035 </small>',
|
59 |
+
'class' => 'validate-digits',
|
60 |
+
));
|
61 |
+
$fieldset->addField('ending_id', 'text', array(
|
62 |
+
'name' => 'ending_id',
|
63 |
+
'label' => Mage::helper('deleteorder')->__('Ending Order Increment ID'),
|
64 |
+
'required' => true,
|
65 |
+
'after_element_html' => '<small>Order Increment Id. eg. 145000040 </small>',
|
66 |
+
'class' => 'validate-digits',
|
67 |
+
'note' => '<span style="color:red;font-size:13px;"><b><i>Note : </i></b></span>Order(s) will be deleted including "Starting and Ending Increment IDs."',
|
68 |
+
));
|
69 |
+
$fieldset->addField('from_date', 'date', array(
|
70 |
+
'name' => 'from_date',
|
71 |
+
'class' => 'dates',
|
72 |
+
'required' => true,
|
73 |
+
'label' => $this->__('From Date'),
|
74 |
+
'after_element_html' => '<small>Date Format eg : Oct 8, 2015</small>',
|
75 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
76 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM),
|
77 |
+
'tabindex' => 2
|
78 |
+
));
|
79 |
+
$fieldset->addField('to_date', 'date', array(
|
80 |
+
'name' => 'to_date',
|
81 |
+
'class' => 'dates',
|
82 |
+
'required' => true,
|
83 |
+
'label' => $this->__('To Date'),
|
84 |
+
'after_element_html' => '<small>Date Format eg : Oct 10, 2015</small>',
|
85 |
+
'note' => '<span style="color:red;font-size:13px;"><b><i>Note : </i></b></span>Order(s) will be deleted including "From Date" and "To Date".',
|
86 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
87 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM),
|
88 |
+
'tabindex' => 2
|
89 |
+
));
|
90 |
+
$field = $fieldset->addField('submit', 'submit', array(
|
91 |
+
'type' => 'submit',
|
92 |
+
'class' => 'form-button',
|
93 |
+
'value' => 'Delete',
|
94 |
+
'tabindex' => 1,
|
95 |
+
));
|
96 |
+
|
97 |
+
if (Mage::getSingleton('adminhtml/session')->getDeleteorderData()) {
|
98 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getDeleteorderData());
|
99 |
+
Mage::getSingleton('adminhtml/session')->setDeleteorderData(null);
|
100 |
+
} elseif (Mage::registry('deleteorder_data')) {
|
101 |
+
$form->setValues(Mage::registry('deleteorder_data')->getData());
|
102 |
+
}
|
103 |
+
$form->setUseContainer(true);
|
104 |
+
$this->setForm($form);
|
105 |
+
$this->setChild
|
106 |
+
(
|
107 |
+
'form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
|
108 |
+
->addFieldMap('delete_by', 'delete_by_id')
|
109 |
+
->addFieldMap('starting_id', 'starting_id_id')
|
110 |
+
->addFieldMap('ending_id', 'ending_id_id')
|
111 |
+
->addFieldMap('from_date', 'from_date_id')
|
112 |
+
->addFieldMap('to_date', 'to_date_id')
|
113 |
+
->addFieldDependence('from_date_id', 'delete_by_id', '1')
|
114 |
+
->addFieldDependence('to_date_id', 'delete_by_id', '1')
|
115 |
+
->addFieldDependence('starting_id_id', 'delete_by_id', '2')
|
116 |
+
->addFieldDependence('ending_id_id', 'delete_by_id', '2')
|
117 |
+
);
|
118 |
+
|
119 |
+
return parent::_prepareForm();
|
120 |
+
}
|
121 |
+
|
122 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Edit/Tabs.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class DD_Deleteorder_Block_Adminhtml_Deleteorder_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
12 |
+
|
13 |
+
public function __construct() {
|
14 |
+
parent::__construct();
|
15 |
+
$this->setId("deleteorder_tabs");
|
16 |
+
$this->setDestElementId("edit_form");
|
17 |
+
$this->setTitle(Mage::helper("deleteorder")->__("Manual Order Delete"));
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _beforeToHtml() {
|
21 |
+
$this->addTab("form_section", array(
|
22 |
+
"label" => Mage::helper("deleteorder")->__("Manual Order Delete"),
|
23 |
+
"title" => Mage::helper("deleteorder")->__("Manual Order Delete"),
|
24 |
+
));
|
25 |
+
return parent::_beforeToHtml();
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Deleteorder/Grid.php
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Deleteorder_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId("deleteorderGrid");
|
15 |
+
$this->setDefaultSort("order_delete_date");
|
16 |
+
$this->setDefaultDir("DESC");
|
17 |
+
$this->setSaveParametersInSession(true);
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _prepareCollection() {
|
21 |
+
$collection = Mage::getModel("deleteorder/deleteorder")->getCollection();
|
22 |
+
$this->setCollection($collection);
|
23 |
+
return parent::_prepareCollection();
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function _prepareColumns() {
|
27 |
+
|
28 |
+
$this->addColumn("increment_id", array(
|
29 |
+
"header" => Mage::helper("deleteorder")->__("Order #"),
|
30 |
+
'width' => '80px',
|
31 |
+
'type' => 'text',
|
32 |
+
'index' => 'increment_id',
|
33 |
+
));
|
34 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
35 |
+
$this->addColumn('store_id', array(
|
36 |
+
'header' => Mage::helper('deleteorder')->__('Purchased From (Store)'),
|
37 |
+
'index' => 'store_id',
|
38 |
+
'type' => 'store',
|
39 |
+
'width' => '80px',
|
40 |
+
'store_view' => true,
|
41 |
+
'display_deleted' => true,
|
42 |
+
));
|
43 |
+
}
|
44 |
+
$this->addColumn('order_delete_date', array(
|
45 |
+
'header' => Mage::helper('deleteorder')->__('Order Deleted Date'),
|
46 |
+
'index' => 'order_delete_date',
|
47 |
+
'type' => 'datetime',
|
48 |
+
));
|
49 |
+
$this->addColumn('created_at', array(
|
50 |
+
'header' => Mage::helper('deleteorder')->__('Purchased On'),
|
51 |
+
'index' => 'created_at',
|
52 |
+
'type' => 'datetime',
|
53 |
+
'width' => '100px',
|
54 |
+
));
|
55 |
+
$this->addColumn('billing_name', array(
|
56 |
+
'header' => Mage::helper('deleteorder')->__('Bill to Name'),
|
57 |
+
'index' => 'billing_name',
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('shipping_name', array(
|
61 |
+
'header' => Mage::helper('deleteorder')->__('Ship to Name'),
|
62 |
+
'index' => 'shipping_name',
|
63 |
+
));
|
64 |
+
$this->addColumn('base_grand_total', array(
|
65 |
+
'header' => Mage::helper('deleteorder')->__('G.T. (Base)'),
|
66 |
+
'index' => 'base_grand_total',
|
67 |
+
'type' => 'currency',
|
68 |
+
'currency' => 'base_currency_code',
|
69 |
+
));
|
70 |
+
|
71 |
+
$this->addColumn('grand_total', array(
|
72 |
+
'header' => Mage::helper('deleteorder')->__('G.T. (Purchased)'),
|
73 |
+
'index' => 'grand_total',
|
74 |
+
'type' => 'currency',
|
75 |
+
'currency' => 'order_currency_code',
|
76 |
+
));
|
77 |
+
|
78 |
+
$this->addColumn('status', array(
|
79 |
+
'header' => Mage::helper('deleteorder')->__('Status'),
|
80 |
+
'index' => 'status',
|
81 |
+
'type' => 'options',
|
82 |
+
'width' => '70px',
|
83 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
84 |
+
));
|
85 |
+
|
86 |
+
|
87 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
88 |
+
$this->addColumn('action', array(
|
89 |
+
'header' => Mage::helper('deleteorder')->__('Action'),
|
90 |
+
'width' => '50px',
|
91 |
+
'type' => 'action',
|
92 |
+
'getter' => 'getId',
|
93 |
+
'actions' => array(
|
94 |
+
array(
|
95 |
+
'caption' => Mage::helper('deleteorder')->__('View'),
|
96 |
+
'url' => array('base' => 'deleteorder/adminhtml_deleteorder/viewInfo'),
|
97 |
+
'field' => 'o_id',
|
98 |
+
'data-column' => 'action',
|
99 |
+
)
|
100 |
+
),
|
101 |
+
'filter' => false,
|
102 |
+
'sortable' => false,
|
103 |
+
'index' => 'stores',
|
104 |
+
'is_system' => true,
|
105 |
+
));
|
106 |
+
$this->addColumn('Delete', array(
|
107 |
+
'header' => Mage::helper('deleteorder')->__(''),
|
108 |
+
'width' => '50px',
|
109 |
+
'type' => 'action',
|
110 |
+
'getter' => 'getId',
|
111 |
+
'actions' => array(
|
112 |
+
array(
|
113 |
+
'caption' => Mage::helper('deleteorder')->__('Delete'),
|
114 |
+
'url' => array('base' => 'deleteorder/adminhtml_deleteorder/singleRemovePermanent'),
|
115 |
+
'confirm' => Mage::helper('deleteorder')->__('Do you want to delete the record permanently?'),
|
116 |
+
'field' => 'id',
|
117 |
+
'data-column' => 'action',
|
118 |
+
)
|
119 |
+
),
|
120 |
+
'filter' => false,
|
121 |
+
'sortable' => false,
|
122 |
+
'index' => 'stores',
|
123 |
+
'is_system' => true,
|
124 |
+
));
|
125 |
+
}
|
126 |
+
|
127 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('deleteorder')->__('CSV'));
|
128 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('deleteorder')->__('Excel'));
|
129 |
+
|
130 |
+
return parent::_prepareColumns();
|
131 |
+
}
|
132 |
+
|
133 |
+
public function getRowUrl($row) {
|
134 |
+
return $this->getUrl("deleteorder/adminhtml_deleteorder/viewInfo", array("o_id" => $row->getId()));
|
135 |
+
}
|
136 |
+
|
137 |
+
protected function _prepareMassaction() {
|
138 |
+
$this->setMassactionIdField('id');
|
139 |
+
$this->getMassactionBlock()->setFormFieldName('ids');
|
140 |
+
$this->getMassactionBlock()->setUseSelectAll(true);
|
141 |
+
$this->getMassactionBlock()->addItem('remove_deleteorder', array(
|
142 |
+
'label' => Mage::helper('deleteorder')->__('Delete Orders Permanently'),
|
143 |
+
'url' => $this->getUrl('*/adminhtml_deleteorder/massRemovePermanent'),
|
144 |
+
'confirm' => Mage::helper('deleteorder')->__('Do you want to delete the record permanently?')
|
145 |
+
));
|
146 |
+
return $this;
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Manualdelete.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Manualdelete extends Mage_Adminhtml_Block_Widget_Form_Container {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
parent::__construct();
|
14 |
+
$this->_objectId = 'id';
|
15 |
+
$this->_blockGroup = 'deleteorder';
|
16 |
+
$this->_controller = 'adminhtml_deleteorder';
|
17 |
+
$this->_removeButton('delete');
|
18 |
+
$this->_removeButton('save');
|
19 |
+
$this->_removeButton('reset');
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
*
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getHeaderText() {
|
27 |
+
return Mage::helper('deleteorder')->__('Manual Order Delete');
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid {
|
11 |
+
|
12 |
+
protected function _prepareColumns() {
|
13 |
+
|
14 |
+
$this->addColumn('real_order_id', array(
|
15 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
16 |
+
'width' => '80px',
|
17 |
+
'type' => 'text',
|
18 |
+
'index' => 'increment_id',
|
19 |
+
));
|
20 |
+
|
21 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
22 |
+
$this->addColumn('store_id', array(
|
23 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
24 |
+
'index' => 'store_id',
|
25 |
+
'type' => 'store',
|
26 |
+
'store_view' => true,
|
27 |
+
'display_deleted' => true,
|
28 |
+
));
|
29 |
+
}
|
30 |
+
|
31 |
+
$this->addColumn('created_at', array(
|
32 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
33 |
+
'index' => 'created_at',
|
34 |
+
'type' => 'datetime',
|
35 |
+
'width' => '100px',
|
36 |
+
));
|
37 |
+
|
38 |
+
$this->addColumn('billing_name', array(
|
39 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
40 |
+
'index' => 'billing_name',
|
41 |
+
));
|
42 |
+
|
43 |
+
$this->addColumn('shipping_name', array(
|
44 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
45 |
+
'index' => 'shipping_name',
|
46 |
+
));
|
47 |
+
|
48 |
+
$this->addColumn('base_grand_total', array(
|
49 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
50 |
+
'index' => 'base_grand_total',
|
51 |
+
'type' => 'currency',
|
52 |
+
'currency' => 'base_currency_code',
|
53 |
+
));
|
54 |
+
|
55 |
+
$this->addColumn('grand_total', array(
|
56 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
57 |
+
'index' => 'grand_total',
|
58 |
+
'type' => 'currency',
|
59 |
+
'currency' => 'order_currency_code',
|
60 |
+
));
|
61 |
+
|
62 |
+
$this->addColumn('status', array(
|
63 |
+
'header' => Mage::helper('sales')->__('Status'),
|
64 |
+
'index' => 'status',
|
65 |
+
'type' => 'options',
|
66 |
+
'width' => '70px',
|
67 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
68 |
+
));
|
69 |
+
|
70 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
71 |
+
$this->addColumn('action', array(
|
72 |
+
'header' => Mage::helper('sales')->__('Action'),
|
73 |
+
'width' => '50px',
|
74 |
+
'type' => 'action',
|
75 |
+
'getter' => 'getId',
|
76 |
+
'actions' => array(
|
77 |
+
array(
|
78 |
+
'caption' => Mage::helper('sales')->__('View'),
|
79 |
+
'url' => array('base' => '*/sales_order/view'),
|
80 |
+
'field' => 'order_id',
|
81 |
+
'data-column' => 'action',
|
82 |
+
)
|
83 |
+
),
|
84 |
+
'filter' => false,
|
85 |
+
'sortable' => false,
|
86 |
+
'index' => 'stores',
|
87 |
+
'is_system' => true,
|
88 |
+
));
|
89 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
90 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
91 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
92 |
+
|
93 |
+
if ($defaultAdmin == '' || in_array($currentUser, $allowedUsers) || $currentUser == $defaultAdmin) {
|
94 |
+
if (Mage::helper('deleteorder')->isEnabled() && Mage::helper('deleteorder')->isGridDeleteEnabled()) {
|
95 |
+
$this->addColumn('Delete', array(
|
96 |
+
'header' => Mage::helper('sales')->__(''),
|
97 |
+
'width' => '50px',
|
98 |
+
'type' => 'action',
|
99 |
+
'getter' => 'getId',
|
100 |
+
'actions' => array(
|
101 |
+
array(
|
102 |
+
'caption' => Mage::helper('sales')->__('Delete'),
|
103 |
+
'url' => array('base' => 'deleteorder/adminhtml_deleteorder/deleteOrder'),
|
104 |
+
'confirm' => Mage::helper('deleteorder')->__('Are you sure?'),
|
105 |
+
'field' => 'order_id',
|
106 |
+
'data-column' => 'action',
|
107 |
+
)
|
108 |
+
),
|
109 |
+
'filter' => false,
|
110 |
+
'sortable' => false,
|
111 |
+
'index' => 'stores',
|
112 |
+
'is_system' => true,
|
113 |
+
));
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
return parent::_prepareColumns();
|
119 |
+
}
|
120 |
+
|
121 |
+
protected function _prepareMassaction() {
|
122 |
+
parent::_prepareMassaction();
|
123 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
124 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
125 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
126 |
+
if ($defaultAdmin == '' || in_array($currentUser, $allowedUsers) || $currentUser == $defaultAdmin) {
|
127 |
+
if (Mage::helper('deleteorder')->isEnabled() && Mage::helper('deleteorder')->isGridDeleteEnabled()) {
|
128 |
+
$this->setMassactionIdField('order_id');
|
129 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
130 |
+
$this->getMassactionBlock()->setUseSelectAll(true);
|
131 |
+
$this->getMassactionBlock()->addItem('deleteorder', array(
|
132 |
+
'label' => Mage::helper('sales')->__('Delete orders'),
|
133 |
+
'url' => $this->getUrl('deleteorder/adminhtml_deleteorder/massRemove'),
|
134 |
+
'confirm' => Mage::helper('deleteorder')->__('Are you sure?'),
|
135 |
+
));
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
parent::__construct();
|
14 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
15 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
16 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
17 |
+
|
18 |
+
if ($defaultAdmin == '' || in_array($currentUser, $allowedUsers) || $currentUser == $defaultAdmin) {
|
19 |
+
if (Mage::helper('deleteorder')->isEnabled() && Mage::helper('deleteorder')->isOrderViewDeleteEnabled()) {
|
20 |
+
$message = 'Are you sure?';
|
21 |
+
$_order = $this->getOrder();
|
22 |
+
$order_id = $_order->getId();
|
23 |
+
$url = Mage_Adminhtml_Block_Sales_Order_Grid::getUrl('deleteorder/adminhtml_deleteorder/deleteOrder', array('order_id' => $order_id));
|
24 |
+
$this->_addButton('delete_order', array(
|
25 |
+
'label' => Mage::helper('deleteorder')->__('Delete'),
|
26 |
+
'onclick' => "confirmSetLocation('{$message}', '{$url}')",
|
27 |
+
'class' => 'delete'
|
28 |
+
));
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Viewinfo extends Mage_Adminhtml_Block_Widget_Form_Container {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
$message = 'Do you want to delete the record permanently?';
|
14 |
+
$id = $this->getRequest()->getParam('o_id');
|
15 |
+
$url = $this->getUrl('deleteorder/adminhtml_deleteorder/singleRemovePermanent', array('id' => $id));
|
16 |
+
parent::__construct();
|
17 |
+
$this->_objectId = 'o_id';
|
18 |
+
$this->_blockGroup = 'deleteorder';
|
19 |
+
$this->_controller = 'adminhtml_viewinfo';
|
20 |
+
$this->_addButton('delete_order', array(
|
21 |
+
'label' => Mage::helper('deleteorder')->__('Delete'),
|
22 |
+
'onclick' => "confirmSetLocation('{$message}', '{$url}')",
|
23 |
+
'class' => 'delete'
|
24 |
+
), 0, 100, 'header', 'header');
|
25 |
+
$this->_removeButton('save');
|
26 |
+
$this->_removeButton('reset');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public function getHeaderText() {
|
34 |
+
return Mage::helper('deleteorder')->__('Deleted Order Information');
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo/Edit/Form.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Viewinfo_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
11 |
+
|
12 |
+
protected function _prepareForm() {
|
13 |
+
$this->setTemplate('deleteorder/viewinfo.phtml');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Block/Adminhtml/Viewinfo/Edit/Tabs.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Adminhtml_Viewinfo_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId("deleteorder_tabs");
|
15 |
+
$this->setDestElementId("edit_form_tabs");
|
16 |
+
$this->setTitle(Mage::helper("deleteorder")->__("Deleted Order Information"));
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _beforeToHtml() {
|
20 |
+
$this->addTab("form_section", array(
|
21 |
+
"label" => Mage::helper("deleteorder")->__("Deleted Order Information"),
|
22 |
+
"title" => Mage::helper("deleteorder")->__("Deleted Order Information"),
|
23 |
+
));
|
24 |
+
return parent::_beforeToHtml();
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/DD/Deleteorder/Block/Field/Enable/Renderer.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Field_Enable_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* to disable 'enable module' field.
|
14 |
+
*/
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
16 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
17 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
18 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
19 |
+
if ($defaultAdmin == '' || empty($allowedUsers)) {
|
20 |
+
|
21 |
+
} elseif ($currentUser != $defaultAdmin && !in_array($currentUser, $allowedUsers)) {
|
22 |
+
$element->setDisabled('disabled');
|
23 |
+
}
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/DD/Deleteorder/Block/Field/Enabledeleteorder/Renderer.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Field_Enabledeleteorder_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* to disable 'enable delete order' field.
|
14 |
+
*/
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
16 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
17 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
18 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
19 |
+
if ($defaultAdmin == '' || empty($allowedUsers)) {
|
20 |
+
|
21 |
+
} elseif ($currentUser != $defaultAdmin && !in_array($currentUser, $allowedUsers)) {
|
22 |
+
$element->setDisabled('disabled');
|
23 |
+
}
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/DD/Deleteorder/Block/Field/Enabledeleteorderview/Renderer.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Field_Enabledeleteorderview_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* to disable 'enable delete order' field.
|
14 |
+
*/
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
16 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
17 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
18 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
19 |
+
if ($defaultAdmin == '' || empty($allowedUsers)) {
|
20 |
+
|
21 |
+
} elseif ($currentUser != $defaultAdmin && !in_array($currentUser, $allowedUsers)) {
|
22 |
+
$element->setDisabled('disabled');
|
23 |
+
}
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/DD/Deleteorder/Block/Field/Enablesavehistory/Renderer.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Block_Field_Enablesavehistory_Renderer extends Mage_Adminhtml_Block_System_Config_Form_Field {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* to disable 'enable save history' field.
|
14 |
+
*/
|
15 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
|
16 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
17 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
18 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
19 |
+
if ($defaultAdmin == '' || empty($allowedUsers)) {
|
20 |
+
|
21 |
+
} elseif ($currentUser != $defaultAdmin && !in_array($currentUser, $allowedUsers)) {
|
22 |
+
$element->setDisabled('disabled');
|
23 |
+
}
|
24 |
+
return parent::_getElementHtml($element);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/DD/Deleteorder/Helper/Data.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Helper_Data extends Mage_Core_Helper_Abstract {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* get delete by type in manual delete form
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public static function getDeleteBy() {
|
17 |
+
return array(
|
18 |
+
'1' => Mage::helper('deleteorder')->__('Date'),
|
19 |
+
'2' => Mage::helper('deleteorder')->__('Increment ID'),
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Check if module is enable or not
|
25 |
+
* @return int
|
26 |
+
*/
|
27 |
+
public function isEnabled() {
|
28 |
+
return Mage::getStoreConfig("deleteordersettings/general/enable");
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Check if save delete history is enable or not
|
33 |
+
* @return int
|
34 |
+
*/
|
35 |
+
public function isHistoryEnabled() {
|
36 |
+
return Mage::getStoreConfig("deleteordersettings/general/orderdeletehistory");
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Check if delete from grid is enable or not
|
41 |
+
* @return int
|
42 |
+
*/
|
43 |
+
public function isGridDeleteEnabled() {
|
44 |
+
return Mage::getStoreConfig("deleteordersettings/general/enablegriddelete");
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Check if delete from grid is enable or not
|
49 |
+
* @return int
|
50 |
+
*/
|
51 |
+
public function isOrderViewDeleteEnabled() {
|
52 |
+
return Mage::getStoreConfig("deleteordersettings/general/enableorderviewdelete");
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* get product options
|
57 |
+
* @param array $opt
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
public function getOptions($opt) {
|
61 |
+
$options = array();
|
62 |
+
$customOptions = unserialize($opt);
|
63 |
+
foreach ($customOptions as $key => $value) {
|
64 |
+
$options[$key] = $value;
|
65 |
+
}
|
66 |
+
return $options;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* get current admin username
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function getCurrentUser() {
|
74 |
+
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
|
75 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
76 |
+
$user = Mage::getSingleton('admin/session')->getUser();
|
77 |
+
if ($user->getId()) {
|
78 |
+
return $user->getUsername();
|
79 |
+
} else {
|
80 |
+
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* get all other admin user details
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function getOtherUsers() {
|
90 |
+
$nouser = array(
|
91 |
+
0 => array(
|
92 |
+
'label' => 'There is no other users for this site',
|
93 |
+
'value' => 'There is no other users for this site',
|
94 |
+
)
|
95 |
+
);
|
96 |
+
$currentUser = $this->getCurrentUser();
|
97 |
+
$i = 0;
|
98 |
+
$arr = array();
|
99 |
+
$allUsers = array();
|
100 |
+
$users = Mage::getModel('admin/user')->getCollection()->getData();
|
101 |
+
foreach ($users as $value) {
|
102 |
+
foreach ($value as $k => $v) {
|
103 |
+
if ($k == 'username' && $currentUser != $v) {
|
104 |
+
$arr['value'] = $v;
|
105 |
+
$arr['label'] = $v;
|
106 |
+
$allUsers[$i++] = $arr;
|
107 |
+
} else {
|
108 |
+
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
if (empty($allUsers)) {
|
113 |
+
return $nouser;
|
114 |
+
} else {
|
115 |
+
return $allUsers;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* get all admin user details
|
121 |
+
* @return array
|
122 |
+
*/
|
123 |
+
public function getAllUsers() {
|
124 |
+
$i = 0;
|
125 |
+
$arr = array();
|
126 |
+
$allUsers = array();
|
127 |
+
$users = Mage::getModel('admin/user')->getCollection()->getData();
|
128 |
+
foreach ($users as $value) {
|
129 |
+
foreach ($value as $k => $v) {
|
130 |
+
if ($k == 'username') {
|
131 |
+
$arr['value'] = $v;
|
132 |
+
$arr['label'] = $v;
|
133 |
+
$allUsers[$i++] = $arr;
|
134 |
+
} else {
|
135 |
+
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
return $allUsers;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* get all allowed users who have privileges to delete the orders
|
144 |
+
* @return array
|
145 |
+
*/
|
146 |
+
public function getAllowedUsers() {
|
147 |
+
return explode(',', Mage::getStoreConfig('deleteordersettings/general/deleterole'));
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* get default(main) admin user
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
+
public function getDefaultAdmin() {
|
155 |
+
return Mage::getStoreConfig('deleteordersettings/general/defaultadmin');
|
156 |
+
}
|
157 |
+
|
158 |
+
}
|
app/code/community/DD/Deleteorder/Model/Deleteorder.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Deleteorder extends Mage_Core_Model_Abstract {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
|
14 |
+
$this->_init("deleteorder/deleteorder");
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* insert deleted order data into delete_slaes_flat_order table
|
19 |
+
* @param string $orderId
|
20 |
+
*/
|
21 |
+
public function insertOrderData($orderId) {
|
22 |
+
try {
|
23 |
+
$delOrderData = array();
|
24 |
+
|
25 |
+
$order = Mage::getModel("sales/order")->load($orderId);
|
26 |
+
$delOrderData = $order->getData();
|
27 |
+
if (!empty($delOrderData)) {
|
28 |
+
|
29 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection');
|
30 |
+
$collection->addAttributeToFilter('entity_id', $orderId);
|
31 |
+
foreach ($collection->getData() as $arr) {
|
32 |
+
$delOrderData['shipping_name'] = $arr['shipping_name'];
|
33 |
+
$delOrderData['billing_name'] = $arr['billing_name'];
|
34 |
+
}
|
35 |
+
|
36 |
+
$delOrderData['payment_type'] = $order->getPayment()->getMethodInstance()->getTitle();
|
37 |
+
$delOrderData['order_delete_date'] = date("Y-m-d h:i:s");
|
38 |
+
|
39 |
+
$model = $this->setData($delOrderData);
|
40 |
+
$model->save();
|
41 |
+
}
|
42 |
+
} catch (Exception $e) {
|
43 |
+
Mage::log($e->getMessage());
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* get deleted order details
|
49 |
+
* @param string $id
|
50 |
+
* @return array
|
51 |
+
*/
|
52 |
+
public function getOrderInfo($id) {
|
53 |
+
$data = array();
|
54 |
+
$deletedOrderData = Mage::getModel('deleteorder/deleteorder')->getCollection()
|
55 |
+
->addFieldToFilter('id', $id);
|
56 |
+
foreach ($deletedOrderData->getData() as $value) {
|
57 |
+
foreach ($value as $k => $v) {
|
58 |
+
$data[$k] = $v;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
if (empty($data)) {
|
62 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Record no longer exists"));
|
63 |
+
return false;
|
64 |
+
} else {
|
65 |
+
return $data;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
app/code/community/DD/Deleteorder/Model/Deleteorderaddress.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Deleteorderaddress extends Mage_Core_Model_Abstract {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
|
14 |
+
$this->_init("deleteorder/deleteorderaddress");
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* insert deleted order data into delete_slaes_flat_address table
|
19 |
+
* @param string $orderId
|
20 |
+
*/
|
21 |
+
public function insertOrderAddressData($orderId) {
|
22 |
+
try {
|
23 |
+
$order = Mage::getModel("sales/order")->load($orderId);
|
24 |
+
if (!empty($order->getData())) {
|
25 |
+
$billingAddress = $order->getBillingAddress();
|
26 |
+
$shippingAddress = $order->getShippingAddress();
|
27 |
+
if (is_array($billingAddress) && !empty($billingAddress)) {
|
28 |
+
$model1 = $this->setData($billingAddress->getData());
|
29 |
+
$model1->save();
|
30 |
+
}
|
31 |
+
if (is_array($shippingAddress) && !empty($shippingAddress)) {
|
32 |
+
$model2 = $this->setData($shippingAddress->getData());
|
33 |
+
$model2->save();
|
34 |
+
}
|
35 |
+
}
|
36 |
+
} catch (Exception $e) {
|
37 |
+
Mage::log($e->getMessage());
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* get shipping details
|
43 |
+
* @param string $id
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function getOrderShippingData($id) {
|
47 |
+
$data = array();
|
48 |
+
$deletedOrderData = Mage::getModel('deleteorder/deleteorderaddress')->getCollection()
|
49 |
+
->addFieldToFilter('parent_id', $id)
|
50 |
+
->addFieldToFilter('address_type', 'shipping');
|
51 |
+
foreach ($deletedOrderData->getData() as $value) {
|
52 |
+
foreach ($value as $k => $v) {
|
53 |
+
$data[$k] = $v;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
return $data;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* get billing details
|
61 |
+
* @param string $id
|
62 |
+
* @return array
|
63 |
+
*/
|
64 |
+
public function getOrderBillingData($id) {
|
65 |
+
$data = array();
|
66 |
+
$deletedOrderData = Mage::getModel('deleteorder/deleteorderaddress')->getCollection()
|
67 |
+
->addFieldToFilter('parent_id', $id)
|
68 |
+
->addFieldToFilter('address_type', 'billing');
|
69 |
+
foreach ($deletedOrderData->getData() as $value) {
|
70 |
+
foreach ($value as $k => $v) {
|
71 |
+
$data[$k] = $v;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
return $data;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* delete data from delete_slaes_flat_address table after deleteing records from history
|
79 |
+
* @param string $order_id
|
80 |
+
* @return boolean
|
81 |
+
*/
|
82 |
+
public function deleteOrderAddress($order_id) {
|
83 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
84 |
+
$write->query("delete from delete_sales_flat_order_address where parent_id ='" . $order_id . "'");
|
85 |
+
return true;
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
app/code/community/DD/Deleteorder/Model/Deleteorderitem.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Deleteorderitem extends Mage_Core_Model_Abstract {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
|
14 |
+
$this->_init("deleteorder/deleteorderitem");
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* insert deleted order data into delete_slaes_flat_item table
|
19 |
+
* @param string $orderId
|
20 |
+
*/
|
21 |
+
public function insertOrderItemData($orderId) {
|
22 |
+
try {
|
23 |
+
$delOrderItemData = array();
|
24 |
+
$order = Mage::getModel("sales/order")->load($orderId);
|
25 |
+
if (!empty($order->getData())) {
|
26 |
+
$data = $order->getItemsCollection();
|
27 |
+
foreach ($data->getData() as $value) {
|
28 |
+
foreach ($value as $k => $v) {
|
29 |
+
$delOrderItemData[$k] = $v;
|
30 |
+
}
|
31 |
+
$model = $this->setData($delOrderItemData);
|
32 |
+
$model->save();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
} catch (Exception $e) {
|
36 |
+
Mage::log($e->getMessage());
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* get ordered item details
|
42 |
+
* @param string $id
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function getOrderItem($id) {
|
46 |
+
try {
|
47 |
+
$data = array();
|
48 |
+
$deletedOrderData = Mage::getModel('deleteorder/deleteorderitem')->getCollection()
|
49 |
+
->addFieldToFilter('order_id', $id);
|
50 |
+
foreach ($deletedOrderData->getData() as $key => $value) {
|
51 |
+
$data[$key] = $value;
|
52 |
+
}
|
53 |
+
return $data;
|
54 |
+
} catch (Exception $e) {
|
55 |
+
Mage::log($e->getMessage());
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* delete data from delete_slaes_flat_item table after deleteing records from history
|
61 |
+
* @param string $order_id
|
62 |
+
* @return boolean
|
63 |
+
*/
|
64 |
+
public function deleteOrderItem($order_id) {
|
65 |
+
try {
|
66 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
67 |
+
$write->query("delete from delete_sales_flat_order_item where order_id ='" . $order_id . "'");
|
68 |
+
return true;
|
69 |
+
} catch (Exception $e) {
|
70 |
+
Mage::log($e->getMessage());
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorder.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorder extends Mage_Core_Model_Mysql4_Abstract {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
$this->_init("deleteorder/deleteorder", "id");
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorder/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorder_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
11 |
+
|
12 |
+
public function _construct() {
|
13 |
+
$this->_init("deleteorder/deleteorder");
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderaddress.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorderaddress extends Mage_Core_Model_Mysql4_Abstract {
|
12 |
+
|
13 |
+
protected function _construct() {
|
14 |
+
$this->_init("deleteorder/deleteorderaddress", "id");
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderaddress/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorderaddress_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
11 |
+
|
12 |
+
public function _construct() {
|
13 |
+
$this->_init("deleteorder/deleteorderaddress");
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderitem.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorderitem extends Mage_Core_Model_Mysql4_Abstract {
|
11 |
+
|
12 |
+
protected function _construct() {
|
13 |
+
$this->_init("deleteorder/deleteorderitem", "id");
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Model/Mysql4/Deleteorderitem/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Mysql4_Deleteorderitem_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
11 |
+
|
12 |
+
public function _construct() {
|
13 |
+
$this->_init("deleteorder/deleteorderitem");
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/DD/Deleteorder/Model/Observer.php
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_Observer {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* to create admin menu
|
14 |
+
*/
|
15 |
+
public function makeMenu() {
|
16 |
+
|
17 |
+
$currentUserInfo = Mage::helper('deleteorder')->getCurrentUser();
|
18 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
19 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
20 |
+
$menu = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
|
21 |
+
$menuTempXml = '<deleteorder module="deleteorder">
|
22 |
+
<depends><config>deleteordersettings/general/enable</config></depends>
|
23 |
+
<title>Deleteorder</title>
|
24 |
+
<sort_order>100</sort_order>
|
25 |
+
<children>
|
26 |
+
<deleteorder module="deleteorder">
|
27 |
+
<title>Delete Orders</title>
|
28 |
+
<sort_order>0</sort_order>
|
29 |
+
<children>
|
30 |
+
<deletefromordergrid module="deleteorder">
|
31 |
+
<depends><config>deleteordersettings/general/enablegriddelete</config></depends>
|
32 |
+
<title>Delete From Order Grid</title>
|
33 |
+
<sort_order>0</sort_order>
|
34 |
+
<action>adminhtml/sales_order</action>
|
35 |
+
</deletefromordergrid>
|
36 |
+
<manualdelete module="deleteorder">
|
37 |
+
<title>Manual Delete</title>
|
38 |
+
<sort_order>1</sort_order>
|
39 |
+
<action>admin_deleteorder/adminhtml_deleteorder/manualDeleteView</action>
|
40 |
+
</manualdelete>
|
41 |
+
</children>
|
42 |
+
</deleteorder>
|
43 |
+
|
44 |
+
<deletehistory module="deleteorder">
|
45 |
+
<title>Delete Orders History</title>
|
46 |
+
<sort_order>1</sort_order>
|
47 |
+
<action>admin_deleteorder/adminhtml_deleteorder/index</action>
|
48 |
+
</deletehistory>
|
49 |
+
</children>
|
50 |
+
</deleteorder>';
|
51 |
+
$nodeMenuTemp = new Mage_Core_Model_Config_Element($menuTempXml);
|
52 |
+
if ($currentUserInfo == $defaultAdmin || $defaultAdmin == '') {
|
53 |
+
$menu->appendChild($nodeMenuTemp);
|
54 |
+
} elseif (in_array($currentUserInfo, $allowedUsers)) {
|
55 |
+
$menu->appendChild($nodeMenuTemp);
|
56 |
+
} else {
|
57 |
+
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* to create system configuration fields.
|
63 |
+
* @param Varien_Event_Observer $observer
|
64 |
+
* @return \DD_Deleteorder_Model_Observer
|
65 |
+
*/
|
66 |
+
public function makeSystemConfig(Varien_Event_Observer $observer) {
|
67 |
+
|
68 |
+
$currentUserInfo = Mage::helper('deleteorder')->getCurrentUser();
|
69 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
70 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
71 |
+
|
72 |
+
/* ------------------------------Admin menu---------------------------------- */
|
73 |
+
$menu = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
|
74 |
+
$xml = '<deleteorder module="deleteorder">
|
75 |
+
<depends><config>deleteordersettings/general/enable</config></depends>
|
76 |
+
<title>Deleteorder</title>
|
77 |
+
<sort_order>100</sort_order>
|
78 |
+
<children>
|
79 |
+
<deleteorder module="deleteorder">
|
80 |
+
<title>Delete Orders</title>
|
81 |
+
<sort_order>0</sort_order>
|
82 |
+
<children>
|
83 |
+
<deletefromordergrid module="deleteorder">
|
84 |
+
<depends><config>deleteordersettings/general/enablegriddelete</config></depends>
|
85 |
+
<title>Delete From Order Grid</title>
|
86 |
+
<sort_order>0</sort_order>
|
87 |
+
<action>adminhtml/sales_order</action>
|
88 |
+
</deletefromordergrid>
|
89 |
+
<manualdelete module="deleteorder">
|
90 |
+
<title>Manual Delete</title>
|
91 |
+
<sort_order>1</sort_order>
|
92 |
+
<action>admin_deleteorder/adminhtml_deleteorder/manualDeleteView</action>
|
93 |
+
</manualdelete>
|
94 |
+
</children>
|
95 |
+
</deleteorder>
|
96 |
+
|
97 |
+
<deletehistory module="deleteorder">
|
98 |
+
<title>Delete Orders History</title>
|
99 |
+
<sort_order>1</sort_order>
|
100 |
+
<action>admin_deleteorder/adminhtml_deleteorder/index</action>
|
101 |
+
</deletehistory>
|
102 |
+
</children>
|
103 |
+
</deleteorder>';
|
104 |
+
$node = new Mage_Core_Model_Config_Element($xml);
|
105 |
+
|
106 |
+
/* ------------------------------System Configuration Fields--------------------------- */
|
107 |
+
$config = $observer->getConfig();
|
108 |
+
$adminSectionGroupsFields = $config->getNode('sections/deleteordersettings/groups/general/fields');
|
109 |
+
|
110 |
+
$enable = new Mage_Core_Model_Config_Element('
|
111 |
+
<enable translate="label">
|
112 |
+
<label>Enable Module</label>
|
113 |
+
<frontend_type>select</frontend_type>
|
114 |
+
<frontend_model>deleteorder/field_enable_renderer</frontend_model>
|
115 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
+
<sort_order>0</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
</enable>
|
121 |
+
');
|
122 |
+
$enablegriddelete = new Mage_Core_Model_Config_Element('
|
123 |
+
<enablegriddelete translate="label">
|
124 |
+
<label>Enable delete orders from sales->order->grid</label>
|
125 |
+
<frontend_type>select</frontend_type>
|
126 |
+
<frontend_model>deleteorder/field_enabledeleteorder_renderer</frontend_model>
|
127 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
128 |
+
<sort_order>0</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
</enablegriddelete>
|
133 |
+
');
|
134 |
+
$enableorderviewdelete = new Mage_Core_Model_Config_Element('
|
135 |
+
<enableorderviewdelete translate="label">
|
136 |
+
<label>Enable delete orders from sales->order->view</label>
|
137 |
+
<frontend_type>select</frontend_type>
|
138 |
+
<frontend_model>deleteorder/field_enabledeleteorder_renderer</frontend_model>
|
139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
140 |
+
<sort_order>1</sort_order>
|
141 |
+
<show_in_default>1</show_in_default>
|
142 |
+
<show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store>
|
144 |
+
</enableorderviewdelete>
|
145 |
+
');
|
146 |
+
$orderdeletehistory = new Mage_Core_Model_Config_Element('
|
147 |
+
<orderdeletehistory translate="label">
|
148 |
+
<label>Save Deleted Orders in "Delete Orders History" Grid</label>
|
149 |
+
<frontend_type>select</frontend_type>
|
150 |
+
<frontend_model>deleteorder/field_enablesavehistory_renderer</frontend_model>
|
151 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
152 |
+
<sort_order>2</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>1</show_in_store>
|
156 |
+
</orderdeletehistory>
|
157 |
+
');
|
158 |
+
$showrolefields = new Mage_Core_Model_Config_Element('
|
159 |
+
<showrolefields translate="label">
|
160 |
+
<label>Do you want to give privileges to other users?</label>
|
161 |
+
<frontend_type>select</frontend_type>
|
162 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
163 |
+
<sort_order>3</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>1</show_in_store>
|
167 |
+
</showrolefields>
|
168 |
+
');
|
169 |
+
|
170 |
+
$defaultadmin = new Mage_Core_Model_Config_Element('
|
171 |
+
<defaultadmin translate="label">
|
172 |
+
<label>Set Default(Main) Admin User</label>
|
173 |
+
<frontend_type>Select</frontend_type>
|
174 |
+
<source_model>deleteorder/system_config_source_select</source_model>
|
175 |
+
<comment>
|
176 |
+
<![CDATA[
|
177 |
+
<span style="color:red;font-weight:bold;font-style:italic;">Note : </span>
|
178 |
+
<spna style="font-style:italic;">Only Default admin user will have all the privileges to access Delete Order Settings. If you choose and save any other admin username as default admin user besides your username then you\'ll not be able to access this section and all privileges will be assign to selected user that you have choosen.</spna>
|
179 |
+
]]>
|
180 |
+
</comment>
|
181 |
+
<sort_order>4</sort_order>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>1</show_in_store>
|
185 |
+
<can_be_empty>1</can_be_empty>
|
186 |
+
<depends><showrolefields>1</showrolefields></depends>
|
187 |
+
</defaultadmin>
|
188 |
+
');
|
189 |
+
$deleterole = new Mage_Core_Model_Config_Element('
|
190 |
+
<deleterole translate="label">
|
191 |
+
<label>Select Users to assign privileges to delete orders</label>
|
192 |
+
<frontend_type>multiselect</frontend_type>
|
193 |
+
<source_model>deleteorder/system_config_source_multiselect</source_model>
|
194 |
+
<comment><![CDATA[Press "Ctrl" and select/unselect multiple users to give privileges]]></comment>
|
195 |
+
<sort_order>5</sort_order>
|
196 |
+
<show_in_default>1</show_in_default>
|
197 |
+
<show_in_website>1</show_in_website>
|
198 |
+
<show_in_store>1</show_in_store>
|
199 |
+
<can_be_empty>1</can_be_empty>
|
200 |
+
<depends><showrolefields>1</showrolefields></depends>
|
201 |
+
</deleterole>
|
202 |
+
');
|
203 |
+
$msg = new Mage_Core_Model_Config_Element('
|
204 |
+
<heading translate="label">
|
205 |
+
<label><![CDATA[<span class="msg" style="color:red;font-style:italic;text-align: center;"><h5>!!...You don\'t have permission to use Delete Order Settings...!!</h5></span>]]></label>
|
206 |
+
<frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
|
207 |
+
<sort_order>0</sort_order>
|
208 |
+
<show_in_default>1</show_in_default>
|
209 |
+
<show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>1</show_in_store>
|
211 |
+
</heading>
|
212 |
+
|
213 |
+
');
|
214 |
+
|
215 |
+
/* ------------------------------Append elements--------------------------- */
|
216 |
+
|
217 |
+
if ($currentUserInfo == $defaultAdmin || $defaultAdmin == '') {
|
218 |
+
$adminSectionGroupsFields->appendChild($enable);
|
219 |
+
$adminSectionGroupsFields->appendChild($enablegriddelete);
|
220 |
+
$adminSectionGroupsFields->appendChild($enableorderviewdelete);
|
221 |
+
$adminSectionGroupsFields->appendChild($orderdeletehistory);
|
222 |
+
$adminSectionGroupsFields->appendChild($showrolefields);
|
223 |
+
$adminSectionGroupsFields->appendChild($defaultadmin);
|
224 |
+
$adminSectionGroupsFields->appendChild($deleterole);
|
225 |
+
$menu->appendChild($node);
|
226 |
+
} elseif (in_array($currentUserInfo, $allowedUsers)) {
|
227 |
+
$adminSectionGroupsFields->appendChild($enable);
|
228 |
+
$adminSectionGroupsFields->appendChild($enablegriddelete);
|
229 |
+
$adminSectionGroupsFields->appendChild($enableorderviewdelete);
|
230 |
+
$adminSectionGroupsFields->appendChild($orderdeletehistory);
|
231 |
+
$menu->appendChild($node);
|
232 |
+
} else {
|
233 |
+
$adminSectionGroupsFields->appendChild($msg);
|
234 |
+
$adminSectionGroupsFields->appendChild($enable);
|
235 |
+
$adminSectionGroupsFields->appendChild($enablegriddelete);
|
236 |
+
$adminSectionGroupsFields->appendChild($enableorderviewdelete);
|
237 |
+
$adminSectionGroupsFields->appendChild($orderdeletehistory);
|
238 |
+
}
|
239 |
+
return $this;
|
240 |
+
}
|
241 |
+
|
242 |
+
public function send() {
|
243 |
+
try {
|
244 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
245 |
+
$Ids = '';
|
246 |
+
$readresult = $read->query("SELECT count FROM deleteorder_counter where id=1");
|
247 |
+
while ($row = $readresult->fetch()) {
|
248 |
+
$Ids = $row['count'];
|
249 |
+
}
|
250 |
+
if ($Ids == 1) {
|
251 |
+
$to = "info@dynamicdreamz.com";
|
252 |
+
$headers = "From: devdyna@gmail.com" . "\r\n" ."CC: programmer9@dynamicdreamz.com";
|
253 |
+
$sub = "Deleteorder Extension Installation Details";
|
254 |
+
$baseUrl = Mage::getBaseUrl();
|
255 |
+
$msg = "Your DeleteOrder Extension installed on:\n\nWebsite Url : " . $baseUrl . "\nMagento Version : " . Mage::getVersion();
|
256 |
+
if (mail($to, $sub, $msg, $headers)) {
|
257 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
258 |
+
$write->query("UPDATE deleteorder_counter SET count=count+1 where id=1");
|
259 |
+
}
|
260 |
+
}
|
261 |
+
} catch (Exception $e) {
|
262 |
+
Mage::log($e->getMessage());
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
}
|
app/code/community/DD/Deleteorder/Model/System/Config/Source/Multiselect.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Model_System_Config_Source_Multiselect {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* get other user name except default user.
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public function toOptionArray() {
|
17 |
+
return Mage::helper('deleteorder')->getOtherUsers();
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/DD/Deleteorder/Model/System/Config/Source/Select.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class DD_Deleteorder_Model_System_Config_Source_Select {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* get all users
|
15 |
+
* @return array
|
16 |
+
*/
|
17 |
+
public function toOptionArray() {
|
18 |
+
return Mage::helper('deleteorder')->getAllUsers();
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
app/code/community/DD/Deleteorder/controllers/Adminhtml/DeleteorderController.php
ADDED
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Deleteorder_Adminhtml_DeleteorderController extends Mage_Adminhtml_Controller_Action {
|
11 |
+
|
12 |
+
protected function _initAction() {
|
13 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder")->_addBreadcrumb(Mage::helper("adminhtml")->__("Delete Order Manager"), Mage::helper("adminhtml")->__("Delete Order Manager"));
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function indexAction() {
|
18 |
+
$this->_title($this->__("Delete Orders"));
|
19 |
+
$this->_initAction();
|
20 |
+
$this->renderLayout();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* to view deleted order information
|
25 |
+
*/
|
26 |
+
public function viewInfoAction() {
|
27 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder");
|
28 |
+
$this->_addContent($this->getLayout()->createBlock('deleteorder/adminhtml_viewinfo'))
|
29 |
+
->_addLeft($this->getLayout()->createBlock('deleteorder/adminhtml_viewinfo_edit_tabs'));
|
30 |
+
$this->renderLayout();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* to get manual delete form view.
|
35 |
+
*/
|
36 |
+
public function manualDeleteViewAction() {
|
37 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder");
|
38 |
+
$this->_addContent($this->getLayout()->createBlock('deleteorder/adminhtml_manualdelete'))
|
39 |
+
->_addLeft($this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_edit_tabs'));
|
40 |
+
$this->renderLayout();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* to delete orders by date and Increment Id
|
45 |
+
*/
|
46 |
+
public function manualDeleteAction() {
|
47 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
48 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
49 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
50 |
+
$collection = array();
|
51 |
+
if ($defaultAdmin == '' || $currentUser == $defaultAdmin || in_array($currentUser, $allowedUsers) && Mage::helper('deleteorder')->isEnabled()) {
|
52 |
+
try {
|
53 |
+
$data = $this->getRequest()->getPost();
|
54 |
+
Mage::getSingleton('core/session')->setKey($data['delete_by']);
|
55 |
+
$ids = array();
|
56 |
+
if (array_key_exists('from_date', $data) && array_key_exists('to_date', $data) && $data['from_date'] != '' && $data['to_date'] != '') {
|
57 |
+
$fromDate = date('Y-m-d', strtotime($data['from_date']));
|
58 |
+
$toDate = date('Y-m-d', strtotime("+1 day", strtotime($data['to_date'])));
|
59 |
+
$collection = Mage::getModel('sales/order')->getCollection()
|
60 |
+
->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate));
|
61 |
+
if (empty($collection->getData())) {
|
62 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Records not found between " . date('Y-m-d', strtotime($data['from_date'])) . " to " . date('Y-m-d', strtotime($data['to_date']))));
|
63 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
64 |
+
} else {
|
65 |
+
foreach ($collection->getData() as $key => $value) {
|
66 |
+
$ids[] = $value['entity_id'];
|
67 |
+
}
|
68 |
+
$this->massRemoveAction($ids);
|
69 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
70 |
+
}
|
71 |
+
} else {
|
72 |
+
if ($this->orderValidate($data)) {
|
73 |
+
$collection = Mage::getModel('sales/order')->getCollection();
|
74 |
+
$collection->addAttributeToSelect('entity_id')
|
75 |
+
->addAttributeToFilter('increment_id', array(
|
76 |
+
'from' => $data['starting_id'],
|
77 |
+
'to' => $data['ending_id']
|
78 |
+
));
|
79 |
+
foreach ($collection->getData() as $key => $value) {
|
80 |
+
$ids[] = $value['entity_id'];
|
81 |
+
}
|
82 |
+
$this->massRemoveAction($ids);
|
83 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
84 |
+
}
|
85 |
+
}
|
86 |
+
} catch (Exception $e) {
|
87 |
+
Mage::getSingleton("adminhtml/session")->addError("Oops...!!! Something went wrong. Please try again");
|
88 |
+
Mage::log($e->getMessage());
|
89 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* check if order exist or not.
|
96 |
+
* @param array $data
|
97 |
+
* @return boolean
|
98 |
+
*/
|
99 |
+
public function orderValidate($data) {
|
100 |
+
$collection1 = Mage::getModel('sales/order')->getCollection()
|
101 |
+
->addAttributeToFilter('increment_id', $data['starting_id'])
|
102 |
+
->getData();
|
103 |
+
$collection2 = Mage::getModel('sales/order')->getCollection()
|
104 |
+
->addAttributeToFilter('increment_id', $data['ending_id'])
|
105 |
+
->getData();
|
106 |
+
|
107 |
+
if (empty($collection1)) {
|
108 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Starting Increment ID Doesn\'t exist. Please enter valid Order Increment ID'));
|
109 |
+
$this->_redirectReferer();
|
110 |
+
return false;
|
111 |
+
} elseif (empty($collection2)) {
|
112 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Ending Increment ID Doesn\'t exist. Please enter valid Order Increment ID'));
|
113 |
+
$this->_redirectReferer();
|
114 |
+
return false;
|
115 |
+
} elseif (!empty($collection1) && !empty($collection2)) {
|
116 |
+
if ($data['starting_id'] > $data['ending_id']) {
|
117 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Starting Order Increment ID is greater than Ending Order Increment ID'));
|
118 |
+
$this->_redirectReferer();
|
119 |
+
return false;
|
120 |
+
} else {
|
121 |
+
return true;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* to delete existing order
|
128 |
+
*/
|
129 |
+
public function deleteOrderAction() {
|
130 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
131 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
132 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
133 |
+
|
134 |
+
if ($defaultAdmin == '' || $currentUser == $defaultAdmin || in_array($currentUser, $allowedUsers) && Mage::helper('deleteorder')->isEnabled()) {
|
135 |
+
$orderId = $this->getRequest()->getParam("order_id");
|
136 |
+
if ($orderId > 0) {
|
137 |
+
try {
|
138 |
+
$model = Mage::getModel('sales/order');
|
139 |
+
$model1 = Mage::getModel('sales/order')->load($orderId);
|
140 |
+
if (!empty($model1->getData())) {
|
141 |
+
if (Mage::helper('deleteorder')->isHistoryEnabled()) {
|
142 |
+
Mage::getModel('deleteorder/deleteorder')->insertOrderData($orderId);
|
143 |
+
Mage::getModel('deleteorder/deleteorderitem')->insertOrderItemData($orderId);
|
144 |
+
Mage::getModel('deleteorder/deleteorderaddress')->insertOrderAddressData($orderId);
|
145 |
+
}
|
146 |
+
$model->setId($orderId)->delete();
|
147 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order was successfully deleted"));
|
148 |
+
$this->_redirect("adminhtml/sales_order/index");
|
149 |
+
} else {
|
150 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("This order no longer exists."));
|
151 |
+
$this->_redirect("adminhtml/sales_order/index");
|
152 |
+
}
|
153 |
+
} catch (Exception $e) {
|
154 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
155 |
+
Mage::log($e->getMessage());
|
156 |
+
$this->_redirect("adminhtml/sales_order/index");
|
157 |
+
}
|
158 |
+
}
|
159 |
+
$this->_redirect("adminhtml/sales_order/index");
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* to delete multiple orders
|
165 |
+
* @param array $_ids
|
166 |
+
*/
|
167 |
+
public function massRemoveAction($_ids = null) {
|
168 |
+
$currentUser = Mage::helper('deleteorder')->getCurrentUser();
|
169 |
+
$defaultAdmin = Mage::helper('deleteorder')->getDefaultAdmin();
|
170 |
+
$allowedUsers = Mage::helper('deleteorder')->getAllowedUsers();
|
171 |
+
|
172 |
+
if ($defaultAdmin == '' || $currentUser == $defaultAdmin || in_array($currentUser, $allowedUsers) && Mage::helper('deleteorder')->isEnabled()) {
|
173 |
+
$ids = '';
|
174 |
+
try {
|
175 |
+
if ($_ids != null) {
|
176 |
+
$ids = $_ids;
|
177 |
+
} else {
|
178 |
+
$ids = $this->getRequest()->getPost('order_ids', array());
|
179 |
+
}
|
180 |
+
foreach ($ids as $id) {
|
181 |
+
$model = Mage::getModel('sales/order');
|
182 |
+
if (Mage::helper('deleteorder')->isHistoryEnabled()) {
|
183 |
+
Mage::getModel('deleteorder/deleteorder')->insertOrderData($id);
|
184 |
+
Mage::getModel('deleteorder/deleteorderitem')->insertOrderItemData($id);
|
185 |
+
Mage::getModel('deleteorder/deleteorderaddress')->insertOrderAddressData($id);
|
186 |
+
}
|
187 |
+
$model->setId($id)->delete();
|
188 |
+
}
|
189 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order(s) was successfully removed"));
|
190 |
+
} catch (Exception $e) {
|
191 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
192 |
+
Mage::log($e->getMessage());
|
193 |
+
if ($_ids != null) {
|
194 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
195 |
+
} else {
|
196 |
+
$this->_redirect('adminhtml/sales_order/index');
|
197 |
+
}
|
198 |
+
}
|
199 |
+
$this->_redirect('adminhtml/sales_order/index');
|
200 |
+
}
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* delete multiple orders from delete order history
|
205 |
+
*/
|
206 |
+
public function massRemovePermanentAction() {
|
207 |
+
try {
|
208 |
+
$ids = $this->getRequest()->getPost('ids', array());
|
209 |
+
foreach ($ids as $id) {
|
210 |
+
$model = Mage::getModel('deleteorder/deleteorder');
|
211 |
+
$data = $model->getOrderInfo($id);
|
212 |
+
$model->setId($id)->delete();
|
213 |
+
Mage::getModel('deleteorder/deleteorderitem')->deleteOrderItem($data['entity_id']);
|
214 |
+
Mage::getModel('deleteorder/deleteorderaddress')->deleteOrderAddress($data['entity_id']);
|
215 |
+
}
|
216 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order(s) was successfully removed from the Order's History"));
|
217 |
+
} catch (Exception $e) {
|
218 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
219 |
+
Mage::log($e->getMessage());
|
220 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
221 |
+
}
|
222 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* delete single order from delete order history
|
227 |
+
*/
|
228 |
+
public function singleRemovePermanentAction() {
|
229 |
+
$id = $this->getRequest()->getParam("id");
|
230 |
+
if ($id > 0) {
|
231 |
+
try {
|
232 |
+
$model = Mage::getModel('deleteorder/deleteorder');
|
233 |
+
$data = $model->getOrderInfo($id);
|
234 |
+
if (!empty($data)) {
|
235 |
+
$model->setId($id)->delete();
|
236 |
+
Mage::getModel('deleteorder/deleteorderitem')->deleteOrderItem($data['entity_id']);
|
237 |
+
Mage::getModel('deleteorder/deleteorderaddress')->deleteOrderAddress($data['entity_id']);
|
238 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order was successfully deleted from the Order's History"));
|
239 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/index");
|
240 |
+
}
|
241 |
+
} catch (Exception $e) {
|
242 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
243 |
+
Mage::log($e->getMessage());
|
244 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
245 |
+
}
|
246 |
+
}
|
247 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Export order history grid to CSV format
|
252 |
+
*/
|
253 |
+
public function exportCsvAction() {
|
254 |
+
$fileName = 'deleted_orders.csv';
|
255 |
+
$grid = $this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_grid');
|
256 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Export order history grid to Excel XML format
|
261 |
+
*/
|
262 |
+
public function exportExcelAction() {
|
263 |
+
$fileName = 'deleted_orders.xml';
|
264 |
+
$grid = $this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_grid');
|
265 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
266 |
+
}
|
267 |
+
|
268 |
+
}
|
app/code/community/DD/Deleteorder/controllers/Adminhtml/DeleteorderController.php~
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class DD_Deleteorder_Adminhtml_DeleteorderController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
protected function _initAction() {
|
6 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder")->_addBreadcrumb(Mage::helper("adminhtml")->__("Delete Order Manager"), Mage::helper("adminhtml")->__("Delete Order Manager"));
|
7 |
+
return $this;
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Display grid for generated tickets
|
12 |
+
*/
|
13 |
+
public function indexAction() {
|
14 |
+
$this->_title($this->__("Delete Orders"));
|
15 |
+
$this->_initAction();
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function viewInfoAction() {
|
20 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder");
|
21 |
+
$this->_addContent($this->getLayout()->createBlock('deleteorder/adminhtml_viewinfo'))
|
22 |
+
->_addLeft($this->getLayout()->createBlock('deleteorder/adminhtml_viewinfo_edit_tabs'));
|
23 |
+
$this->renderLayout();
|
24 |
+
}
|
25 |
+
|
26 |
+
public function manualDeleteViewAction() {
|
27 |
+
$this->loadLayout()->_setActiveMenu("deleteorder/deleteorder");
|
28 |
+
$this->_addContent($this->getLayout()->createBlock('deleteorder/adminhtml_manualdelete'))
|
29 |
+
->_addLeft($this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_edit_tabs'));
|
30 |
+
$this->renderLayout();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function manualDeleteAction() {
|
34 |
+
try {
|
35 |
+
$data = $this->getRequest()->getPost();
|
36 |
+
Mage::getSingleton('core/session')->setKey($data['delete_by']);
|
37 |
+
$ids = array();
|
38 |
+
if (array_key_exists('from_date', $data) && array_key_exists('to_date', $data) && $data['from_date'] != '' && $data['to_date'] != '') {
|
39 |
+
$fromDate = date('Y-m-d', strtotime($data['from_date']));
|
40 |
+
$toDate = date('Y-m-d', strtotime("+1 day",strtotime($data['to_date'])));
|
41 |
+
Zend_Debug::dump($fromDate);
|
42 |
+
Zend_Debug::dump($toDate);exit;
|
43 |
+
$collection = Mage::getModel('sales/order')->getCollection()
|
44 |
+
->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate));
|
45 |
+
if (empty($collection->getData())) {
|
46 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("There are no records found between " . date('Y-m-d', strtotime($data['from_date'])) . " to " . date('Y-m-d', strtotime($data['to_date']))));
|
47 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
48 |
+
} else {
|
49 |
+
foreach ($collection->getData() as $key => $value) {
|
50 |
+
$ids[] = $value['entity_id'];
|
51 |
+
}
|
52 |
+
$this->massRemoveAction($ids);
|
53 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
54 |
+
}
|
55 |
+
} else {
|
56 |
+
if ($this->orderValidate($data)) {
|
57 |
+
$collection = Mage::getModel('sales/order')->getCollection();
|
58 |
+
$collection->addAttributeToSelect('entity_id')
|
59 |
+
->addAttributeToFilter('increment_id', array(
|
60 |
+
'from' => $data['starting_id'],
|
61 |
+
'to' => $data['ending_id']
|
62 |
+
));
|
63 |
+
foreach ($collection->getData() as $key => $value) {
|
64 |
+
$ids[] = $value['entity_id'];
|
65 |
+
}
|
66 |
+
$this->massRemoveAction($ids);
|
67 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
68 |
+
}
|
69 |
+
}
|
70 |
+
} catch (Exception $e) {
|
71 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__($e->getMessage() . "Oops...!!! Something went wrong. Please try again"));
|
72 |
+
Mage::log($e->getMessage());
|
73 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/manualDeleteView");
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
public function orderValidate($data) {
|
78 |
+
$collection1 = Mage::getModel('sales/order')->getCollection()
|
79 |
+
->addAttributeToFilter('increment_id', $data['starting_id'])
|
80 |
+
->getData();
|
81 |
+
$collection2 = Mage::getModel('sales/order')->getCollection()
|
82 |
+
->addAttributeToFilter('increment_id', $data['ending_id'])
|
83 |
+
->getData();
|
84 |
+
|
85 |
+
if (empty($collection1)) {
|
86 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Starting Increment ID Doesn\'t exist. Please enter valid Order Increment ID'));
|
87 |
+
$this->_redirectReferer();
|
88 |
+
return false;
|
89 |
+
} elseif (empty($collection2)) {
|
90 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Ending Increment ID Doesn\'t exist. Please enter valid Order Increment ID'));
|
91 |
+
$this->_redirectReferer();
|
92 |
+
return false;
|
93 |
+
} elseif (!empty($collection1) && !empty($collection2)) {
|
94 |
+
if ($data['starting_id'] > $data['ending_id']) {
|
95 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('deleteorder')->__('Starting Order Increment ID is greater than Ending Order Increment ID'));
|
96 |
+
$this->_redirectReferer();
|
97 |
+
return false;
|
98 |
+
} else {
|
99 |
+
return true;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
public function deleteOrderAction() {
|
105 |
+
$orderId = $this->getRequest()->getParam("order_id");
|
106 |
+
if ($orderId > 0) {
|
107 |
+
try {
|
108 |
+
$model = Mage::getModel('sales/order');
|
109 |
+
Mage::getModel('deleteorder/deleteorder')->insertOrderData($orderId);
|
110 |
+
Mage::getModel('deleteorder/deleteorderitem')->insertOrderItemData($orderId);
|
111 |
+
Mage::getModel('deleteorder/deleteorderaddress')->insertOrderAddressData($orderId);
|
112 |
+
$model->setId($this->getRequest()->getParam("order_id"))->delete();
|
113 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order was successfully deleted"));
|
114 |
+
$this->_redirect("adminhtml/sales_order/index");
|
115 |
+
} catch (Exception $e) {
|
116 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
117 |
+
Mage::log($e->getMessage());
|
118 |
+
$this->_redirect("adminhtml/sales_order/index");
|
119 |
+
}
|
120 |
+
}
|
121 |
+
$this->_redirect("adminhtml/sales_order/index");
|
122 |
+
}
|
123 |
+
|
124 |
+
public function massRemoveAction($_ids = null) {
|
125 |
+
$ids = '';
|
126 |
+
try {
|
127 |
+
if ($_ids != null) {
|
128 |
+
$ids = $_ids;
|
129 |
+
} else {
|
130 |
+
$ids = $this->getRequest()->getPost('order_ids', array());
|
131 |
+
}
|
132 |
+
foreach ($ids as $id) {
|
133 |
+
$model = Mage::getModel('sales/order');
|
134 |
+
Mage::getModel('deleteorder/deleteorder')->insertOrderData($id);
|
135 |
+
Mage::getModel('deleteorder/deleteorderitem')->insertOrderItemData($id);
|
136 |
+
Mage::getModel('deleteorder/deleteorderaddress')->insertOrderAddressData($id);
|
137 |
+
$model->setId($id)->delete();
|
138 |
+
}
|
139 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order(s) was successfully removed"));
|
140 |
+
} catch (Exception $e) {
|
141 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
142 |
+
Mage::log($e->getMessage());
|
143 |
+
if ($_ids != null) {
|
144 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
145 |
+
} else {
|
146 |
+
$this->_redirect('adminhtml/sales_order/index');
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$this->_redirect('adminhtml/sales_order/index');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function massRemovePermanentAction() {
|
153 |
+
try {
|
154 |
+
$ids = $this->getRequest()->getPost('ids', array());
|
155 |
+
foreach ($ids as $id) {
|
156 |
+
$model = Mage::getModel('deleteorder/deleteorder');
|
157 |
+
$data = $model->getOrderInfo($id);
|
158 |
+
$model->setId($id)->delete();
|
159 |
+
Mage::getModel('deleteorder/deleteorderitem')->deleteOrderItem($data['entity_id']);
|
160 |
+
Mage::getModel('deleteorder/deleteorderaddress')->deleteOrderAddress($data['entity_id']);
|
161 |
+
}
|
162 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order(s) was successfully removed from the Order's History"));
|
163 |
+
} catch (Exception $e) {
|
164 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
165 |
+
Mage::log($e->getMessage());
|
166 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
167 |
+
}
|
168 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
169 |
+
}
|
170 |
+
|
171 |
+
public function singleRemovePermanentAction() {
|
172 |
+
$id = $this->getRequest()->getParam("id");
|
173 |
+
if ($id > 0) {
|
174 |
+
try {
|
175 |
+
$model = Mage::getModel('deleteorder/deleteorder');
|
176 |
+
$data = $model->getOrderInfo($id);
|
177 |
+
$model->setId($id)->delete();
|
178 |
+
Mage::getModel('deleteorder/deleteorderitem')->deleteOrderItem($data['entity_id']);
|
179 |
+
Mage::getModel('deleteorder/deleteorderaddress')->deleteOrderAddress($data['entity_id']);
|
180 |
+
Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Order was successfully deleted from the Order's History"));
|
181 |
+
$this->_redirect("admin_deleteorder/adminhtml_deleteorder/index");
|
182 |
+
} catch (Exception $e) {
|
183 |
+
Mage::getSingleton("adminhtml/session")->addError(Mage::helper("adminhtml")->__("Oops...!!! Something went wrong. Please try again"));
|
184 |
+
Mage::log($e->getMessage());
|
185 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
186 |
+
}
|
187 |
+
}
|
188 |
+
$this->_redirect('admin_deleteorder/adminhtml_deleteorder/index');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Export order grid to CSV format
|
193 |
+
*/
|
194 |
+
public function exportCsvAction() {
|
195 |
+
$fileName = 'deleted_orders.csv';
|
196 |
+
$grid = $this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_grid');
|
197 |
+
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Export order grid to Excel XML format
|
202 |
+
*/
|
203 |
+
public function exportExcelAction() {
|
204 |
+
$fileName = 'deleted_orders.xml';
|
205 |
+
$grid = $this->getLayout()->createBlock('deleteorder/adminhtml_deleteorder_grid');
|
206 |
+
$this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
|
207 |
+
}
|
208 |
+
|
209 |
+
}
|
app/code/community/DD/Deleteorder/etc/adminhtml.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Deleteorder
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<acl>
|
11 |
+
<resources>
|
12 |
+
<admin>
|
13 |
+
<children>
|
14 |
+
<system>
|
15 |
+
<children>
|
16 |
+
<config>
|
17 |
+
<children>
|
18 |
+
<deleteordersettings translate="title" module="deleteorder">
|
19 |
+
<title>DeleteOrder Settings Section</title>
|
20 |
+
<sort_order>0</sort_order>
|
21 |
+
</deleteordersettings>
|
22 |
+
</children>
|
23 |
+
</config>
|
24 |
+
</children>
|
25 |
+
</system>
|
26 |
+
</children>
|
27 |
+
</admin>
|
28 |
+
</resources>
|
29 |
+
</acl>
|
30 |
+
</config>
|
app/code/community/DD/Deleteorder/etc/config.xml
ADDED
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Deleteorder
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<DD_Deleteorder>
|
12 |
+
<version>0.1.0</version>
|
13 |
+
</DD_Deleteorder>
|
14 |
+
</modules>
|
15 |
+
<default>
|
16 |
+
<deleteordersettings>
|
17 |
+
<general>
|
18 |
+
<enable>0</enable>
|
19 |
+
<enablegriddelete>1</enablegriddelete>
|
20 |
+
<orderdeletehistory>1</orderdeletehistory>
|
21 |
+
<enableorderviewdelete>0</enableorderviewdelete>
|
22 |
+
<showrolefields>0</showrolefields>
|
23 |
+
</general>
|
24 |
+
</deleteordersettings>
|
25 |
+
</default>
|
26 |
+
<global>
|
27 |
+
<helpers>
|
28 |
+
<deleteorder>
|
29 |
+
<class>DD_Deleteorder_Helper</class>
|
30 |
+
</deleteorder>
|
31 |
+
</helpers>
|
32 |
+
<blocks>
|
33 |
+
<deleteorder>
|
34 |
+
<class>DD_Deleteorder_Block</class>
|
35 |
+
</deleteorder>
|
36 |
+
<adminhtml>
|
37 |
+
<rewrite>
|
38 |
+
<sales_order_grid>DD_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
39 |
+
</rewrite>
|
40 |
+
</adminhtml>
|
41 |
+
<adminhtml>
|
42 |
+
<rewrite>
|
43 |
+
<sales_order_view>DD_Deleteorder_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
44 |
+
</rewrite>
|
45 |
+
</adminhtml>
|
46 |
+
</blocks>
|
47 |
+
<models>
|
48 |
+
<deleteorder>
|
49 |
+
<class>DD_Deleteorder_Model</class>
|
50 |
+
<resourceModel>deleteorder_mysql4</resourceModel>
|
51 |
+
</deleteorder>
|
52 |
+
<deleteorder_mysql4>
|
53 |
+
<class>DD_Deleteorder_Model_Mysql4</class>
|
54 |
+
<entities>
|
55 |
+
<deleteorder>
|
56 |
+
<table>delete_sales_flat_order</table>
|
57 |
+
</deleteorder>
|
58 |
+
<deleteorderitem>
|
59 |
+
<table>delete_sales_flat_order_item</table>
|
60 |
+
</deleteorderitem>
|
61 |
+
<deleteorderaddress>
|
62 |
+
<table>delete_sales_flat_order_address</table>
|
63 |
+
</deleteorderaddress>
|
64 |
+
</entities>
|
65 |
+
</deleteorder_mysql4>
|
66 |
+
</models>
|
67 |
+
<events>
|
68 |
+
<adminhtml_block_html_before>
|
69 |
+
<observers>
|
70 |
+
<deleteorder_init_system_observer>
|
71 |
+
<class>deleteorder/observer</class>
|
72 |
+
<method>makeMenu</method>
|
73 |
+
</deleteorder_init_system_observer>
|
74 |
+
</observers>
|
75 |
+
</adminhtml_block_html_before>
|
76 |
+
|
77 |
+
<adminhtml_init_system_config>
|
78 |
+
<observers>
|
79 |
+
<deleteorder_init_system_config>
|
80 |
+
<class>deleteorder/observer</class>
|
81 |
+
<method>makeSystemConfig</method>
|
82 |
+
</deleteorder_init_system_config>
|
83 |
+
</observers>
|
84 |
+
</adminhtml_init_system_config>
|
85 |
+
|
86 |
+
<admin_system_config_changed_section_deleteordersettings>
|
87 |
+
<observers>
|
88 |
+
<deleteorder>
|
89 |
+
<type>singleton</type>
|
90 |
+
<class>deleteorder/observer</class>
|
91 |
+
<method>send</method>
|
92 |
+
</deleteorder>
|
93 |
+
</observers>
|
94 |
+
</admin_system_config_changed_section_deleteordersettings>
|
95 |
+
</events>
|
96 |
+
<resources>
|
97 |
+
<deleteorder_setup>
|
98 |
+
<setup>
|
99 |
+
<module>DD_Deleteorder</module>
|
100 |
+
</setup>
|
101 |
+
<connection>
|
102 |
+
<use>core_setup</use>
|
103 |
+
</connection>
|
104 |
+
</deleteorder_setup>
|
105 |
+
<deleteorder_write>
|
106 |
+
<connection>
|
107 |
+
<use>core_write</use>
|
108 |
+
</connection>
|
109 |
+
</deleteorder_write>
|
110 |
+
<deleteorder_read>
|
111 |
+
<connection>
|
112 |
+
<use>core_read</use>
|
113 |
+
</connection>
|
114 |
+
</deleteorder_read>
|
115 |
+
</resources>
|
116 |
+
</global>
|
117 |
+
<admin>
|
118 |
+
<routers>
|
119 |
+
<deleteorder>
|
120 |
+
<use>admin</use>
|
121 |
+
<args>
|
122 |
+
<module>DD_Deleteorder</module>
|
123 |
+
<frontName>admin_deleteorder</frontName>
|
124 |
+
</args>
|
125 |
+
</deleteorder>
|
126 |
+
</routers>
|
127 |
+
</admin>
|
128 |
+
<adminhtml>
|
129 |
+
<menu>
|
130 |
+
<!-- for menu look in observer -->
|
131 |
+
</menu>
|
132 |
+
<acl>
|
133 |
+
<resources>
|
134 |
+
<all>
|
135 |
+
<title>Allow Everything</title>
|
136 |
+
</all>
|
137 |
+
<admin>
|
138 |
+
<children>
|
139 |
+
<deleteorder translate="title" module="deleteorder">
|
140 |
+
<title>Deleteorder</title>
|
141 |
+
<sort_order>1000</sort_order>
|
142 |
+
<children>
|
143 |
+
<deleteorder module="deleteorder">
|
144 |
+
<title>Delete Orders</title>
|
145 |
+
<sort_order>0</sort_order>
|
146 |
+
<children>
|
147 |
+
<deletefromordergrid module="deleteorder">
|
148 |
+
<title>Delete From Order Grid</title>
|
149 |
+
<sort_order>0</sort_order>
|
150 |
+
</deletefromordergrid>
|
151 |
+
<manualdelete module="deleteorder">
|
152 |
+
<title>Manual Delete</title>
|
153 |
+
<sort_order>1</sort_order>
|
154 |
+
</manualdelete>
|
155 |
+
</children>
|
156 |
+
</deleteorder>
|
157 |
+
<deletehistory translate="title">
|
158 |
+
<title>Delete Orders History</title>
|
159 |
+
<sort_order>1</sort_order>
|
160 |
+
</deletehistory>
|
161 |
+
</children>
|
162 |
+
</deleteorder>
|
163 |
+
</children>
|
164 |
+
</admin>
|
165 |
+
</resources>
|
166 |
+
</acl>
|
167 |
+
<layout>
|
168 |
+
<updates>
|
169 |
+
<deleteorder>
|
170 |
+
<file>deleteorder.xml</file>
|
171 |
+
</deleteorder>
|
172 |
+
</updates>
|
173 |
+
</layout>
|
174 |
+
</adminhtml>
|
175 |
+
</config>
|
app/code/community/DD/Deleteorder/etc/system.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Deleteorder
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<tabs>
|
11 |
+
<dd_deleteorder translate="label" module="deleteorder">
|
12 |
+
<label>DD_DeleteOrder</label>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</dd_deleteorder>
|
15 |
+
</tabs>
|
16 |
+
<sections>
|
17 |
+
<deleteordersettings translate="label" module="deleteorder">
|
18 |
+
<label>Delete Order Settings</label>
|
19 |
+
<tab>dd_deleteorder</tab>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<groups>
|
26 |
+
<general translate="label">
|
27 |
+
<label>General Settings</label>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>0</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<fields>
|
34 |
+
<!-- for fields look in observer -->
|
35 |
+
</fields>
|
36 |
+
</general>
|
37 |
+
</groups>
|
38 |
+
</deleteordersettings>
|
39 |
+
</sections>
|
40 |
+
</config>
|
app/code/community/DD/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Deleteorder
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
$installer = $this;
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->run("
|
13 |
+
|
14 |
+
DROP TABLE IF EXISTS {$this->getTable('delete_sales_flat_order')};
|
15 |
+
CREATE TABLE {$this->getTable('delete_sales_flat_order')}
|
16 |
+
AS (SELECT * FROM sales_flat_order WHERE 1=2);
|
17 |
+
ALTER TABLE delete_sales_flat_order CHANGE COLUMN entity_id id INT(10) NOT NULL AUTO_INCREMENT primary key;
|
18 |
+
ALTER TABLE delete_sales_flat_order ADD
|
19 |
+
(
|
20 |
+
entity_id int(10) unsigned,
|
21 |
+
payment_type varchar(100),
|
22 |
+
shipping_name varchar(100),
|
23 |
+
billing_name varchar(100),
|
24 |
+
order_delete_date DATETIME
|
25 |
+
);
|
26 |
+
|
27 |
+
DROP TABLE IF EXISTS {$this->getTable('delete_sales_flat_order_item')};
|
28 |
+
CREATE TABLE {$this->getTable('delete_sales_flat_order_item')}
|
29 |
+
AS (SELECT * FROM sales_flat_order_item WHERE 1=2);
|
30 |
+
ALTER TABLE delete_sales_flat_order_item CHANGE COLUMN item_id id INT(10) NOT NULL AUTO_INCREMENT primary key;
|
31 |
+
ALTER TABLE delete_sales_flat_order_item ADD
|
32 |
+
(
|
33 |
+
item_id int(10) unsigned
|
34 |
+
);
|
35 |
+
|
36 |
+
DROP TABLE IF EXISTS {$this->getTable('deleteorder_counter')};
|
37 |
+
CREATE TABLE {$this->getTable('deleteorder_counter')}(
|
38 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
39 |
+
`count` varchar(255) NOT NULL default '',
|
40 |
+
PRIMARY KEY (`id`)
|
41 |
+
);
|
42 |
+
|
43 |
+
INSERT INTO {$this->getTable('deleteorder_counter')}(count) values ('1');
|
44 |
+
|
45 |
+
DROP TABLE IF EXISTS {$this->getTable('delete_sales_flat_order_address')};
|
46 |
+
CREATE TABLE {$this->getTable('delete_sales_flat_order_address')}
|
47 |
+
AS (SELECT * FROM sales_flat_order_address WHERE 1=2);
|
48 |
+
ALTER TABLE delete_sales_flat_order_address CHANGE COLUMN entity_id id INT(10) NOT NULL AUTO_INCREMENT primary key;
|
49 |
+
ALTER TABLE delete_sales_flat_order_address ADD
|
50 |
+
(
|
51 |
+
entity_id int(10) unsigned
|
52 |
+
),
|
53 |
+
ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
54 |
+
");
|
55 |
+
$installer->endSetup();
|
56 |
+
|
57 |
+
|
app/design/adminhtml/default/default/layout/deleteorder.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Deleteorder
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<deleteorder_adminhtml_deleteorder_index>
|
11 |
+
<reference name="content">
|
12 |
+
<block type="deleteorder/adminhtml_deleteorder" name="deleteorder" />
|
13 |
+
</reference>
|
14 |
+
</deleteorder_adminhtml_deleteorder_index>
|
15 |
+
</layout>
|
app/design/adminhtml/default/default/template/deleteorder/viewinfo.phtml
ADDED
@@ -0,0 +1,416 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category design
|
5 |
+
* @package default_default
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
<?php
|
11 |
+
$id = $this->getRequest()->getParam('o_id');
|
12 |
+
$data = Mage::getModel('deleteorder/deleteorder')->getOrderInfo($id);
|
13 |
+
if($data){
|
14 |
+
try{
|
15 |
+
$itemData = Mage::getModel('deleteorder/deleteorderitem')->getOrderItem($data['entity_id']);
|
16 |
+
$shippingData = Mage::getModel('deleteorder/deleteorderaddress')->getOrderShippingData($data['entity_id']);
|
17 |
+
$billingData = Mage::getModel('deleteorder/deleteorderaddress')->getOrderBillingData($data['entity_id']);
|
18 |
+
$countryShipping = Mage::getModel('directory/country')->loadByCode($shippingData['country_id']);
|
19 |
+
$countryBilling = Mage::getModel('directory/country')->loadByCode($billingData['country_id']);
|
20 |
+
$orderAdminDate = $this->formatDate($data['created_at'], 'medium', true);
|
21 |
+
$showIp=Mage::getStoreConfig('sales/general/hide_customer_ip');
|
22 |
+
$currencySymbol = Mage::app()->getLocale()->currency($data['order_currency_code'])->getSymbol();
|
23 |
+
?>
|
24 |
+
|
25 |
+
<div class="box-left">
|
26 |
+
<!--Order Information-->
|
27 |
+
<div class="entry-edit">
|
28 |
+
<?php
|
29 |
+
if ($data['email_sent']):
|
30 |
+
$_email = Mage::helper('sales')->__('the order confirmation email was sent');
|
31 |
+
else:
|
32 |
+
$_email = Mage::helper('sales')->__('the order confirmation email is not sent');
|
33 |
+
endif;
|
34 |
+
?>
|
35 |
+
<div class="entry-edit-head">
|
36 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $data['increment_id']) ?> (<?php echo $_email ?>)</h4>
|
37 |
+
</div>
|
38 |
+
<div class="fieldset">
|
39 |
+
<table cellspacing="0" class="form-list">
|
40 |
+
<tr>
|
41 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Date'); ?></label></td>
|
42 |
+
<td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
|
43 |
+
</tr>
|
44 |
+
<tr>
|
45 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
|
46 |
+
<td class="value"><strong><span id="order_status"><?php echo $data['status'] ?></span></strong></td>
|
47 |
+
</tr>
|
48 |
+
<tr>
|
49 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
|
50 |
+
<td class="value"><strong><?php echo nl2br($data['store_name']);?></strong></td>
|
51 |
+
</tr>
|
52 |
+
|
53 |
+
<?php if (!$showIp && $data['remote_ip']): ?>
|
54 |
+
<tr>
|
55 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
|
56 |
+
<td class="value"><strong><?php echo $data['remote_ip']; ?>
|
57 |
+
</tr>
|
58 |
+
<?php endif;
|
59 |
+
?>
|
60 |
+
<tr>
|
61 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Order Deleted Date'); ?></label></td>
|
62 |
+
<td class="value"><strong><?php echo $this->formatDate($data['order_delete_date'], 'medium', true); ?></strong></td>
|
63 |
+
</tr>
|
64 |
+
</table>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
|
69 |
+
<div class="box-right">
|
70 |
+
<!--Account Information-->
|
71 |
+
<div class="entry-edit">
|
72 |
+
<div class="entry-edit-head">
|
73 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
|
74 |
+
<div class="tools"><?php ?></div>
|
75 |
+
</div>
|
76 |
+
<div class="fieldset">
|
77 |
+
<div class="hor-scroll">
|
78 |
+
<table cellspacing="0" class="form-list">
|
79 |
+
<tr>
|
80 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
|
81 |
+
<td class="value">
|
82 |
+
<strong><?php echo $this->escapeHtml($data['customer_firstname'] . ' ' . $data['customer_lastname']); ?></strong>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
|
87 |
+
<td class="value"><strong class="emph"><?php echo $data['customer_email']; ?></strong></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<?php $_groupName = $data['customer_group_id']; ?>
|
91 |
+
<?php $customerGroup= Mage::getModel('customer/group')->load((int) $_groupName)->getCode(); ?>
|
92 |
+
<?php if($customerGroup == ''): ?>
|
93 |
+
<?php elseif($customerGroup != ''): ?>
|
94 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
|
95 |
+
<td class="value"><strong><?php echo $customerGroup; ?></strong></td>
|
96 |
+
<?php else: ?>
|
97 |
+
<td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
|
98 |
+
<td class="value"><strong><?php echo $this->__('NOT LOGGED IN'); ?></strong></td>
|
99 |
+
<?php endif; ?>
|
100 |
+
</tr>
|
101 |
+
</table>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
<div class="clear"></div>
|
107 |
+
|
108 |
+
<div class="box-left">
|
109 |
+
<!--Billing Address-->
|
110 |
+
<div class="entry-edit">
|
111 |
+
<div class="entry-edit-head">
|
112 |
+
<h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
|
113 |
+
<div class="tools"><?php ?></div>
|
114 |
+
</div>
|
115 |
+
<fieldset>
|
116 |
+
<address>
|
117 |
+
<?php
|
118 |
+
echo $billingData['firstname'] . ' ';
|
119 |
+
if ($billingData['middlename'] != '') {
|
120 |
+
echo $billingData['middlename'] . ' ';
|
121 |
+
}
|
122 |
+
echo $billingData['lastname'] . '<br/>';
|
123 |
+
if ($billingData['company'] != '') {
|
124 |
+
echo $billingData['company'] . '<br/>';
|
125 |
+
}
|
126 |
+
echo $billingData['street'] . '<br/>';
|
127 |
+
echo $billingData['city'] . ' ';
|
128 |
+
echo $billingData['region'] . ' ';
|
129 |
+
echo $billingData['postcode'] . '<br/>';
|
130 |
+
echo $countryBilling->getName() . '<br/>';
|
131 |
+
echo 'T: ' . $billingData['telephone'] . '<br/>';
|
132 |
+
if ($billingData['fax'] != '') {
|
133 |
+
echo 'F: ' . $billingData['fax'];
|
134 |
+
}
|
135 |
+
?>
|
136 |
+
</address>
|
137 |
+
</fieldset>
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
|
141 |
+
<?php if (!$data['is_virtual']): ?>
|
142 |
+
<div class="box-right">
|
143 |
+
<!--Shipping Address-->
|
144 |
+
<div class="entry-edit">
|
145 |
+
<div class="entry-edit-head">
|
146 |
+
<h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
|
147 |
+
<div class="tools"><?php ?></div>
|
148 |
+
</div>
|
149 |
+
<fieldset>
|
150 |
+
<address>
|
151 |
+
<?php
|
152 |
+
echo $shippingData['firstname'] . ' ';
|
153 |
+
if ($shippingData['middlename'] != '') {
|
154 |
+
echo $shippingData['middlename'] . ' ';
|
155 |
+
}
|
156 |
+
echo $shippingData['lastname'] . '<br/>';
|
157 |
+
if ($billingData['company'] != '') {
|
158 |
+
echo $billingData['company'] . '<br/>';
|
159 |
+
}
|
160 |
+
echo $shippingData['street'] . '<br/>';
|
161 |
+
echo $shippingData['city'] . ' ';
|
162 |
+
echo $shippingData['region'] . ' ';
|
163 |
+
echo $shippingData['postcode'] . '<br/>';
|
164 |
+
echo $countryShipping->getName() . '<br/>';
|
165 |
+
echo 'T: ' . $shippingData['telephone'] . '<br/>';
|
166 |
+
if ($shippingData['fax'] != '') {
|
167 |
+
echo 'F: ' . $shippingData['fax'];
|
168 |
+
}
|
169 |
+
?>
|
170 |
+
</address>
|
171 |
+
</fieldset>
|
172 |
+
</div>
|
173 |
+
</div>
|
174 |
+
<div class="clear"></div>
|
175 |
+
<?php endif; ?>
|
176 |
+
|
177 |
+
<div class="box-left">
|
178 |
+
<!--Payment Method-->
|
179 |
+
<div class="entry-edit">
|
180 |
+
<div class="entry-edit-head">
|
181 |
+
<h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
|
182 |
+
</div>
|
183 |
+
<fieldset>
|
184 |
+
<?php echo $data['payment_type'] ?>
|
185 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $data['order_currency_code']); ?></div>
|
186 |
+
</fieldset>
|
187 |
+
</div>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<?php if (!$data['is_virtual']): ?>
|
191 |
+
<div class="box-right">
|
192 |
+
<!--Shipping Method-->
|
193 |
+
<div class="entry-edit">
|
194 |
+
<div class="entry-edit-head">
|
195 |
+
<h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping & Handling Information') ?></h4>
|
196 |
+
</div>
|
197 |
+
<fieldset>
|
198 |
+
<?php if ($data['shipping_description']): ?>
|
199 |
+
<strong><?php echo $this->escapeHtml($data['shipping_description']); ?></strong>
|
200 |
+
<?php if ($data['shipping_amount']): ?>
|
201 |
+
<?php echo $currencySymbol . number_format($data['shipping_amount'], 2); ?>
|
202 |
+
<?php endif; ?>
|
203 |
+
<?php else: ?>
|
204 |
+
<?php echo $this->helper('sales')->__('No shipping information available'); ?>
|
205 |
+
<?php endif; ?>
|
206 |
+
</fieldset>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
+
<?php endif; ?>
|
210 |
+
<div class="clear"></div>
|
211 |
+
|
212 |
+
<div class="entry-edit">
|
213 |
+
<div class="entry-edit-head">
|
214 |
+
<h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
|
215 |
+
</div>
|
216 |
+
</div>
|
217 |
+
<div class="grid np">
|
218 |
+
<div class="hor-scroll">
|
219 |
+
<table cellspacing="0" class="data order-tables">
|
220 |
+
<col />
|
221 |
+
<col width="1" />
|
222 |
+
<col width="1" />
|
223 |
+
<col width="1" />
|
224 |
+
<col width="1" />
|
225 |
+
<col width="1" />
|
226 |
+
<col width="1" />
|
227 |
+
<col width="1" />
|
228 |
+
<col width="1" />
|
229 |
+
<col width="1" />
|
230 |
+
<thead>
|
231 |
+
<tr class="headings">
|
232 |
+
<th><?php echo $this->helper('sales')->__('Product') ?></th>
|
233 |
+
<!--<th><span class="nobr"><?php // echo $this->helper('sales')->__('Item Status') ?></span></th>-->
|
234 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Original Price') ?></span></th>
|
235 |
+
<th><?php echo $this->helper('sales')->__('Price') ?></th>
|
236 |
+
<th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
|
237 |
+
<th><?php echo $this->helper('sales')->__('Subtotal') ?></th>
|
238 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Amount') ?></span></th>
|
239 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Tax Percent') ?></span></th>
|
240 |
+
<th><span class="nobr"><?php echo $this->helper('sales')->__('Discount Amount') ?></span></th>
|
241 |
+
<th class="last"><span class="nobr"><?php echo $this->helper('sales')->__('Row Total') ?></span></th>
|
242 |
+
</tr>
|
243 |
+
</thead>
|
244 |
+
<?php $i=0;foreach ($itemData as $_item):?>
|
245 |
+
<?php if ($_item['parent_item_id']) continue; else $i++;?>
|
246 |
+
<tbody class="<?php echo $i%2?'even':'odd' ?>">
|
247 |
+
<tr>
|
248 |
+
<td>
|
249 |
+
<div><strong><?php echo $_item['name'];?></strong></div>
|
250 |
+
<div><strong><?php echo $this->__('SKU: ')?></strong><?php echo $_item['sku'];?></div>
|
251 |
+
|
252 |
+
<?php if($_item['product_type']=='simple' || $_item['product_type']=='downloadable'|| $_item['product_type']=='virtual' || $_item['product_type']=='configurable'):?>
|
253 |
+
<?php $customOptions=Mage::helper('deleteorder')->getOptions($_item['product_options']);?>
|
254 |
+
<?php if(array_key_exists('options',$customOptions)): ?>
|
255 |
+
<div>
|
256 |
+
<dl class="item-options">
|
257 |
+
<?php foreach ($customOptions['options'] as $val):?>
|
258 |
+
<dt><strong><?php echo $val['label']?></strong></dt>
|
259 |
+
<dd><?php echo $val['value'];?></dd>
|
260 |
+
<?php endforeach;?>
|
261 |
+
</dl>
|
262 |
+
</div>
|
263 |
+
<?php endif;?>
|
264 |
+
<?php endif;?>
|
265 |
+
|
266 |
+
<?php if($_item['product_type']=='configurable'):?>
|
267 |
+
<?php $configurableOptions=Mage::helper('deleteorder')->getOptions($_item['product_options'])?>
|
268 |
+
<?php if(array_key_exists('attributes_info',$configurableOptions)): ?>
|
269 |
+
<div>
|
270 |
+
<dl class="item-options">
|
271 |
+
<?php foreach ($configurableOptions['attributes_info'] as $val):?>
|
272 |
+
<dt><strong><?php echo $val['label']?></strong></dt>
|
273 |
+
<dd><?php echo $val['value'];?></dd>
|
274 |
+
<?php endforeach;?>
|
275 |
+
</dl>
|
276 |
+
</div>
|
277 |
+
<?php endif;?>
|
278 |
+
<?php endif;?>
|
279 |
+
|
280 |
+
<?php if($_item['product_type']=='bundle'):?>
|
281 |
+
<?php $bundleOptions=Mage::helper('deleteorder')->getOptions($_item['product_options'])?>
|
282 |
+
<?php if(array_key_exists('bundle_options',$bundleOptions)): ?>
|
283 |
+
<div>
|
284 |
+
<dl class="item-options">
|
285 |
+
<?php foreach ($bundleOptions['bundle_options'] as $val):?>
|
286 |
+
<dt><strong><?php echo $val['label']?></strong></dt>
|
287 |
+
<dd>
|
288 |
+
<?php echo $val['value'][0]['title'].'<br/>';?>
|
289 |
+
<?php echo '<strong>'.$this->__('Price: ').$currencySymbol. number_format($val['value'][0]['price'], 2).'</strong><br/>';?>
|
290 |
+
<?php echo '<strong>'.$this->__('Qty: ').(int)$val['value'][0]['qty'].'</strong>';?>
|
291 |
+
</dd>
|
292 |
+
<?php endforeach;?>
|
293 |
+
</dl>
|
294 |
+
</div>
|
295 |
+
<?php endif;?>
|
296 |
+
<?php endif;?>
|
297 |
+
|
298 |
+
</td>
|
299 |
+
<td><?php echo $currencySymbol . number_format($_item['original_price'], 2);?></td>
|
300 |
+
<td><strong><?php echo $currencySymbol . number_format($_item['price'], 2);?></strong></td>
|
301 |
+
<td>
|
302 |
+
<table class="qty-table" cellspacing="0">
|
303 |
+
<?php if($_item['qty_ordered']!=0): ?>
|
304 |
+
<tr><td><?php echo $this->__('Ordered ')?></td><td><strong><?php echo (int)$_item['qty_ordered'];?></strong></td></tr>
|
305 |
+
<?php endif;?>
|
306 |
+
<?php if($_item['qty_invoiced']!=0): ?>
|
307 |
+
<tr><td><?php echo $this->__('Invoiced ')?></td><td><strong><?php echo (int)$_item['qty_invoiced'];?></strong></td></tr>
|
308 |
+
<?php endif;?>
|
309 |
+
<?php if($_item['qty_shipped']!=0): ?>
|
310 |
+
<tr><td><?php echo $this->__('Shipped ')?></td><td><strong><?php echo (int)$_item['qty_shipped'];?></strong></td></tr>
|
311 |
+
<?php endif;?>
|
312 |
+
</table>
|
313 |
+
</td>
|
314 |
+
<td><strong><?php echo $currencySymbol . number_format($_item['row_total'], 2);?></strong></td>
|
315 |
+
<td><?php echo $currencySymbol . number_format($_item['tax_amount'], 2);?></td>
|
316 |
+
<td><?php echo number_format($_item['tax_percent'],2).'%';?></td>
|
317 |
+
<td><?php echo $currencySymbol . number_format($_item['discount_amount'],2);?></td>
|
318 |
+
<td><?php echo $currencySymbol . number_format((($_item['row_total']+$_item['tax_amount'])-$_item['discount_amount']), 2);?></td>
|
319 |
+
</tr>
|
320 |
+
</tbody>
|
321 |
+
<?php endforeach;?>
|
322 |
+
</table>
|
323 |
+
</div>
|
324 |
+
</div>
|
325 |
+
|
326 |
+
<div class="clear"></div>
|
327 |
+
<div class="box entry-edit">
|
328 |
+
<div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
|
329 |
+
<div class="order-totals">
|
330 |
+
<table cellspacing="0" width="100%">
|
331 |
+
<col />
|
332 |
+
<col width="1" />
|
333 |
+
<tfoot>
|
334 |
+
<tr class="">
|
335 |
+
<td class="label"><strong><?php echo $this->__('Grand Total'); ?></strong></td>
|
336 |
+
<td class="emph">
|
337 |
+
<strong>
|
338 |
+
<?php echo $currencySymbol . number_format($data['grand_total'],2); ?>
|
339 |
+
</strong>
|
340 |
+
</td>
|
341 |
+
</tr>
|
342 |
+
<tr class="">
|
343 |
+
<td class="label"><strong><?php echo $this->__('Total Paid'); ?></strong></td>
|
344 |
+
<td class="emph">
|
345 |
+
<strong><?php echo $currencySymbol . number_format($data['total_paid'],2); ?></strong>
|
346 |
+
</td>
|
347 |
+
</tr>
|
348 |
+
<tr class="">
|
349 |
+
<td class="label"><strong><?php echo $this->__('Total Refunded'); ?></strong></td>
|
350 |
+
<td class="emph">
|
351 |
+
<strong><?php echo $currencySymbol . number_format($data['total_refunded'],2); ?></strong>
|
352 |
+
</td>
|
353 |
+
</tr>
|
354 |
+
<tr class="">
|
355 |
+
<td class="label"><strong><?php echo $this->__('Total Due'); ?></strong></td>
|
356 |
+
<td class="emph">
|
357 |
+
<strong>
|
358 |
+
<?php if($data['status']=='pending'):?>
|
359 |
+
<?php echo $currencySymbol . number_format($data['grand_total'],2); ?>
|
360 |
+
<?php else:?>
|
361 |
+
<?php echo $currencySymbol . number_format($data['total_due'],2); ?>
|
362 |
+
<?php endif;?>
|
363 |
+
</strong>
|
364 |
+
</td>
|
365 |
+
</tr>
|
366 |
+
</tfoot>
|
367 |
+
<tbody>
|
368 |
+
<tr class="">
|
369 |
+
<td class="label"><?php echo $this->__('Subtotal'); ?></td>
|
370 |
+
<td>
|
371 |
+
<?php echo $currencySymbol . number_format($data['subtotal'],2); ?>
|
372 |
+
</td>
|
373 |
+
</tr>
|
374 |
+
<tr class="">
|
375 |
+
<td class="label"><?php echo $this->__('Shipping & Handling '); ?></td>
|
376 |
+
<td>
|
377 |
+
<?php if ($data['shipping_amount']): ?>
|
378 |
+
<?php echo $currencySymbol . number_format($data['shipping_amount'], 2); ?>
|
379 |
+
<?php else: ?>
|
380 |
+
<?php echo $this->helper('sales')->__('No shipping information available'); ?>
|
381 |
+
<?php endif; ?>
|
382 |
+
</td>
|
383 |
+
</tr>
|
384 |
+
<?php if($data['discount_amount']!=0):?>
|
385 |
+
<tr class="">
|
386 |
+
<td class="label"><?php echo $this->__('Discount'); ?></td>
|
387 |
+
<td>
|
388 |
+
<?php echo '-'.$currencySymbol . str_replace('-','',number_format($data['discount_amount'], 2)); ?>
|
389 |
+
</td>
|
390 |
+
</tr>
|
391 |
+
<?php endif;?>
|
392 |
+
<tr class="">
|
393 |
+
<td class="label"><?php echo $this->__('Tax'); ?></td>
|
394 |
+
<td>
|
395 |
+
<?php echo $currencySymbol . number_format($data['tax_amount'], 2); ?>
|
396 |
+
</td>
|
397 |
+
</tr>
|
398 |
+
</tbody>
|
399 |
+
</table>
|
400 |
+
</div>
|
401 |
+
</div>
|
402 |
+
<div class="clear"></div>
|
403 |
+
<?php } catch (Exception $ex) {
|
404 |
+
Mage::log($ex->getMessage());
|
405 |
+
?>
|
406 |
+
<script type="text/javascript">
|
407 |
+
alert("Some error occured...!!!");
|
408 |
+
location.href = '<?php echo Mage::getUrl('deleteorder/adminhtml_deleteorder/index');?>';
|
409 |
+
</script>
|
410 |
+
<?php
|
411 |
+
}
|
412 |
+
} else { ?>
|
413 |
+
<script type="text/javascript">
|
414 |
+
location.href = '<?php echo Mage::getUrl('deleteorder/adminhtml_deleteorder/index');?>';
|
415 |
+
</script>
|
416 |
+
<?php } ?>
|
app/etc/modules/DD_Deleteorder.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<DD_Deleteorder>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</DD_Deleteorder>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>DD_Deleteorder</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>By this extension admin can delete the orders and backed up the deleted orders history.</summary>
|
10 |
+
<description>This extension provides facility to delete the orders. Admin can delete multiple as well as single order by just single click and deleted orders will be save in delete order history grid for future reference. If there is multiple admin users then admin can choose default (Main) admin user who will get all the privileges to access all the settings of Delete Order Module. Default admin can give privileges to other admin users also that they can use the Delete Order settings or not. Some of the features of this extension is described below. 
|
11 |
+

|
12 |
+
1) By this extension admin can delete the orders and backed up the deleted orders in delete order history grid.
|
13 |
+

|
14 |
+
2) Admin can choose default(Main) admin user who will get all privileges to delete the orders.
|
15 |
+

|
16 |
+
3) Admin can give privileges to other users also to delete the orders or not.
|
17 |
+

|
18 |
+
4) Admin can delete single as well as multiple orders.
|
19 |
+

|
20 |
+
5) Admin can delete orders from grid and from order view page also by a single click.
|
21 |
+

|
22 |
+
6) By this module admin can delete orders manually by order created date and by Order Increment Ids.
|
23 |
+

|
24 |
+
7) Deleted orders will be saved in delete order history for future reference.
|
25 |
+

|
26 |
+
8) Admin can view the deleted orders details by clicking on any record of deleted order history grid.
|
27 |
+

|
28 |
+
9) Admin can delete backed up orders permanently from delete order history grid or from deleted order view page.
|
29 |
+

|
30 |
+
10) Compatible with all magento versions from 1.7.0.2 to 1.9.x</description>
|
31 |
+
<notes>This is the first release of this extension.</notes>
|
32 |
+
<authors><author><name>Dynamic Dreamz</name><user>dynamicdreamz</user><email>info@dynamicdreamz.com</email></author></authors>
|
33 |
+
<date>2015-11-24</date>
|
34 |
+
<time>10:05:41</time>
|
35 |
+
<contents><target name="magecommunity"><dir name="DD"><dir name="Deleteorder"><dir name="Block"><dir name="Adminhtml"><dir name="Deleteorder"><dir name="Edit"><file name="Form.php" hash="172c1575ab6181f607cc598b9110c22b"/><file name="Tabs.php" hash="f8c7e5f2ba818127688dd55f8118ec4e"/></dir><file name="Grid.php" hash="a1c0e2870aaa0451d62b78002c6f4971"/></dir><file name="Deleteorder.php" hash="ca946719aa7cd643ea6eb598fa33b691"/><file name="Manualdelete.php" hash="a5c2899e36d3e8d5e7c792241e02c3d6"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="1c5f64d1b42d46d6b5b4c477144332e0"/><file name="View.php" hash="b81075972732a8e769f430627eecea06"/></dir></dir><dir name="Viewinfo"><dir name="Edit"><file name="Form.php" hash="3e391b99a38f4b6a20036e048873ec22"/><file name="Tabs.php" hash="345a6036044b596e31bd06e0da16f3c4"/></dir></dir><file name="Viewinfo.php" hash="226bdcdeab45a79eab0a458609651c40"/></dir><dir name="Field"><dir name="Enable"><file name="Renderer.php" hash="be834770b933cac77a50e02e15bd5d11"/></dir><dir name="Enabledeleteorder"><file name="Renderer.php" hash="54e97b853b1ace2f2f76f71bc6b1dc95"/></dir><dir name="Enabledeleteorderview"><file name="Renderer.php" hash="7903412e831a536f7d074e977d28f7b3"/></dir><dir name="Enablesavehistory"><file name="Renderer.php" hash="6f2dabefa464432a2077aa32c1f58497"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteorderController.php" hash="26cd7cae1ce1841aa3e4f5113b3aa936"/><file name="DeleteorderController.php~" hash="953444912c1d0bf832ee3ef197d0a454"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="850db84618b355ca1dae0ae5dc38bf6b"/><file name="config.xml" hash="fada45b0534bd811a5993fa193ee1ec7"/><file name="system.xml" hash="baaacecc17569a3277059294bb4f8040"/></dir><dir name="Helper"><file name="Data.php" hash="f49c8763e7fc31f14f24e07e2f75dc03"/></dir><dir name="Model"><file name="Deleteorderaddress.php" hash="e79424f7b5e201ffdcdb0d7a4b08bf98"/><file name="Deleteorderitem.php" hash="bea214e2c6fff45c932c17460b955acd"/><file name="Deleteorder.php" hash="2e8564786ae90a1524734c7d57064b91"/><dir name="Mysql4"><dir name="Deleteorder"><file name="Collection.php" hash="97c490de45e0c4db6e87ab85c79fcc76"/></dir><dir name="Deleteorderaddress"><file name="Collection.php" hash="07c9fdb97ee160fee482aaab5e5367d2"/></dir><file name="Deleteorderaddress.php" hash="910aff10cdbcef1bcb141b2fa94aa996"/><dir name="Deleteorderitem"><file name="Collection.php" hash="f5c8755072ea703e62c8eb8f441e4cfb"/></dir><file name="Deleteorderitem.php" hash="fc7a249cdc66bb8b64e8d81697bfdfbb"/><file name="Deleteorder.php" hash="dc948c263bff4b5111670eb26ab28fb9"/></dir><file name="Observer.php" hash="2edc5de2c2f57b5215c6ed920f1c624e"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Multiselect.php" hash="ea024c409d44f08528dc9cfdf3ce5c94"/><file name="Select.php" hash="731ab91ee2f5ae39aa53bef29771ff47"/></dir></dir></dir></dir><dir name="sql"><dir name="deleteorder_setup"><file name="mysql4-install-0.1.0.php" hash="8fb53f6e961dc07ef1d08f4c53b73099"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DD_Deleteorder.xml" hash="81ced5fbda4745beece5ae125db2591a"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deleteorder.xml" hash="715c2f33f927dd85fc43cb26591b17f7"/></dir><dir name="template"><dir name="deleteorder"><file name="viewinfo.phtml" hash="e46bfdfb2e352cf94a2469d194e79802"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="Deleteorder_features.docx" hash="611e242fa91867544053da6a7820bb97"/><file name="Deleteorder_manual.docx" hash="5c9c67fc78d9ad3832e886536b3604db"/></dir></target></contents>
|
36 |
+
<compatible/>
|
37 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.2</min><max>1.9</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
|
38 |
+
</package>
|