<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agence de Développement Informatique du Nord &#187; _preparecolumns</title>
	<atom:link href="http://blog.adin.pro/tag/_preparecolumns/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adin.pro</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 26 Dec 2019 08:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Magento &#8211; add a new action in grid</title>
		<link>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/</link>
		<comments>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/#comments</comments>
		<pubDate>Wed, 20 Aug 2014 08:27:13 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Override]]></category>
		<category><![CDATA[_preparecolumns]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=398</guid>
		<description><![CDATA[<p>Here, how to add new action in grid like &#8216;Edit&#8217; link at admin grid. On this example, we will add a &#8220;schedule&#8221; action in product admin grid. We will overrite this class /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php. Declare the rewrite class on the /app/code/local/Adin/Catalog/etc/config.xml &#8230; <a href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Magento &#8211; add a new action in grid</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Here, how to add new action in grid like &#8216;Edit&#8217; link at admin grid.<br />
On this example, we will add a &#8220;schedule&#8221; action in product admin grid.</p>
<p>We will overrite this class /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php.</p>
<p>Declare the rewrite class on the /app/code/local/Adin/Catalog/etc/config.xml<br />
and add</p>
<pre class="brush: xml; title: ; notranslate">
&lt;global&gt;
      &lt;blocks&gt;
            &lt;adminhtml&gt;
                &lt;rewrite&gt;
                    &lt;catalog_product_grid&gt;Adin_Catalog_Block_Adminhtml_Catalog_Product_Grid&lt;/catalog_product_grid&gt;
                &lt;/rewrite&gt;
            &lt;/adminhtml&gt;
        &lt;/blocks&gt;
&lt;/global&gt;
</pre>
<p>Then create your rewritted class /app/code/local/Adin/Catalog/Block/Adminhtml/Catalog/Product/Grid.php.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Adin_Catalog_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {
}
?&gt;
</pre>
<p>Now, rewrite the _prepareColumns() function, find the &#8216;action&#8217; column an add an entry in the actions array</p>
<pre class="brush: php; title: ; notranslate">
  $this-&gt;addColumn('action',
            array(
                'header'    =&gt; Mage::helper('catalog')-&gt;__('Action'),
                'width'     =&gt; '50px',
                'type'      =&gt; 'action',
                'getter'     =&gt; 'getId',
                'actions'   =&gt; array(
                    array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Edit'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/edit',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
                    array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Schedule'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/schedule',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
                ),
                'filter'    =&gt; false,
                'sortable'  =&gt; false,
                'index'     =&gt; 'stores',
            ));
</pre>
<p>In our example, we just add this part</p>
<pre class="brush: php; title: ; notranslate">
array(
                        'caption' =&gt; Mage::helper('catalog')-&gt;__('Schedule'),
                        'url'     =&gt; array(
                            'base'=&gt;'*/*/schedule',
                            'params'=&gt;array('store'=&gt;$this-&gt;getRequest()-&gt;getParam('store'))
                        ),
                        'field'   =&gt; 'id'
                    ),
</pre>
<p>One last thing, at the end of the _prepareColumns function, change</p>
<pre class="brush: php; title: ; notranslate">
return parent::_prepareColumns();
</pre>
<p>by</p>
<pre class="brush: php; title: ; notranslate">
return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/">Magento &#8211; add a new action in grid</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2014-08-20/magento-add-a-new-action-in-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
