Magento – add a new action in grid

Here, how to add new action in grid like ‘Edit’ link at admin grid.
On this example, we will add a “schedule” 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
and add


Then create your rewritted class /app/code/local/Adin/Catalog/Block/Adminhtml/Catalog/Product/Grid.php.

class Adin_Catalog_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {

Now, rewrite the _prepareColumns() function, find the ‘action’ column an add an entry in the actions array

                'header'    => Mage::helper('catalog')->__('Action'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                        'caption' => Mage::helper('catalog')->__('Edit'),
                        'url'     => array(
                        'field'   => 'id'
                        'caption' => Mage::helper('catalog')->__('Schedule'),
                        'url'     => array(
                        'field'   => 'id'
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',

In our example, we just add this part

                        'caption' => Mage::helper('catalog')->__('Schedule'),
                        'url'     => array(
                        'field'   => 'id'

One last thing, at the end of the _prepareColumns function, change

return parent::_prepareColumns();


return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();

PHP – Use of undefined constant MCRYPT_BLOWFISH – assumed ‘MCRYPT_BLOWFISH

While your coding session, you encounter this error :

Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH

You think, easy, a module should be missing on my php
So you install it :

sudo apt-get install php5-mcrypt

And restart apache.

But it still doesn’t work. In phpinfo() it seems the module is not installed.

In fact with the new version of PHP, you still need to activate the module

php5enmod -s apache2 mcrypt

The restart apache and the module should work.

apache AH01630: client denied by server configuration – error 403 forbidden

You are seting up a new website and you get an 403 forbidden error and this on apache error log :

AH01630: client denied by server configuration

You don’t understand because you already setup hundred of websites, you check chmod but you still get this error.

Don’t panic, since apache 2.4 you have to change the directory configuration:

<Directory />
  Options Indexed FollowSymLinks
  AllowOverride All
  Require all granted

and restart apache, that should do the trick.