Version Notes
First Release
Download this release
Release Info
| Developer | Cueblocks |
| Extension | CueBlocks_BulkRuleDeletion |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/CueBlocks/BulkRuleDeletion/Block/Adminhtml/Promo/Catalog/Grid.php +22 -0
- app/code/community/CueBlocks/BulkRuleDeletion/Block/Adminhtml/Promo/Quote/Grid.php +22 -0
- app/code/community/CueBlocks/BulkRuleDeletion/controllers/Adminhtml/BulkRuleController.php +60 -0
- app/code/community/CueBlocks/BulkRuleDeletion/etc/config.xml +32 -0
- app/etc/modules/CueBlocks_BulkRuleDeletion.xml +12 -0
- package.xml +18 -0
app/code/community/CueBlocks/BulkRuleDeletion/Block/Adminhtml/Promo/Catalog/Grid.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ravinder.
|
| 4 |
+
* Date: 29/3/16
|
| 5 |
+
* Time: 12:54 PM
|
| 6 |
+
*/
|
| 7 |
+
class CueBlocks_BulkRuleDeletion_Block_Adminhtml_Promo_Catalog_Grid extends Mage_Adminhtml_Block_Promo_Catalog_Grid {
|
| 8 |
+
|
| 9 |
+
protected function _prepareMassaction()
|
| 10 |
+
{
|
| 11 |
+
$this->setMassactionIdField('rule_id');
|
| 12 |
+
$this->getMassactionBlock()->setFormFieldName('rule');
|
| 13 |
+
|
| 14 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 15 |
+
'label' => Mage::helper('rule')->__('Delete'),
|
| 16 |
+
'url' => $this->getUrl('*/bulkRule/massCatalogRuleDelete'),
|
| 17 |
+
'confirm' => Mage::helper('rule')->__('Are you sure?')
|
| 18 |
+
));
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
}
|
app/code/community/CueBlocks/BulkRuleDeletion/Block/Adminhtml/Promo/Quote/Grid.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ravinder.
|
| 4 |
+
* Date: 29/3/16
|
| 5 |
+
* Time: 12:05 PM
|
| 6 |
+
*/
|
| 7 |
+
class CueBlocks_BulkRuleDeletion_Block_Adminhtml_Promo_Quote_Grid extends Mage_Adminhtml_Block_Promo_Quote_Grid {
|
| 8 |
+
|
| 9 |
+
protected function _prepareMassaction()
|
| 10 |
+
{
|
| 11 |
+
$this->setMassactionIdField('rule_id');
|
| 12 |
+
$this->getMassactionBlock()->setFormFieldName('rule');
|
| 13 |
+
|
| 14 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 15 |
+
'label' => Mage::helper('rule')->__('Delete'),
|
| 16 |
+
'url' => $this->getUrl('*/bulkRule/massShoppingCartRuleDelete'),
|
| 17 |
+
'confirm' => Mage::helper('rule')->__('Are you sure?')
|
| 18 |
+
));
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
}
|
app/code/community/CueBlocks/BulkRuleDeletion/controllers/Adminhtml/BulkRuleController.php
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by Ravinder.
|
| 4 |
+
* Date: 29/3/16
|
| 5 |
+
* Time: 12:07 PM
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
class CueBlocks_BulkRuleDeletion_Adminhtml_BulkRuleController extends Mage_Adminhtml_Controller_Action
|
| 9 |
+
{
|
| 10 |
+
public function massShoppingCartRuleDeleteAction()
|
| 11 |
+
{
|
| 12 |
+
$rulesIds = $this->getRequest()->getParam('rule');
|
| 13 |
+
if(!is_array($rulesIds)) {
|
| 14 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select rule(s).'));
|
| 15 |
+
} else {
|
| 16 |
+
try {
|
| 17 |
+
$model = Mage::getModel('salesrule/rule');
|
| 18 |
+
foreach ($rulesIds as $rulesId) {
|
| 19 |
+
$model->load($rulesId);
|
| 20 |
+
$model->delete();
|
| 21 |
+
}
|
| 22 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 23 |
+
Mage::helper('adminhtml')->__(
|
| 24 |
+
'Total of %d record(s) were deleted.', count($rulesIds)
|
| 25 |
+
)
|
| 26 |
+
);
|
| 27 |
+
} catch (Exception $e) {
|
| 28 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
$this->_redirect('*/promo_quote/index');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function massCatalogRuleDeleteAction()
|
| 36 |
+
{
|
| 37 |
+
$rulesIds = $this->getRequest()->getParam('rule');
|
| 38 |
+
if(!is_array($rulesIds)) {
|
| 39 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select rule(s).'));
|
| 40 |
+
} else {
|
| 41 |
+
try {
|
| 42 |
+
$model = Mage::getModel('catalogrule/rule');
|
| 43 |
+
foreach ($rulesIds as $rulesId) {
|
| 44 |
+
$model->load($rulesId);
|
| 45 |
+
$model->delete();
|
| 46 |
+
Mage::app()->saveCache(1, 'catalog_rules_dirty');
|
| 47 |
+
}
|
| 48 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 49 |
+
Mage::helper('adminhtml')->__(
|
| 50 |
+
'Total of %d record(s) were deleted.', count($rulesIds)
|
| 51 |
+
)
|
| 52 |
+
);
|
| 53 |
+
} catch (Exception $e) {
|
| 54 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
$this->_redirect('*/promo_catalog/index');
|
| 59 |
+
}
|
| 60 |
+
}
|
app/code/community/CueBlocks/BulkRuleDeletion/etc/config.xml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<CueBlocks_BulkRuleDeletion>
|
| 5 |
+
<version>1.0.0</version>
|
| 6 |
+
</CueBlocks_BulkRuleDeletion>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<bulkruledeletion>
|
| 11 |
+
<class>CueBlocks_BulkRuleDeletion_Block</class>
|
| 12 |
+
</bulkruledeletion>
|
| 13 |
+
<adminhtml>
|
| 14 |
+
<rewrite>
|
| 15 |
+
<promo_quote_grid>CueBlocks_BulkRuleDeletion_Block_Adminhtml_Promo_Quote_Grid</promo_quote_grid>
|
| 16 |
+
<promo_catalog_grid>CueBlocks_BulkRuleDeletion_Block_Adminhtml_Promo_Catalog_Grid</promo_catalog_grid>
|
| 17 |
+
</rewrite>
|
| 18 |
+
</adminhtml>
|
| 19 |
+
</blocks>
|
| 20 |
+
</global>
|
| 21 |
+
<admin>
|
| 22 |
+
<routers>
|
| 23 |
+
<adminhtml>
|
| 24 |
+
<args>
|
| 25 |
+
<modules>
|
| 26 |
+
<bulkruledeletion before="Mage_Adminhtml">CueBlocks_BulkRuleDeletion_Adminhtml</bulkruledeletion>
|
| 27 |
+
</modules>
|
| 28 |
+
</args>
|
| 29 |
+
</adminhtml>
|
| 30 |
+
</routers>
|
| 31 |
+
</admin>
|
| 32 |
+
</config>
|
app/etc/modules/CueBlocks_BulkRuleDeletion.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<CueBlocks_BulkRuleDeletion>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Adminhtml/>
|
| 9 |
+
</depends>
|
| 10 |
+
</CueBlocks_BulkRuleDeletion>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>CueBlocks_BulkRuleDeletion</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Extension add feature to delete promotion rules in bulk.</summary>
|
| 10 |
+
<description>Extension add feature to delete promotion rules in bulk.</description>
|
| 11 |
+
<notes>First Release</notes>
|
| 12 |
+
<authors><author><name>CueBlocks</name><user>Ravinder</user><email>ravinder.singh@cueblocks.com</email></author></authors>
|
| 13 |
+
<date>2016-03-29</date>
|
| 14 |
+
<time>09:49:50</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="CueBlocks"><dir name="BulkRuleDeletion"><dir name="Block"><dir name="Adminhtml"><dir name="Promo"><dir name="Catalog"><file name="Grid.php" hash="bb081f70367764cc835d70041dea80e8"/></dir><dir name="Quote"><file name="Grid.php" hash="9a5539224a36aca461bbbaa264635286"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BulkRuleController.php" hash="0d18a1f3079ece522bdf4603bc4d33c0"/></dir></dir><dir name="etc"><file name="config.xml" hash="d71f6299c0d8455d292cb1af01ff66a4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CueBlocks_BulkRuleDeletion.xml" hash="3ae7a0feff7b5eca79e46dd13ba392c7"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.0.2</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
