<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Add custom renderer for a custom column in Magento grid</title>
	<atom:link href="http://inchoo.net/ecommerce/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Mon, 21 May 2012 08:29:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Raj</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-25757</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Mon, 16 Jan 2012 08:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-25757</guid>
		<description>I want to add new custom field backend when create new customer from create new order from sales in Order from magento backend.

Is it possible or how ?</description>
		<content:encoded><![CDATA[<p>I want to add new custom field backend when create new customer from create new order from sales in Order from magento backend.</p>
<p>Is it possible or how ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vishal</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-24616</link>
		<dc:creator>vishal</dc:creator>
		<pubDate>Thu, 22 Dec 2011 12:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-24616</guid>
		<description>Hi, It Is nice but i am facing problem.when i filter data or search in admin grid.
searching and sorting not working ?</description>
		<content:encoded><![CDATA[<p>Hi, It Is nice but i am facing problem.when i filter data or search in admin grid.<br />
searching and sorting not working ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pierre FAY</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-23882</link>
		<dc:creator>Pierre FAY</dc:creator>
		<pubDate>Tue, 22 Nov 2011 15:51:28 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-23882</guid>
		<description>Very good tutorial thanks :)

@MagePsycho:

if you want to create a filtrable admin grid, look at this article: http://www.about-magento.com/magento-admin-gridview-85

it&#039;s how to do an admin grid. Good Chance ;)</description>
		<content:encoded><![CDATA[<p>Very good tutorial thanks <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>@MagePsycho:</p>
<p>if you want to create a filtrable admin grid, look at this article: <a href="http://www.about-magento.com/magento-admin-gridview-85" rel="nofollow">http://www.about-magento.com/magento-admin-gridview-85</a></p>
<p>it&#8217;s how to do an admin grid. Good Chance <img src='http://inchoo.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MagePsycho</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-22370</link>
		<dc:creator>MagePsycho</dc:creator>
		<pubDate>Thu, 18 Aug 2011 10:03:19 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-22370</guid>
		<description>Hi,

AFAIK, filtering doesn&#039;t work for renderer column. If you want the column to be filterable then use normal column instead.

Thanks
MagePsycho</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>AFAIK, filtering doesn&#8217;t work for renderer column. If you want the column to be filterable then use normal column instead.</p>
<p>Thanks<br />
MagePsycho</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jignesh Chauhan</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-22238</link>
		<dc:creator>Jignesh Chauhan</dc:creator>
		<pubDate>Mon, 08 Aug 2011 06:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-22238</guid>
		<description>Greeting there,

Very useful code and working fine but when go for filter then renderer column is disappear from the product grid means filter is not working on renderer column.

Please post the soution for this problem.

Thanks,
Jignesh</description>
		<content:encoded><![CDATA[<p>Greeting there,</p>
<p>Very useful code and working fine but when go for filter then renderer column is disappear from the product grid means filter is not working on renderer column.</p>
<p>Please post the soution for this problem.</p>
<p>Thanks,<br />
Jignesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ankur</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-21404</link>
		<dc:creator>Ankur</dc:creator>
		<pubDate>Wed, 08 Jun 2011 05:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-21404</guid>
		<description>HI Tomas. its nice post. It helped me.
I re-wrote the sales order grid. I wanted the customer&#039;s email in grid too. for that I wrote the renderer as 
[code]&lt;?php

class Mage_Adminhtml_Block_Renderer_Customer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract 
{

	public function render(Varien_Object $row)
    {
    	$model = Mage::getModel(&#039;customer/customer&#039;)-&gt;load($row-&gt;getCustomerId());
    	
    	return  $model-&gt;getEmail();
    	        
    }

}
[/code]

&amp; in my rewritten grid I added the col as 

[code][/code][/code]
 $this-&gt;addColumn(&#039;customer_email&#039;, array(
            &#039;header&#039; =&gt; Mage::helper(&#039;sales&#039;)-&gt;__(&#039;Customer Email&#039;),
            &#039;renderer&#039; =&gt; &#039;adminhtml/renderer_customer&#039;,
         	
        ));
[/cdoe]

I am having the email as desired. But these col is having a lot of trailing &amp; leading spaces, dhue to which I think its not searchable
Can you suggest anything to remove those whitespaces? Thanks

Regards</description>
		<content:encoded><![CDATA[<p>HI Tomas. its nice post. It helped me.<br />
I re-wrote the sales order grid. I wanted the customer&#8217;s email in grid too. for that I wrote the renderer as </p>
<pre class="brush: plain; title: ; notranslate">&amp;lt;?php

class Mage_Adminhtml_Block_Renderer_Customer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{

	public function render(Varien_Object $row)
    {
    	$model = Mage::getModel('customer/customer')-&amp;gt;load($row-&amp;gt;getCustomerId());

    	return  $model-&amp;gt;getEmail();

    }

}
</pre>
<p>&amp; in my rewritten grid I added the col as </p>
<p>[/code]<br />
 $this-&gt;addColumn('customer_email', array(<br />
            'header' =&gt; Mage::helper('sales')-&gt;__('Customer Email'),<br />
            'renderer' =&gt; 'adminhtml/renderer_customer',</p>
<p>        ));<br />
[/cdoe]</p>
<p>I am having the email as desired. But these col is having a lot of trailing &amp; leading spaces, dhue to which I think its not searchable<br />
Can you suggest anything to remove those whitespaces? Thanks</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: burnick</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-21285</link>
		<dc:creator>burnick</dc:creator>
		<pubDate>Wed, 01 Jun 2011 09:10:59 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-21285</guid>
		<description>What about asc/desc of the custom column via ajax</description>
		<content:encoded><![CDATA[<p>What about asc/desc of the custom column via ajax</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sonia</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-20988</link>
		<dc:creator>sonia</dc:creator>
		<pubDate>Sun, 15 May 2011 18:54:58 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-20988</guid>
		<description>Thank you so much!! Very useful tutorial!</description>
		<content:encoded><![CDATA[<p>Thank you so much!! Very useful tutorial!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jimmy</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-20907</link>
		<dc:creator>jimmy</dc:creator>
		<pubDate>Wed, 11 May 2011 17:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-20907</guid>
		<description>Hi, thanks for the tutorial, i was wondering if anyone knows how to show if a product has an image?
the code below shows 0 for items with an image and nothing if they don&#039;t have an image which is fine i guess.. but i&#039;d like to make it display yes/no can anyone help?!

         -&gt;addAttributeToSelect(&#039;image&#039;)


        $this-&gt;addColumn(&#039;image&#039;,
            array(
                &#039;header&#039;=&gt; Mage::helper(&#039;catalog&#039;)-&gt;__(&#039;Has Image&#039;),
                &#039;width&#039; =&gt; &#039;100px&#039;,
                &#039;type&#039;  =&gt; &#039;number&#039;,
                &#039;index&#039; =&gt; &#039;image&#039;,
        ));</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the tutorial, i was wondering if anyone knows how to show if a product has an image?<br />
the code below shows 0 for items with an image and nothing if they don&#8217;t have an image which is fine i guess.. but i&#8217;d like to make it display yes/no can anyone help?!</p>
<p>         -&gt;addAttributeToSelect(&#8216;image&#8217;)</p>
<p>        $this-&gt;addColumn(&#8216;image&#8217;,<br />
            array(<br />
                &#8216;header&#8217;=&gt; Mage::helper(&#8216;catalog&#8217;)-&gt;__(&#8216;Has Image&#8217;),<br />
                &#8216;width&#8217; =&gt; &#8217;100px&#8217;,<br />
                &#8216;type&#8217;  =&gt; &#8216;number&#8217;,<br />
                &#8216;index&#8217; =&gt; &#8216;image&#8217;,<br />
        ));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: allen</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-10952</link>
		<dc:creator>allen</dc:creator>
		<pubDate>Wed, 15 Dec 2010 22:52:33 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-10952</guid>
		<description>hm... It works when I hack the core.  When I try to implement on my module, it throws &#039;Mage_Core_Exception&#039; with message &#039;Invalid block type:&#039; exception.</description>
		<content:encoded><![CDATA[<p>hm&#8230; It works when I hack the core.  When I try to implement on my module, it throws &#8216;Mage_Core_Exception&#8217; with message &#8216;Invalid block type:&#8217; exception.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arif Hossain</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-8939</link>
		<dc:creator>Arif Hossain</dc:creator>
		<pubDate>Thu, 04 Nov 2010 10:24:43 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-8939</guid>
		<description>Thanks for nice tutorial.......Works fine  for me</description>
		<content:encoded><![CDATA[<p>Thanks for nice tutorial&#8230;&#8230;.Works fine  for me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-8096</link>
		<dc:creator>Ash</dc:creator>
		<pubDate>Wed, 08 Sep 2010 11:21:19 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-8096</guid>
		<description>Hi all,

wondering someone could help.

heres what ive done so far

1. Ive created a new column in the orders grid in admin

2. ive created a new table called: 

add_info 

which has the following fields:

addinfo_id
entity_id    (this is populated with the order entity id)
value      (this is the value i want to display in the new column)


Im having trouble population the new column : (

please can someone guide me to how i can populate  the new column with the data in the &quot;value&quot; field


thanks you soo much!!</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>wondering someone could help.</p>
<p>heres what ive done so far</p>
<p>1. Ive created a new column in the orders grid in admin</p>
<p>2. ive created a new table called: </p>
<p>add_info </p>
<p>which has the following fields:</p>
<p>addinfo_id<br />
entity_id    (this is populated with the order entity id)<br />
value      (this is the value i want to display in the new column)</p>
<p>Im having trouble population the new column : (</p>
<p>please can someone guide me to how i can populate  the new column with the data in the &#8220;value&#8221; field</p>
<p>thanks you soo much!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sabine Jansen</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-7771</link>
		<dc:creator>Sabine Jansen</dc:creator>
		<pubDate>Tue, 03 Aug 2010 14:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-7771</guid>
		<description>A nice extension that does something similar is enhanced product grid
http://www.magentocommerce.com/magento-connect/WDCA/extension/748/enhanced-product-grid</description>
		<content:encoded><![CDATA[<p>A nice extension that does something similar is enhanced product grid<br />
<a href="http://www.magentocommerce.com/magento-connect/WDCA/extension/748/enhanced-product-grid" rel="nofollow">http://www.magentocommerce.com/magento-connect/WDCA/extension/748/enhanced-product-grid</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomas Novoseli?</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-7742</link>
		<dc:creator>Tomas Novoseli?</dc:creator>
		<pubDate>Fri, 30 Jul 2010 09:02:36 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-7742</guid>
		<description>@loopion Thanks for feedback. I&#039;ll try your code as soon as I get to similar task, seems nice and short  :)</description>
		<content:encoded><![CDATA[<p>@loopion Thanks for feedback. I&#8217;ll try your code as soon as I get to similar task, seems nice and short  <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: loopion</title>
		<link>http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/comment-page-1/#comment-7736</link>
		<dc:creator>loopion</dc:creator>
		<pubDate>Thu, 29 Jul 2010 17:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=5159#comment-7736</guid>
		<description>I&#039;ve just did the same on a project for displaying images from one of our custom extension.

Another solution:

You can extend the Column.php from app/code/local/Adminhtml/Block/Widget/Grid by adding to _getRendererByType() your new renderer.

[code]
    protected function _getRendererByType()
    {
        switch (strtolower($this-&gt;getType())) {
            case &#039;image&#039;:
                $rendererClass = &#039;adminhtml/widget_grid_column_renderer_image&#039;;
                break;
            default:
                $rendererClass = parent::_getRendererByType();
                break;
        }
        return $rendererClass;
    }
[/code]

And then create your custom renderer (mine Image.php) into the app/code/local/Adminhtml/Block/Widget/Grid/Column/Renderer like you explained. (you should maybe add a function to get the full URL of your image if it comes from the products for example)
You can even create your custom filter app/code/local/Adminhtml/Block/Widget/Grid/Column/Filter in my case Image.php

Next, on your Grid.php instead of

[code]
&#039;renderer&#039;  =&gt; &#039;Mage_Adminhtml_Block_Catalog_Product_Renderer_Red&#039;,
[/code]

write

[code]
&#039;type&#039;  =&gt; &#039;image&#039;,
[/code]


Very good article and extremely useful!</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just did the same on a project for displaying images from one of our custom extension.</p>
<p>Another solution:</p>
<p>You can extend the Column.php from app/code/local/Adminhtml/Block/Widget/Grid by adding to _getRendererByType() your new renderer.</p>
<pre class="brush: plain; title: ; notranslate">
    protected function _getRendererByType()
    {
        switch (strtolower($this-&gt;getType())) {
            case 'image':
                $rendererClass = 'adminhtml/widget_grid_column_renderer_image';
                break;
            default:
                $rendererClass = parent::_getRendererByType();
                break;
        }
        return $rendererClass;
    }
</pre>
<p>And then create your custom renderer (mine Image.php) into the app/code/local/Adminhtml/Block/Widget/Grid/Column/Renderer like you explained. (you should maybe add a function to get the full URL of your image if it comes from the products for example)<br />
You can even create your custom filter app/code/local/Adminhtml/Block/Widget/Grid/Column/Filter in my case Image.php</p>
<p>Next, on your Grid.php instead of</p>
<pre class="brush: plain; title: ; notranslate">
'renderer'  =&gt; 'Mage_Adminhtml_Block_Catalog_Product_Renderer_Red',
</pre>
<p>write</p>
<pre class="brush: plain; title: ; notranslate">
'type'  =&gt; 'image',
</pre>
<p>Very good article and extremely useful!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

