Version Notes
first stable release
Download this release
Release Info
Developer | Doc |
Extension | HK982TZ |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- app/code/community/Dotcom/ProductGridThumbnail/Block/Adminhtml/Catalog/Product/Grid.php +98 -0
- app/code/community/Dotcom/ProductGridThumbnail/Block/Adminhtml/Catalog/Product/Grid/Renderer/Thumbnail.php +24 -0
- app/code/community/Dotcom/ProductGridThumbnail/Helper/Data.php +10 -0
- app/code/community/Dotcom/ProductGridThumbnail/etc/adminhtml.xml +25 -0
- app/code/community/Dotcom/ProductGridThumbnail/etc/config.xml +34 -0
- app/code/community/Dotcom/ProductGridThumbnail/etc/system.xml +41 -0
- app/etc/modules/Dotcom_ProductGridThumbnail.xml +9 -0
- media/catalog/product/default/default.jpg +0 -0
- package.xml +18 -0
app/code/community/Dotcom/ProductGridThumbnail/Block/Adminhtml/Catalog/Product/Grid.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dotcom S.r.l.
|
4 |
+
* User: Diego Zerjal
|
5 |
+
* Date: 17/12/2015
|
6 |
+
* Time: 12:18
|
7 |
+
*/
|
8 |
+
class Dotcom_ProductGridThumbnail_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
|
9 |
+
{
|
10 |
+
protected function _prepareCollection()
|
11 |
+
{
|
12 |
+
$store = $this->_getStore();
|
13 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
14 |
+
->addAttributeToSelect('sku')
|
15 |
+
->addAttributeToSelect('name')
|
16 |
+
->addAttributeToSelect('attribute_set_id')
|
17 |
+
->addAttributeToSelect('type_id')
|
18 |
+
->addAttributeToSelect('thumbnail');
|
19 |
+
|
20 |
+
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
21 |
+
$collection->joinField('qty',
|
22 |
+
'cataloginventory/stock_item',
|
23 |
+
'qty',
|
24 |
+
'product_id=entity_id',
|
25 |
+
'{{table}}.stock_id=1',
|
26 |
+
'left');
|
27 |
+
}
|
28 |
+
if ($store->getId()) {
|
29 |
+
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
30 |
+
$collection->addStoreFilter($store);
|
31 |
+
$collection->joinAttribute(
|
32 |
+
'name',
|
33 |
+
'catalog_product/name',
|
34 |
+
'entity_id',
|
35 |
+
null,
|
36 |
+
'inner',
|
37 |
+
$adminStore
|
38 |
+
);
|
39 |
+
$collection->joinAttribute(
|
40 |
+
'custom_name',
|
41 |
+
'catalog_product/name',
|
42 |
+
'entity_id',
|
43 |
+
null,
|
44 |
+
'inner',
|
45 |
+
$store->getId()
|
46 |
+
);
|
47 |
+
$collection->joinAttribute(
|
48 |
+
'status',
|
49 |
+
'catalog_product/status',
|
50 |
+
'entity_id',
|
51 |
+
null,
|
52 |
+
'inner',
|
53 |
+
$store->getId()
|
54 |
+
);
|
55 |
+
$collection->joinAttribute(
|
56 |
+
'visibility',
|
57 |
+
'catalog_product/visibility',
|
58 |
+
'entity_id',
|
59 |
+
null,
|
60 |
+
'inner',
|
61 |
+
$store->getId()
|
62 |
+
);
|
63 |
+
$collection->joinAttribute(
|
64 |
+
'price',
|
65 |
+
'catalog_product/price',
|
66 |
+
'entity_id',
|
67 |
+
null,
|
68 |
+
'left',
|
69 |
+
$store->getId()
|
70 |
+
);
|
71 |
+
}
|
72 |
+
else {
|
73 |
+
$collection->addAttributeToSelect('price');
|
74 |
+
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
|
75 |
+
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->setCollection($collection);
|
79 |
+
|
80 |
+
Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
|
81 |
+
$this->getCollection()->addWebsiteNamesToResult();
|
82 |
+
return $this;
|
83 |
+
}
|
84 |
+
|
85 |
+
protected function _prepareColumns()
|
86 |
+
{
|
87 |
+
$this->addColumn('thumbnail', array(
|
88 |
+
'header' => Mage::helper('catalog')->__('Image'),
|
89 |
+
'align' => 'left',
|
90 |
+
'index' => 'thumbnail',
|
91 |
+
'width' => Mage::getStoreConfig('product_grid_thumbnail/settings/image_size',Mage::app()->getStore()),
|
92 |
+
'renderer' => 'Dotcom_ProductGridThumbnail_Block_Adminhtml_Catalog_Product_Grid_Renderer_Thumbnail',
|
93 |
+
'filter' => false,
|
94 |
+
'sortable' => false
|
95 |
+
));
|
96 |
+
return parent::_prepareColumns();
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Dotcom/ProductGridThumbnail/Block/Adminhtml/Catalog/Product/Grid/Renderer/Thumbnail.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dotcom S.r.l.
|
4 |
+
* User: Diego Zerjal
|
5 |
+
* Date: 17/12/2015
|
6 |
+
* Time: 12:32
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Dotcom_ProductGridThumbnail_Block_Adminhtml_Catalog_Product_Grid_Renderer_Thumbnail extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
10 |
+
{
|
11 |
+
public function render(\Varien_Object $row)
|
12 |
+
{
|
13 |
+
return $this->_getValue($row);
|
14 |
+
}
|
15 |
+
|
16 |
+
public function _getValue(\Varien_Object $row)
|
17 |
+
{
|
18 |
+
$width = Mage::getStoreConfig('product_grid_thumbnail/settings/image_size',Mage::app()->getStore());
|
19 |
+
$val = str_replace("no_selection", "", $row->getData($this->getColumn()->getIndex())) ?: '/default/default.jpg';
|
20 |
+
$url = Mage::getBaseUrl('media') . 'catalog/product' . $val;
|
21 |
+
$out = "<img src=". $url ." width='{$width}px'/>";
|
22 |
+
return $out;
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Dotcom/ProductGridThumbnail/Helper/Data.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dotcom S.r.l.
|
4 |
+
* User: Diego Zerjal
|
5 |
+
* Date: 17/12/2015
|
6 |
+
* Time: 12:10
|
7 |
+
*/
|
8 |
+
class Dotcom_ProductGridThumbnail_Helper_Data extends Mage_Core_Helper_Abstract {
|
9 |
+
|
10 |
+
}
|
app/code/community/Dotcom/ProductGridThumbnail/etc/adminhtml.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<all>
|
6 |
+
<title>Allow Everything</title>
|
7 |
+
</all>
|
8 |
+
<admin>
|
9 |
+
<children>
|
10 |
+
<system>
|
11 |
+
<children>
|
12 |
+
<config>
|
13 |
+
<children>
|
14 |
+
<product_grid_thumbnail translate="title">
|
15 |
+
<title>Product Grid Thumbnail</title>
|
16 |
+
</product_grid_thumbnail>
|
17 |
+
</children>
|
18 |
+
</config>
|
19 |
+
</children>
|
20 |
+
</system>
|
21 |
+
</children>
|
22 |
+
</admin>
|
23 |
+
</resources>
|
24 |
+
</acl>
|
25 |
+
</config>
|
app/code/community/Dotcom/ProductGridThumbnail/etc/config.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Dotcom_ProductGridThumbnail>
|
5 |
+
<version>1.1.0</version>
|
6 |
+
</Dotcom_ProductGridThumbnail>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<dotcom_productgridthumbnail>
|
11 |
+
<class>Dotcom_ProductGridThumbnail_Model</class>
|
12 |
+
<resourceModel>dotcom_productgridthumbnail_resource</resourceModel>
|
13 |
+
</dotcom_productgridthumbnail>
|
14 |
+
<dotcom_productgridthumbnail_resource>
|
15 |
+
<class>Dotcom_ProductGridThumbnail_Model_Resource</class>
|
16 |
+
</dotcom_productgridthumbnail_resource>
|
17 |
+
</models>
|
18 |
+
<blocks>
|
19 |
+
<dotcom_productgridthumbnail>
|
20 |
+
<class>Dotcom_ProductGridThumbnail_Block</class>
|
21 |
+
</dotcom_productgridthumbnail>
|
22 |
+
<adminhtml>
|
23 |
+
<rewrite>
|
24 |
+
<catalog_product_grid>Dotcom_ProductGridThumbnail_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
|
25 |
+
</rewrite>
|
26 |
+
</adminhtml>
|
27 |
+
</blocks>
|
28 |
+
<helpers>
|
29 |
+
<dotcom_productgridthumbnail>
|
30 |
+
<class>Dotcom_ProductGridThumbnail_Helper</class>
|
31 |
+
</dotcom_productgridthumbnail>
|
32 |
+
</helpers>
|
33 |
+
</global>
|
34 |
+
</config>
|
app/code/community/Dotcom/ProductGridThumbnail/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<dotcomextensions translate="label">
|
5 |
+
<label>Dotcom Extensions</label>
|
6 |
+
<sort_order>100</sort_order>
|
7 |
+
</dotcomextensions>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<product_grid_thumbnail translate="label" module="dotcom_productgridthumbnail">
|
11 |
+
<label>Product Grid Thumbnail</label>
|
12 |
+
<tab>dotcomextensions</tab>
|
13 |
+
<sort_order>1</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 |
+
<settings>
|
19 |
+
<label>Settings</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>10</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 |
+
<expanded>true</expanded>
|
26 |
+
<fields>
|
27 |
+
<image_size>
|
28 |
+
<label>Image Size (px)</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<validate>validate-number</validate>
|
31 |
+
<sort_order>10</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 |
+
</image_size>
|
36 |
+
</fields>
|
37 |
+
</settings>
|
38 |
+
</groups>
|
39 |
+
</product_grid_thumbnail>
|
40 |
+
</sections>
|
41 |
+
</config>
|
app/etc/modules/Dotcom_ProductGridThumbnail.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Dotcom_ProductGridThumbnail>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Dotcom_ProductGridThumbnail>
|
8 |
+
</modules>
|
9 |
+
</config>
|
media/catalog/product/default/default.jpg
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Dotcom_ProductGridThumbnail</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Add product thumbnails to admin grid</summary>
|
10 |
+
<description>This module adds the products' thumbnails to the admin grid. The thumbnail size can be configured.</description>
|
11 |
+
<notes>first stable release</notes>
|
12 |
+
<authors><author><name>Doc</name><user>DotcomIT</user><email>info@dotcom.ts.it</email></author></authors>
|
13 |
+
<date>2016-04-05</date>
|
14 |
+
<time>08:59:14</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Dotcom"><dir name="ProductGridThumbnail"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Grid"><dir name="Renderer"><file name="Thumbnail.php" hash="47ef37ac43fa8fbdfbd21b526ab6f536"/></dir></dir><file name="Grid.php" hash="0864d72dfb0b1ddb70179e01636b6c75"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5295f5ac0aa129934dd5b89b0920537b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9e988d1653c4fe18177983848cd1451b"/><file name="config.xml" hash="a840b76d4867c0963e63fb2b7d3a7fd0"/><file name="system.xml" hash="58623bcaf2d4bc62b8d25916255eee1d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dotcom_ProductGridThumbnail.xml" hash="fbc9cc315d9615322e5437bf408d28e9"/></dir></target><target name="magemedia"><dir name="catalog"><dir name="product"><dir name="default"><file name="default.jpg" hash="d214c2f29a8667ba0eae0bfc950d2785"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.4</min><max>5.5.16</max></php></required></dependencies>
|
18 |
+
</package>
|