AdvancedProductGrid - Version 1.0.0

Version Notes

Initial Release

Download this release

Release Info

Developer Cartin24
Extension AdvancedProductGrid
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Cartin24/Productgrid/Block/Adminhtml/Catalog/Product/Grid.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Productgrid
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_Productgrid_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
9
+ {
10
+ protected function _prepareColumns()
11
+ {
12
+ $helper = Mage::helper('productgrid');
13
+ if($helper->isCategoryEnabled() == 1){
14
+
15
+ $this->addColumnAfter('category', array(
16
+ 'header' => Mage::helper('catalog')->__('Category'),
17
+ 'sortable' => false,
18
+ 'width' => '250px',
19
+ 'type' => 'options',
20
+ 'options' => Mage::getSingleton('productgrid/source_category')->toOptionArray(),
21
+ 'renderer' => 'Cartin24_Productgrid_Block_Adminhtml_Catalog_Product_Render_Category',
22
+ 'filter_condition_callback' => array($this, 'filterCallback'),
23
+ ),"type");
24
+ }
25
+ if($helper->isThumbnailEnabled()==1){
26
+
27
+ $this->addColumnAfter('thumbnail', array(
28
+ 'header' => Mage::helper('catalog')->__('Thumbnail'),
29
+ 'align' => 'left',
30
+ 'index' => 'thumbnail',
31
+ 'renderer' => 'Cartin24_Productgrid_Block_Adminhtml_Catalog_Product_Render_Thumbnail',
32
+ 'width' => '107'
33
+ ),"entity_id");
34
+ }
35
+
36
+
37
+ return parent::_prepareColumns();
38
+ }
39
+ public function filterCallback($collection, $column)
40
+ {
41
+ $value = $column->getFilter()->getValue();
42
+ $_category = Mage::getModel('catalog/category')->load($value);
43
+ $collection->addCategoryFilter($_category);
44
+ return $collection;
45
+ }
46
+
47
+ }
48
+ ?>
app/code/community/Cartin24/Productgrid/Block/Adminhtml/Catalog/Product/Render/Category.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Productgrid
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_Productgrid_Block_Adminhtml_Catalog_Product_Render_Category extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ public function render(Varien_Object $row)
11
+ {
12
+ $product = Mage::getModel('catalog/product')->load($row->getEntityId());
13
+ $cats = $product->getCategoryIds();
14
+ $allCats = '';
15
+ foreach($cats as $key => $cat)
16
+ {
17
+ $_category = Mage::getModel('catalog/category')->load($cat);
18
+ $allCats.= $_category->getName();
19
+ if($key < count($cats)-1)
20
+ $allCats.= ',<br />';
21
+ }
22
+ return $allCats;
23
+ }
24
+
25
+ }
app/code/community/Cartin24/Productgrid/Block/Adminhtml/Catalog/Product/Render/Thumbnail.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Productgrid
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_Productgrid_Block_Adminhtml_Catalog_Product_Render_Thumbnail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ public function render(Varien_Object $row)
11
+ {
12
+ $width = 100;
13
+ $product = Mage::getModel('catalog/product')->load($row->getEntityId());
14
+ if($product->getId())
15
+ $image_url = Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage());
16
+ $out = "<img src=". $image_url ." width='". $width ."px' title='". $product->getName() ."'/>";
17
+ return $out;
18
+ }
19
+
20
+ }
app/code/community/Cartin24/Productgrid/Helper/Data.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Productgrid
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_Productgrid_Helper_Data extends Mage_Core_Helper_Abstract {
9
+
10
+ public function isCategoryEnabled(){
11
+ return Mage::getStoreConfig('productgrid/settings/category_column_enabled');
12
+ }
13
+ public function isThumbnailEnabled(){
14
+ return Mage::getStoreConfig('productgrid/settings/thumbnail_column_enabled');
15
+ }
16
+
17
+ }
app/code/community/Cartin24/Productgrid/Model/Source/Category.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartin24
4
+ * @package Cartin24_Productgrid
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_Productgrid_Model_Source_Category extends Mage_Core_Model_Abstract
9
+ {
10
+ public function toOptionArray($addEmpty = true)
11
+ {
12
+ $options = array();
13
+ foreach ($this->getCategory() as $category) {
14
+ $options[$category['value']] = $category['label'];
15
+ }
16
+ return $options;
17
+ }
18
+
19
+ public function getCategory( $root,$values,$level = 0)
20
+ {
21
+ $level++;
22
+ if(! $root){
23
+ $store = Mage::app()->getFrontController()->getRequest()->getParam('store', 0);
24
+ $parentCategoryId = $store ? Mage::app()->getStore($store)->getRootCategoryId() : 1;
25
+ }else
26
+ $parentCategoryId = $root;
27
+ $categories = Mage::getModel('catalog/category')->getCollection()
28
+ ->addFieldToFilter('parent_id', array('eq'=>$parentCategoryId))
29
+ ->addAttributeToSelect('*');
30
+
31
+ foreach($categories as $cats){
32
+
33
+ $values[$cats->getEntityId()]['value'] = $cats->getEntityId();
34
+ $values[$cats->getEntityId()]['label'] = str_repeat("--", $level) . $cats->getName();
35
+
36
+ $values = $this->getCategory($cats->getEntityId(),$values, $level);
37
+ }
38
+ return $values;
39
+ }
40
+
41
+ }
app/code/community/Cartin24/Productgrid/etc/config.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Cartin24
5
+ * @package Cartin24_Productgrid
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_Productgrid>
13
+ <version>1.0.0</version>
14
+ </Cartin24_Productgrid>
15
+ </modules>
16
+ <global>
17
+ <models>
18
+ <productgrid>
19
+ <class>Cartin24_Productgrid_Model</class>
20
+ </productgrid>
21
+ </models>
22
+ <helpers>
23
+ <productgrid>
24
+ <class>Cartin24_Productgrid_Helper</class>
25
+ </productgrid>
26
+ </helpers>
27
+ <blocks>
28
+ <adminhtml>
29
+ <rewrite>
30
+ <catalog_product_grid>Cartin24_Productgrid_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
31
+ </rewrite>
32
+ </adminhtml>
33
+ </blocks>
34
+ </global>
35
+ <adminhtml>
36
+ <acl>
37
+ <resources>
38
+ <admin>
39
+ <children>
40
+ <system>
41
+ <children>
42
+ <config>
43
+ <children>
44
+ <productgrid>
45
+ <title>Advanced Product Grid</title>
46
+ </productgrid>
47
+ </children>
48
+ </config>
49
+ </children>
50
+ </system>
51
+ </children>
52
+ </admin>
53
+ </resources>
54
+ </acl>
55
+ </adminhtml>
56
+ </config>
app/code/community/Cartin24/Productgrid/etc/system.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <cartin24_extensions translate="label" module="productgrid">
5
+ <label>Cartin24 Extensions</label>
6
+ <sort_order>188</sort_order>
7
+ </cartin24_extensions>
8
+ </tabs>
9
+ <sections>
10
+ <productgrid>
11
+ <label>Advanced Product Grid</label>
12
+ <tab>cartin24_extensions</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>1000</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <settings translate="label" module="productgrid">
20
+ <label>Grid Filter Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <category_column_enabled translate="label">
28
+ <label>Category Column Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </category_column_enabled>
36
+ <thumbnail_column_enabled translate="label">
37
+ <label>Thumbnail Column Enabled</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>30</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <comment><![CDATA[Enable if Thumbnail filter required]]></comment>
45
+ </thumbnail_column_enabled>
46
+ </fields>
47
+ </settings>
48
+
49
+ </groups>
50
+ </productgrid>
51
+ </sections>
52
+ </config>
app/etc/modules/Cartin24_Productgrid.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Cartin24_Productgrid>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Cartin24_Productgrid>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>AdvancedProductGrid</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Extension which allow to add Category drop down and Thumbnail image in Admin Product grid</summary>
10
+ <description>Extension which allow to add Category drop down and Thumbnail image in Admin Product grid</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:30:07</time>
15
+ <contents><target name="magecommunity"><dir name="Cartin24"><dir name="Productgrid"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="cffbcffa69ae93c30789bd4c00ec79c6"/><dir name="Render"><file name="Category.php" hash="ad0daa6e0e2e032924b72870e92531b4"/><file name="Thumbnail.php" hash="617d72418c8250621eb6e0846303af9a"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5b06262b5f7fc0a4176b08264853a202"/></dir><dir name="Model"><dir name="Source"><file name="Category.php" hash="8cf9a92cdc84bed5cd8dc744428307bd"/></dir></dir><dir name="etc"><file name="config.xml" hash="a3ba4530cd7685f1eab9eae6f0da1227"/><file name="system.xml" hash="c1e8b1ec64a1d978cf628f90440f7cce"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cartin24_Productgrid.xml" hash="bd201692af42739672618d0a71408924"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>