Version Notes
First Stable Release
Download this release
Release Info
Developer | Zealousweb Technologies Pvt Ltd. |
Extension | Bulk_Product_Category_Modifier |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/community/ZealousWeb/BulkCategoryAssign/Model/Observer.php +46 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/Model/System/Config/Source/Dropdown/Values.php +18 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/Model/System/Config/Source/Multiple/Values.php +18 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/controllers/Adminhtml/AssigncatController.php +15 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/controllers/Adminhtml/Catalog/ProductController.php +95 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/etc/config.xml +71 -0
- app/code/community/ZealousWeb/BulkCategoryAssign/etc/system.xml +49 -0
- app/design/adminhtml/default/default/layout/bulkcategoryassign.xml +14 -0
- app/design/adminhtml/default/default/template/bulkcategoryassign/content.phtml +75 -0
- app/design/adminhtml/default/default/template/bulkcategoryassign/left.phtml +21 -0
- app/etc/modules/ZealousWeb_BulkCategoryAssign.xml +10 -0
- package.xml +18 -0
- skin/adminhtml/default/default/bulkcategoryassign.css +23 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/button-closed.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/button-open.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/button.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/list-item-contents.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/list-item-last.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/list-item-open.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/list-item-root.png +0 -0
- skin/adminhtml/default/default/images/bulkcategoryassign/list-item.png +0 -0
app/code/community/ZealousWeb/BulkCategoryAssign/Model/Observer.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Observer Model
|
4 |
+
*/
|
5 |
+
class ZealousWeb_BulkCategoryAssign_Model_Observer
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* add Massaction Option to Productgrid
|
9 |
+
*
|
10 |
+
* @param $observer Varien_Event
|
11 |
+
*/
|
12 |
+
public function addMassactionToProductGrid($observer)
|
13 |
+
{
|
14 |
+
$block = $observer->getBlock();
|
15 |
+
if($block instanceof Mage_Adminhtml_Block_Catalog_Product_Grid){
|
16 |
+
|
17 |
+
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
18 |
+
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
19 |
+
->load()
|
20 |
+
->toOptionHash();
|
21 |
+
|
22 |
+
if(Mage::getStoreConfig('generaltab/general/dropdown')==1):
|
23 |
+
$module_config = explode(",",Mage::getStoreConfig('generaltab/general/multiple'));
|
24 |
+
/**
|
25 |
+
* add assigncategory Option to Productgrid
|
26 |
+
*/
|
27 |
+
if((in_array(1, $module_config))):
|
28 |
+
$block->getMassactionBlock()->addItem('assigncategory', array(
|
29 |
+
'label'=> Mage::helper('catalog')->__('Assign Categories'),
|
30 |
+
'url' => $block->getUrl('adminhtml/assigncat/index', array('_current'=>true,'act'=>'assign'))
|
31 |
+
));
|
32 |
+
endif;
|
33 |
+
/**
|
34 |
+
* add removecategory Option to Productgrid
|
35 |
+
*/
|
36 |
+
if((in_array(2, $module_config))):
|
37 |
+
$block->getMassactionBlock()->addItem('removecategory', array(
|
38 |
+
'label'=> Mage::helper('catalog')->__('Remove Categories'),
|
39 |
+
'url' => $block->getUrl('adminhtml/assigncat/index', array('_current'=>true,'act'=>'remove'))
|
40 |
+
));
|
41 |
+
endif;
|
42 |
+
endif;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/community/ZealousWeb/BulkCategoryAssign/Model/System/Config/Source/Dropdown/Values.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ZealousWeb_BulkCategoryAssign_Model_System_Config_Source_Dropdown_Values
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => '1',
|
10 |
+
'label' => 'Yes',
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
'value' => '0',
|
14 |
+
'label' => 'No',
|
15 |
+
),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
}
|
app/code/community/ZealousWeb/BulkCategoryAssign/Model/System/Config/Source/Multiple/Values.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class ZealousWeb_BulkCategoryAssign_Model_System_Config_Source_Multiple_Values
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array(
|
9 |
+
'value' => '1',
|
10 |
+
'label' => 'Assign Categories',
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
'value' => '2',
|
14 |
+
'label' => 'Remove Categories',
|
15 |
+
),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
}
|
app/code/community/ZealousWeb/BulkCategoryAssign/controllers/Adminhtml/AssigncatController.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adminhtml controller
|
4 |
+
*
|
5 |
+
* @package ZealousWeb
|
6 |
+
* @author ZealousWeb
|
7 |
+
*/
|
8 |
+
class ZealousWeb_BulkCategoryAssign_Adminhtml_AssigncatController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
public function indexAction()
|
11 |
+
{
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->renderLayout();
|
14 |
+
}
|
15 |
+
}
|
app/code/community/ZealousWeb/BulkCategoryAssign/controllers/Adminhtml/Catalog/ProductController.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* ChangeAttributeSet Controller
|
4 |
+
*
|
5 |
+
* @package ZealousWeb
|
6 |
+
* @author ZealousWeb
|
7 |
+
*/
|
8 |
+
class ZealousWeb_BulkCategoryAssign_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Remove product(s) category action
|
12 |
+
*/
|
13 |
+
public function massRemovecategoryAction()
|
14 |
+
{
|
15 |
+
$productIds = explode(",",$this->getRequest()->getParam('product_ids'));
|
16 |
+
$storeId = (int)$this->getRequest()->getParam('store', 0);
|
17 |
+
$assigncategory = (array)$this->getRequest()->getParam('cat_checkbox');
|
18 |
+
|
19 |
+
if (!is_array($productIds)) {
|
20 |
+
$this->_getSession()->addError($this->__('Please select product(s).'));
|
21 |
+
} else {
|
22 |
+
if (!empty($productIds)) {
|
23 |
+
try {
|
24 |
+
foreach ($productIds as $productId) {
|
25 |
+
$cats = array();
|
26 |
+
$cats = Mage::getModel('catalog/product')->load($productId)->getCategoryIds();
|
27 |
+
$cats = array_diff($cats, $assigncategory);
|
28 |
+
|
29 |
+
# Check for categories exist, if exist then remove it.
|
30 |
+
$product = Mage::getModel('catalog/product')
|
31 |
+
->setStoreId($storeId) //set store id
|
32 |
+
->load($productId)
|
33 |
+
->setCategoryIds(array($cats)) //remove product to categories
|
34 |
+
->save();
|
35 |
+
}
|
36 |
+
$this->_getSession()->addSuccess(
|
37 |
+
$this->__('Total of %d record(s) have been updated.', count($productIds))
|
38 |
+
);
|
39 |
+
}
|
40 |
+
catch (Mage_Core_Model_Exception $e) {
|
41 |
+
$this->_getSession()->addError($e->getMessage());
|
42 |
+
} catch (Mage_Core_Exception $e) {
|
43 |
+
$this->_getSession()->addError($e->getMessage());
|
44 |
+
} catch (Exception $e) {
|
45 |
+
$this->_getSession()
|
46 |
+
->addException($e, $this->__('An error occurred while removing the categories. Please try again.'));
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
$this->_redirect('*/*/index');
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Update product(s) category action
|
55 |
+
*
|
56 |
+
*/
|
57 |
+
public function massAssigncategoryAction()
|
58 |
+
{
|
59 |
+
$productIds = explode(",",$this->getRequest()->getParam('product_ids'));
|
60 |
+
$storeId = (int)$this->getRequest()->getParam('store', 0);
|
61 |
+
$assigncategory = (array)$this->getRequest()->getParam('cat_checkbox');
|
62 |
+
|
63 |
+
try {
|
64 |
+
$product = Mage::getModel('catalog/product');
|
65 |
+
foreach($productIds as $productId):
|
66 |
+
$cats = array();
|
67 |
+
$cats = Mage::getModel('catalog/product')->load($productId)->getCategoryIds();
|
68 |
+
# Don't double categories
|
69 |
+
if($cats[0]==1):
|
70 |
+
$allcats = $assigncategory;
|
71 |
+
else:
|
72 |
+
$allcats = array_merge($cats, $assigncategory);
|
73 |
+
endif;
|
74 |
+
$product = Mage::getModel('catalog/product')
|
75 |
+
->setStoreId($storeId) //set store id
|
76 |
+
->load($productId)
|
77 |
+
->setCategoryIds(array($allcats)) //assign product to categories
|
78 |
+
->save();
|
79 |
+
endforeach;
|
80 |
+
$this->_getSession()->addSuccess(
|
81 |
+
$this->__('Total of %d record(s) have been updated.', count($productIds))
|
82 |
+
);
|
83 |
+
}
|
84 |
+
catch (Mage_Core_Model_Exception $e) {
|
85 |
+
$this->_getSession()->addError($e->getMessage());
|
86 |
+
} catch (Mage_Core_Exception $e) {
|
87 |
+
$this->_getSession()->addError($e->getMessage());
|
88 |
+
} catch (Exception $e) {
|
89 |
+
$this->_getSession()
|
90 |
+
->addException($e, $this->__('An error occurred while assiging the categories. Please try again.'));
|
91 |
+
}
|
92 |
+
|
93 |
+
$this->_redirect('*/*/', array('store'=> $storeId));
|
94 |
+
}
|
95 |
+
}
|
app/code/community/ZealousWeb/BulkCategoryAssign/etc/config.xml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ZealousWeb_BulkCategoryAssign>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</ZealousWeb_BulkCategoryAssign>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<!-- Model Observer -->
|
10 |
+
<models>
|
11 |
+
<zealousweb_bulkcategoryassign>
|
12 |
+
<class>ZealousWeb_BulkCategoryAssign_Model</class>
|
13 |
+
</zealousweb_bulkcategoryassign>
|
14 |
+
</models>
|
15 |
+
</global>
|
16 |
+
<!-- Adminhtml -->
|
17 |
+
<adminhtml>
|
18 |
+
<!-- adminhtml_block_html_before observers -->
|
19 |
+
<events>
|
20 |
+
<adminhtml_block_html_before>
|
21 |
+
<observers>
|
22 |
+
<zealousweb_bulkcategoryassign>
|
23 |
+
<type>singleton</type>
|
24 |
+
<class>zealousweb_bulkcategoryassign/observer</class>
|
25 |
+
<method>addMassactionToProductGrid</method>
|
26 |
+
</zealousweb_bulkcategoryassign>
|
27 |
+
</observers>
|
28 |
+
</adminhtml_block_html_before>
|
29 |
+
</events>
|
30 |
+
<!-- Layout Updates -->
|
31 |
+
<layout>
|
32 |
+
<updates>
|
33 |
+
<zealousweb_bulkcategoryassign>
|
34 |
+
<file>bulkcategoryassign.xml</file>
|
35 |
+
</zealousweb_bulkcategoryassign>
|
36 |
+
</updates>
|
37 |
+
</layout>
|
38 |
+
<!-- System Configuration -->
|
39 |
+
<acl>
|
40 |
+
<resources>
|
41 |
+
<admin>
|
42 |
+
<children>
|
43 |
+
<system>
|
44 |
+
<children>
|
45 |
+
<config>
|
46 |
+
<children>
|
47 |
+
<generaltab>
|
48 |
+
<title>Bulk Product Category Modifier</title>
|
49 |
+
</generaltab>
|
50 |
+
</children>
|
51 |
+
</config>
|
52 |
+
</children>
|
53 |
+
</system>
|
54 |
+
</children>
|
55 |
+
</admin>
|
56 |
+
</resources>
|
57 |
+
</acl>
|
58 |
+
</adminhtml>
|
59 |
+
|
60 |
+
<admin>
|
61 |
+
<routers>
|
62 |
+
<adminhtml>
|
63 |
+
<args>
|
64 |
+
<modules>
|
65 |
+
<ZealousWeb_BulkCategoryAssign after="Mage_Adminhtml">ZealousWeb_BulkCategoryAssign_Adminhtml</ZealousWeb_BulkCategoryAssign>
|
66 |
+
</modules>
|
67 |
+
</args>
|
68 |
+
</adminhtml>
|
69 |
+
</routers>
|
70 |
+
</admin>
|
71 |
+
</config>
|
app/code/community/ZealousWeb/BulkCategoryAssign/etc/system.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<zealousweb translate="label">
|
5 |
+
<label>ZealousWeb</label>
|
6 |
+
<sort_order>150</sort_order>
|
7 |
+
</zealousweb>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<generaltab translate="label" module="adminhtml">
|
11 |
+
<label>Bulk Product Category Modifier</label>
|
12 |
+
<tab>zealousweb</tab>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<general translate="label comment">
|
19 |
+
<label>General</label>
|
20 |
+
<sort_order>50</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<fields>
|
25 |
+
<dropdown translate="label comment">
|
26 |
+
<label>Enabled</label>
|
27 |
+
<frontend_type>select</frontend_type>
|
28 |
+
<source_model>zealousweb_bulkcategoryassign/system_config_source_dropdown_values</source_model>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>0</show_in_website>
|
32 |
+
<show_in_store>0</show_in_store>
|
33 |
+
</dropdown>
|
34 |
+
<multiple translate="label comment">
|
35 |
+
<label>Product Grid Action</label>
|
36 |
+
<comment>Multiselect with global scope.</comment>
|
37 |
+
<frontend_type>multiselect</frontend_type>
|
38 |
+
<source_model>zealousweb_bulkcategoryassign/system_config_source_multiple_values</source_model>
|
39 |
+
<sort_order>20</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>0</show_in_website>
|
42 |
+
<show_in_store>0</show_in_store>
|
43 |
+
</multiple>
|
44 |
+
</fields>
|
45 |
+
</general>
|
46 |
+
</groups>
|
47 |
+
</generaltab>
|
48 |
+
</sections>
|
49 |
+
</config>
|
app/design/adminhtml/default/default/layout/bulkcategoryassign.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<adminhtml_assigncat_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addCss"><name>bulkcategoryassign.css</name></action>
|
6 |
+
</reference>
|
7 |
+
<reference name="left">
|
8 |
+
<block type="adminhtml/template" name="bulkcategoryassign_left" template="bulkcategoryassign/left.phtml" />
|
9 |
+
</reference>
|
10 |
+
<reference name="content">
|
11 |
+
<block type="adminhtml/template" name="bulkcategoryassign_content" template="bulkcategoryassign/content.phtml" />
|
12 |
+
</reference>
|
13 |
+
</adminhtml_assigncat_index>
|
14 |
+
</layout>
|
app/design/adminhtml/default/default/template/bulkcategoryassign/content.phtml
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package ZealousWeb
|
4 |
+
* @author ZealousWeb
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<?php
|
8 |
+
/**
|
9 |
+
* @function Get All Categories
|
10 |
+
*/
|
11 |
+
function get_categories($categories) {
|
12 |
+
$array= '<ul class="collapsibleList">';
|
13 |
+
foreach($categories as $category) {
|
14 |
+
$cat = Mage::getModel('catalog/category')->load($category->getId());
|
15 |
+
$count = $cat->getProductCount();
|
16 |
+
$array .= '<li>'.
|
17 |
+
'<input type="checkbox" class="check-cat" value="'.$cat->getId().'" name="cat_checkbox[]"> ' .
|
18 |
+
$category->getName()."(".$count.")\n";
|
19 |
+
if($category->hasChildren()) {
|
20 |
+
$children = Mage::getModel('catalog/category')->getCategories($category->getId());
|
21 |
+
$array .= get_categories($children);
|
22 |
+
}
|
23 |
+
$array .= '</li>';
|
24 |
+
}
|
25 |
+
return $array . '</ul>';
|
26 |
+
} ?>
|
27 |
+
<button class="scalable back back-custom" type="button" onclick="setLocation('<?php echo $this->getUrl('adminhtml/catalog_product/index'); ?>')">
|
28 |
+
<span>Back</span>
|
29 |
+
</button>
|
30 |
+
<div id="category_tab_content">
|
31 |
+
<div id="category_info_tabs_group_4_content" style="">
|
32 |
+
<div class="entry-edit">
|
33 |
+
<div class="entry-edit-head">
|
34 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Select Categories</h4>
|
35 |
+
<div class="form-buttons"></div>
|
36 |
+
</div>
|
37 |
+
<div id="group_4fieldset_group_4" class="fieldset fieldset-wide">
|
38 |
+
<div class="hor-scroll">
|
39 |
+
<?php
|
40 |
+
$form_action = '';
|
41 |
+
if($this->getRequest()->getParam('act') == 'remove'):
|
42 |
+
$form_action = $this->getUrl('adminhtml/catalog_product/massRemovecategory');
|
43 |
+
else:
|
44 |
+
$form_action = $this->getUrl('adminhtml/catalog_product/massAssigncategory');
|
45 |
+
endif;
|
46 |
+
?>
|
47 |
+
<form id="category_edit_form" name="category_edit_form" method="get" action="<?php echo $form_action;?>">
|
48 |
+
<!-- Category Tree View Start -->
|
49 |
+
<input type="hidden" name="product_ids" value="<?php echo implode(",",$this->getRequest()->getParam('product')); ?>" />
|
50 |
+
<div class="block block-list block-categories">
|
51 |
+
<div class="block-content left-categories-container">
|
52 |
+
<ul class="treeView">
|
53 |
+
<li>
|
54 |
+
<?php $cat = Mage::getModel('catalog/category')->load(2); // Load Default Category ?>
|
55 |
+
<input class="check-cat" type="checkbox" name="cat_checkbox[]" value="<?php echo $cat->getId();?>">
|
56 |
+
<?php echo $cat->getName(); ?>(<?php echo $cat->getProductCount()?>)
|
57 |
+
<?php $categories = $cat->getCategories($cat->getId()); // Load All Category ?>
|
58 |
+
<?php echo get_categories($categories); // Get All Categories ?>
|
59 |
+
</li>
|
60 |
+
</ul>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
<!-- Category Tree View End -->
|
64 |
+
<button id="" class="scalable save" type="button" title="Save Categories" onclick="editForm.submit()">
|
65 |
+
<span>Save Categories</span>
|
66 |
+
</button>
|
67 |
+
</form>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
<script type="text/javascript">
|
74 |
+
var editForm = new varienForm('category_edit_form');
|
75 |
+
</script>
|
app/design/adminhtml/default/default/template/bulkcategoryassign/left.phtml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Zealousweb
|
4 |
+
* @see Zealousweb_BulkCategoryAssign
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
<?php
|
8 |
+
$text = '';
|
9 |
+
if($this->getRequest()->getParam('act') == 'remove'): $text = 'Remove'; else: $text = 'Assign'; endif; ?>
|
10 |
+
<h3><?php echo $text; ?> Products Categories</h3>
|
11 |
+
<ul id="product_info_tabs" class="tabs">
|
12 |
+
<li>
|
13 |
+
<a id="product_info_tabs_group_7" class="tab-item-link active" title="General" href="#">
|
14 |
+
<span>
|
15 |
+
<span class="changed" title="The information in this tab has been changed."></span>
|
16 |
+
<span class="error" title="This tab contains invalid data. Please solve the problem before saving."></span>
|
17 |
+
Categories
|
18 |
+
</span>
|
19 |
+
</a>
|
20 |
+
</li>
|
21 |
+
</ul>
|
app/etc/modules/ZealousWeb_BulkCategoryAssign.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ZealousWeb_BulkCategoryAssign>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends></depends>
|
8 |
+
</ZealousWeb_BulkCategoryAssign>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Bulk_Product_Category_Modifier</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL-3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Modify multiple product categories at a time</summary>
|
10 |
+
<description>This extension allows us to remove or assign multiple categories to multiple products from the Product Grid itself. One do not need to get inside the Product page to assign categories.</description>
|
11 |
+
<notes>First Stable Release</notes>
|
12 |
+
<authors><author><name>ZealousWeb Technologies Pvt Ltd.</name><user>ZealousWeb</user><email>magento@zealousweb.com</email></author></authors>
|
13 |
+
<date>2014-12-08</date>
|
14 |
+
<time>09:34:24</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="ZealousWeb"><dir name="BulkCategoryAssign"><dir name="Model"><file name="Observer.php" hash="5ee37fa872e04e863bbc5132fdee3603"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Values.php" hash="413d4adaf667467b67a3629ba0300e28"/></dir><dir name="Multiple"><file name="Values.php" hash="460cee48b7611a17c8fa8a17fd303d34"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AssigncatController.php" hash="ffb266bfeca66d0b1c936568077bc40a"/><dir name="Catalog"><file name="ProductController.php" hash="a6737d644656bc38aa9bde9683be2d18"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="dcdeb7fd3ae70e95c30db110d5ab9b7c"/><file name="system.xml" hash="1e939142cc09142fce6776e63ccabcb9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZealousWeb_BulkCategoryAssign.xml" hash="b11330129cd6b97eafa105cf41bdd4b5"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bulkcategoryassign.xml" hash="8062c2256b35ef491b9c83f4d83d1529"/></dir><dir name="template"><dir name="bulkcategoryassign"><file name="content.phtml" hash="5656c953332e1b4ddee9e1475e70cb4b"/><file name="left.phtml" hash="6816c129f43e1c7078100198aaa1f9cb"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="bulkcategoryassign.css" hash="c3fb41f4566adbada13bbbf97a7c8ae4"/><dir name="images"><dir name="bulkcategoryassign"><file name="button-closed.png" hash="563b78324e0712c0902cb4f77cb9eb86"/><file name="button-open.png" hash="c710849a0d2b61ad1f0fc36c0e59d131"/><file name="button.png" hash="97f3055c5046c851eea2dad7e5227508"/><file name="list-item-contents.png" hash="00ae24d5bc76df9eedaea597859963e4"/><file name="list-item-last.png" hash="e2bfb790f46855c378e50f3c0a82ea01"/><file name="list-item-open.png" hash="732d1cc59f3a488c89c624eb434eac98"/><file name="list-item-root.png" hash="5529d21e7ec68e9cb750a4895ff0b480"/><file name="list-item.png" hash="e03ec1bf3d9e16bb3005ccf8d26eaa6c"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/bulkcategoryassign.css
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @package Zealousweb
|
3 |
+
* @see Zealousweb_BulkCategoryAssign
|
4 |
+
*/
|
5 |
+
.treeView{ -moz-user-select:none; position:relative; }
|
6 |
+
.treeView .check-cat {margin-top: -0.3em;}
|
7 |
+
.treeView ul{ margin:0 0 0 -1.2em; padding:0 0 0 1.2em; }
|
8 |
+
.treeView ul ul{background: url("images/bulkcategoryassign/list-item-contents.png") repeat-y scroll left center rgba(0, 0, 0, 0); margin-left: -2em; padding-left: 2em; }
|
9 |
+
.treeView li:last-child > ul{ background-image:none; }
|
10 |
+
.treeView li{ margin:0; padding:0; background:url('images/bulkcategoryassign/list-item-root.png') no-repeat top left; list-style-position:inside; list-style-image:url('images/bulkcategoryassign/button.png');
|
11 |
+
cursor:auto; }
|
12 |
+
.treeView li.collapsibleListOpen{ list-style-image:url('images/bulkcategoryassign/button-open.png'); cursor:pointer; }
|
13 |
+
.treeView li.collapsibleListClosed{ list-style-image:url('images/bulkcategoryassign/button-closed.png'); cursor:pointer; }
|
14 |
+
.treeView li li{ background-image:url('images/bulkcategoryassign/list-item.png'); padding-left: 2em; padding-top: 0.41em; margin: 0 !important; }
|
15 |
+
.treeView li .collapsibleList li:last-child{ background-image:url('images/bulkcategoryassign/list-item-last.png'); }
|
16 |
+
.treeView li.collapsibleListOpen{ background-image:url('images/bulkcategoryassign/list-item-open.png'); }
|
17 |
+
.treeView li.collapsibleListOpen:last-child{ background-image:url('images/bulkcategoryassign/list-item-last-open.png'); }
|
18 |
+
.collapsibleList li{ list-style-image:url('images/bulkcategoryassign/button.png'); cursor:auto; }
|
19 |
+
.treeView li .collapsibleListOpen .collapsibleList.collapsibleList > li { margin-left: 0.3em; }
|
20 |
+
li.collapsibleListOpen{ list-style-image:url('images/bulkcategoryassign/button-open.png'); cursor:pointer; }
|
21 |
+
li.collapsibleListClosed{ list-style-image:url('images/bulkcategoryassign/button-closed.png'); cursor:pointer; }
|
22 |
+
.back-custom {clear: both;float: right;margin-bottom: 8px;}
|
23 |
+
#category_tab_content {clear: both;}
|
skin/adminhtml/default/default/images/bulkcategoryassign/button-closed.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/button-open.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/button.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/list-item-contents.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/list-item-last.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/list-item-open.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/list-item-root.png
ADDED
Binary file
|
skin/adminhtml/default/default/images/bulkcategoryassign/list-item.png
ADDED
Binary file
|