Version Notes
First release
Download this release
Release Info
| Developer | Ameronix |
| Extension | Ameronix_Productimage |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/Ameronix/Productimage/Block/Adminhtml/Catalog/Product/Renderer/Image.php +20 -0
- app/code/local/Ameronix/Productimage/Helper/Data.php +9 -0
- app/code/local/Ameronix/Productimage/Model/Observer.php +42 -0
- app/code/local/Ameronix/Productimage/etc/config.xml +108 -0
- app/code/local/Ameronix/Productimage/etc/system.xml +42 -0
- app/etc/modules/Ameronix_Productimage.xml +9 -0
- package.xml +22 -0
app/code/local/Ameronix/Productimage/Block/Adminhtml/Catalog/Product/Renderer/Image.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Ameronix_Productimage_Block_Adminhtml_Catalog_Product_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function render(Varien_Object $row)
|
| 5 |
+
{
|
| 6 |
+
// the $row is the entire order object - Mage_Sales_Model_Order
|
| 7 |
+
$product = $row;
|
| 8 |
+
|
| 9 |
+
$image_url = $row->getData('image');
|
| 10 |
+
|
| 11 |
+
if($image_url && $image_url != 'no_selection')
|
| 12 |
+
{
|
| 13 |
+
$full_image_url = Mage::helper('catalog/image')->init($product, 'image')->resize(Mage::getStoreConfig('ameronix_amxproductimage_options/image/image_size'));
|
| 14 |
+
return '<img src="'.$full_image_url.'"/>';
|
| 15 |
+
}
|
| 16 |
+
else {
|
| 17 |
+
return "-- No Image --";
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
app/code/local/Ameronix/Productimage/Helper/Data.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Ameronix_Productimage_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function getExtensionVersion()
|
| 5 |
+
{
|
| 6 |
+
return (string) Mage::getConfig()->getNode()->modules->Ameronix_Productimage->version;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
}
|
app/code/local/Ameronix/Productimage/Model/Observer.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Ameronix_Productimage_Model_Observer extends Varien_Event_Observer
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Adds column to admin customers grid
|
| 6 |
+
*
|
| 7 |
+
* @param Varien_Event_Observer $observer
|
| 8 |
+
* @return Atwix_CustomGrid_Model_Observer
|
| 9 |
+
*/
|
| 10 |
+
public function appendCustomColumn(Varien_Event_Observer $observer)
|
| 11 |
+
{
|
| 12 |
+
$block = $observer->getBlock();
|
| 13 |
+
if (!isset($block)) {
|
| 14 |
+
return $this;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if ($block->getType() == 'adminhtml/catalog_product_grid') {
|
| 18 |
+
/* @var $block Mage_Adminhtml_Block_Customer_Grid */
|
| 19 |
+
$block->addColumnAfter('amxcustomers_type', array(
|
| 20 |
+
'header' => 'Main Image',
|
| 21 |
+
'align' => 'center',
|
| 22 |
+
//'type' => 'options',
|
| 23 |
+
//'options' => array(0 => 'No Image'),
|
| 24 |
+
'index' => 'image',
|
| 25 |
+
'renderer' => 'Ameronix_Productimage_Block_Adminhtml_Catalog_Product_Renderer_Image',
|
| 26 |
+
'width' => (int) Mage::getStoreConfig('ameronix_amxproductimage_options/image/image_size') + 6
|
| 27 |
+
), 'entity_id');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function appendCustomAttribute($observer)
|
| 32 |
+
{
|
| 33 |
+
$collection = $observer->getCollection();
|
| 34 |
+
if (!isset($collection)) return;
|
| 35 |
+
|
| 36 |
+
if(is_a($collection, "Mage_Catalog_Model_Resource_Product_Collection"))
|
| 37 |
+
{
|
| 38 |
+
$collection->joinAttribute('image', 'catalog_product/image', 'entity_id', null, 'left');
|
| 39 |
+
//echo '<pre>variable: '.htmlentities(print_r('woot',true)).'</pre>';
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
app/code/local/Ameronix/Productimage/etc/config.xml
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ameronix_Productimage>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Ameronix_Productimage>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<global>
|
| 10 |
+
<helpers>
|
| 11 |
+
<amxproductimage>
|
| 12 |
+
<class>Ameronix_Productimage_Helper</class>
|
| 13 |
+
</amxproductimage>
|
| 14 |
+
</helpers>
|
| 15 |
+
|
| 16 |
+
<blocks>
|
| 17 |
+
<amxproductimage>
|
| 18 |
+
<class>Ameronix_Productimage_Block</class>
|
| 19 |
+
</amxproductimage>
|
| 20 |
+
</blocks>
|
| 21 |
+
|
| 22 |
+
<models>
|
| 23 |
+
<amxproductimage>
|
| 24 |
+
<class>Ameronix_Productimage_Model</class>
|
| 25 |
+
<resourceModel>amxproductimage_mysql4</resourceModel>
|
| 26 |
+
</amxproductimage>
|
| 27 |
+
</models>
|
| 28 |
+
|
| 29 |
+
<resources>
|
| 30 |
+
<amxproductimage_setup>
|
| 31 |
+
<setup>
|
| 32 |
+
<module>Ameronix_Productimage</module>
|
| 33 |
+
</setup>
|
| 34 |
+
</amxproductimage_setup>
|
| 35 |
+
</resources>
|
| 36 |
+
|
| 37 |
+
</global>
|
| 38 |
+
|
| 39 |
+
<adminhtml>
|
| 40 |
+
|
| 41 |
+
<acl>
|
| 42 |
+
<resources>
|
| 43 |
+
<admin>
|
| 44 |
+
<children>
|
| 45 |
+
<system>
|
| 46 |
+
<children>
|
| 47 |
+
<config>
|
| 48 |
+
<children>
|
| 49 |
+
<ameronix_amxproductimage_options>
|
| 50 |
+
<title>Ameronix Product Image</title>
|
| 51 |
+
</ameronix_amxproductimage_options>
|
| 52 |
+
</children>
|
| 53 |
+
</config>
|
| 54 |
+
</children>
|
| 55 |
+
</system>
|
| 56 |
+
</children>
|
| 57 |
+
</admin>
|
| 58 |
+
</resources>
|
| 59 |
+
</acl>
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
<events>
|
| 63 |
+
<core_block_abstract_prepare_layout_before>
|
| 64 |
+
<observers>
|
| 65 |
+
<amxproductimage_append_type_column>
|
| 66 |
+
<type>model</type>
|
| 67 |
+
<class>Ameronix_Productimage_Model_Observer</class>
|
| 68 |
+
<method>appendCustomColumn</method>
|
| 69 |
+
</amxproductimage_append_type_column>
|
| 70 |
+
</observers>
|
| 71 |
+
</core_block_abstract_prepare_layout_before>
|
| 72 |
+
<eav_collection_abstract_load_before>
|
| 73 |
+
<observers>
|
| 74 |
+
<amxproductimage_append_type_collection>
|
| 75 |
+
<type>model</type>
|
| 76 |
+
<class>Ameronix_Productimage_Model_Observer</class>
|
| 77 |
+
<method>appendCustomAttribute</method>
|
| 78 |
+
</amxproductimage_append_type_collection>
|
| 79 |
+
</observers>
|
| 80 |
+
</eav_collection_abstract_load_before>
|
| 81 |
+
</events>
|
| 82 |
+
|
| 83 |
+
</adminhtml>
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
<admin>
|
| 87 |
+
<routers>
|
| 88 |
+
<amxproductimage>
|
| 89 |
+
<use>admin</use>
|
| 90 |
+
<args>
|
| 91 |
+
<module>Ameronix_Productimage</module>
|
| 92 |
+
<frontName>amxproductimage</frontName>
|
| 93 |
+
</args>
|
| 94 |
+
</amxproductimage>
|
| 95 |
+
</routers>
|
| 96 |
+
</admin>
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
<default>
|
| 100 |
+
<ameronix_amxproductimage_options>
|
| 101 |
+
<image>
|
| 102 |
+
<image_size>100</image_size>
|
| 103 |
+
</image>
|
| 104 |
+
</ameronix_amxproductimage_options>
|
| 105 |
+
</default>
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
</config>
|
app/code/local/Ameronix/Productimage/etc/system.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<tabs>
|
| 3 |
+
<ameronix translate="label" module="amxproductimage">
|
| 4 |
+
<label>Ameronix</label>
|
| 5 |
+
<sort_order>100</sort_order>
|
| 6 |
+
</ameronix>
|
| 7 |
+
</tabs>
|
| 8 |
+
<sections>
|
| 9 |
+
<ameronix_amxproductimage_options translate="label" module="amxproductimage">
|
| 10 |
+
<label>Product Grid Image</label>
|
| 11 |
+
<tab>ameronix</tab>
|
| 12 |
+
<frontend_type>text</frontend_type>
|
| 13 |
+
<sort_order>1000</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 |
+
<image translate="label">
|
| 19 |
+
<label>Image Settings</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>1</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>1</expanded>
|
| 26 |
+
<fields>
|
| 27 |
+
<image_size>
|
| 28 |
+
<label>Image Size in Grid</label>
|
| 29 |
+
<frontend_type>text</frontend_type>
|
| 30 |
+
<sort_order>1</sort_order>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
<show_in_store>1</show_in_store>
|
| 34 |
+
<comment>in pixels</comment>
|
| 35 |
+
<validate>validate-number validate-greater-than-zero</validate>
|
| 36 |
+
</image_size>
|
| 37 |
+
</fields>
|
| 38 |
+
</image>
|
| 39 |
+
</groups>
|
| 40 |
+
</ameronix_amxproductimage_options>
|
| 41 |
+
</sections>
|
| 42 |
+
</config>
|
app/etc/modules/Ameronix_Productimage.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Ameronix_Productimage>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</Ameronix_Productimage>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Ameronix_Productimage</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Adds main product image to the product grid</summary>
|
| 10 |
+
<description>This module gives back end users the ability to see a product's main image right on the product grid.
|
| 11 |
+

|
| 12 |
+
The image column will display "--No Image--" if there is not a main image, and you will be able to sort and filter products based this column.
|
| 13 |
+

|
| 14 |
+
You may also control the size of the thumbnail on the grid.</description>
|
| 15 |
+
<notes>First release</notes>
|
| 16 |
+
<authors><author><name>Ameronix</name><user>ameronix</user><email>bharris@ameronix.com</email></author></authors>
|
| 17 |
+
<date>2013-06-14</date>
|
| 18 |
+
<time>19:54:42</time>
|
| 19 |
+
<contents><target name="magelocal"><dir name="Ameronix"><dir name="Productimage"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Renderer"><file name="Image.php" hash="7e384e986d54ca305bef7a61f48dbd62"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="83fb320ec6dd30d721e3d5f0e2c7bf63"/></dir><dir name="Model"><file name="Observer.php" hash="1cfb58e0964090c40ab9c5b025682ba9"/></dir><dir name="etc"><file name="config.xml" hash="1b8075c5d33ff1778f62c2b15efa20b1"/><file name="system.xml" hash="d73085a83d52e95422d3bfcd2e372ee2"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ameronix_Productimage.xml" hash="1e90f007fa8e6ed5e93be4cd6f98b20b"/></dir></target></contents>
|
| 20 |
+
<compatible/>
|
| 21 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.3</max></php></required></dependencies>
|
| 22 |
+
</package>
|
