CategoryProductGrid - Version 1.0.0

Version Notes

Initial release

Download this release

Release Info

Developer Cartin24
Extension CategoryProductGrid
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Cartin24/Categorygrid/Block/Adminhtml/Catalog/Category/Tab/Product.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Categorygrid
5
+ * @copyright Copyright (c) 2015-2016 Cartin24. (http://www.cartin24.com)
6
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
7
+ */
8
+ class Cartin24_Categorygrid_Block_Adminhtml_Catalog_Category_Tab_Product extends Mage_Adminhtml_Block_Catalog_Category_Tab_Product
9
+ {
10
+ protected function _prepareCollection()
11
+ {
12
+ if ($this->getCategory()->getId()) {
13
+ $this->setDefaultFilter(array('in_category'=>1));
14
+ }
15
+ $collection = Mage::getModel('catalog/product')->getCollection()
16
+ ->addAttributeToSelect('name')
17
+ ->addAttributeToSelect('sku')
18
+ ->addAttributeToSelect('price')
19
+ ->addStoreFilter($this->getRequest()->getParam('store'))
20
+ ->joinField('position',
21
+ 'catalog/category_product',
22
+ 'position',
23
+ 'product_id=entity_id',
24
+ 'category_id='.(int) $this->getRequest()->getParam('id', 0),
25
+ 'left');
26
+ $collection->joinField('qty',
27
+ 'cataloginventory/stock_item',
28
+ 'qty',
29
+ 'product_id=entity_id',
30
+ '{{table}}.stock_id=1',
31
+ 'left');
32
+ $this->setCollection($collection);
33
+
34
+ if ($this->getCategory()->getProductsReadonly()) {
35
+ $productIds = $this->_getSelectedProducts();
36
+ if (empty($productIds)) {
37
+ $productIds = 0;
38
+ }
39
+ $this->getCollection()->addFieldToFilter('entity_id', array('in'=>$productIds));
40
+ }
41
+
42
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
43
+ ;
44
+ }
45
+
46
+ protected function _prepareColumns()
47
+ {
48
+
49
+ $this->addColumnAfter('type',
50
+ array(
51
+ 'header'=> Mage::helper('catalog')->__('Type'),
52
+ 'width' => '60px',
53
+ 'index' => 'type_id',
54
+ 'type' => 'options',
55
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
56
+ ),'name');
57
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
58
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
59
+ ->load()
60
+ ->toOptionHash();
61
+
62
+ $this->addColumnAfter('set_name',
63
+ array(
64
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
65
+ 'width' => '100px',
66
+ 'index' => 'attribute_set_id',
67
+ 'type' => 'options',
68
+ 'options' => $sets,
69
+ ),'type');
70
+ $this->addColumnAfter('qty',
71
+ array(
72
+ 'header'=> Mage::helper('catalog')->__('Qty'),
73
+ 'index' => 'qty',
74
+ 'type' => 'number',
75
+ ),'price');
76
+
77
+ $this->addColumnAfter('action',
78
+ array(
79
+ 'header' => Mage::helper('catalog')->__('Action'),
80
+ 'width' => '50px',
81
+ 'type' => 'action',
82
+ 'getter' => 'getId',
83
+ 'actions' => array(
84
+ array(
85
+ 'caption' => Mage::helper('catalog')->__('Edit'),
86
+ 'url' => array(
87
+ 'base'=>'*/catalog_product/edit',
88
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
89
+ ),
90
+ 'field' => 'id'
91
+ )
92
+ ),
93
+ 'filter' => false,
94
+ 'sortable' => false,
95
+ 'index' => 'stores',
96
+ ),"position");
97
+
98
+ return parent::_prepareColumns();
99
+ }
100
+ }
101
+
app/code/community/Cartin24/Categorygrid/etc/config.xml ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Cartin24
5
+ * @package Cartin24_Categorygrid
6
+ * @copyright Copyright (c) 2015-2016 Cartin24. (http://www.cartin24.com)
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Cartin24_Categorygrid>
13
+ <version>1.0.0</version>
14
+ </Cartin24_Categorygrid>
15
+ </modules>
16
+ <global>
17
+
18
+ <blocks>
19
+ <categorygrid>
20
+ <class>Cartin24_Categorygrid_Block</class>
21
+ </categorygrid>
22
+ <adminhtml>
23
+ <rewrite>
24
+ <catalog_category_tab_product>Cartin24_Categorygrid_Block_Adminhtml_Catalog_Category_Tab_Product</catalog_category_tab_product>
25
+ </rewrite>
26
+ </adminhtml>
27
+ </blocks>
28
+ </global>
29
+ <adminhtml>
30
+ <acl>
31
+ <resources>
32
+ <admin>
33
+ <children>
34
+ <system>
35
+ <children>
36
+ <config>
37
+ <children>
38
+ <categorygrid>
39
+ <title>Advanced Category Grid</title>
40
+ </categorygrid>
41
+ </children>
42
+ </config>
43
+ </children>
44
+ </system>
45
+ </children>
46
+ </admin>
47
+ </resources>
48
+ </acl>
49
+ </adminhtml>
50
+ </config>
app/etc/modules/Cartin24_Categorygrid.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Cartin24_Categorygrid>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Adminhtml />
9
+ </depends>
10
+ </Cartin24_Categorygrid>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>CategoryProductGrid</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Add more column filter options to the Category Products grid when setting up a category.</summary>
10
+ <description>Add more column filter options to the Category Products grid when setting up a category.</description>
11
+ <notes>Initial release</notes>
12
+ <authors><author><name>Cartin24</name><user>Cartin24</user><email>developer@cartin24.com</email></author></authors>
13
+ <date>2015-07-15</date>
14
+ <time>11:07:42</time>
15
+ <contents><target name="magecommunity"><dir name="Cartin24"><dir name="Categorygrid"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Category"><dir name="Tab"><file name="Product.php" hash="5f685b870a2febeac8467fbb28b697f0"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="89c47d52e1f1b052282135b59615d0d5"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cartin24_Categorygrid.xml" hash="ce2da75d4970674ecc6273a23a5d1984"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>