Magento – Link for action column in custom grid

blockscataloggridgrid-serlizationmagento-1.7

I have a custom grid which resembles the Manage Products grid in Catalog Menu.

I need to get the corresponding action link to each entity item. How do i do that?

My custom grid is declared in the class Mynamespace_Mymodule_Block_Adminhtml_MyblockGroup_Grid with _prepareColumns function for the action column as follows

$this->addColumn('action',
        array(
            'header'    => Mage::helper('catalog')->__('Action'),
            'width'     => '50px',
            'type'      => 'action',
            'getter'     => 'getId',
            'actions'   => array(
                array(
                    'caption' => Mage::helper('catalog')->__('Edit'),
                    'url'     => array(
                        'base'=>'*/*/edit',
                        'params'=>array('store'=>$this->getRequest()->getParam('store'))
                    ),
                    'field'   => 'id'
                )
            ),
            'filter'    => false,
            'sortable'  => false,
            'index'     => 'stores',
    ));

As of now, the link which this action getting is '_baseUrl/adminfrontNameforMyModule/controller_action/edit/id/entity_id'.

I assume, If this action gets the link to '_baseUrl/admin/catalog_product/edit/id/entity_id' then my issue is resolved.

Can any one help me with this?

Best Answer

    //$link changed
    $link= Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit/') .'id/$entity_id';
    $this->addColumn('action_edit', array(
        'header'   => $this->helper('catalog')->__('Action'),
        'width'    => 15,
        'sortable' => false,
        'filter'   => false,
        'type'     => 'action',
        'actions'  => array(
            array(
                'url'     => $link,
                'caption' => $this->helper('catalog')->__('Edit'),
            ),
        )
    ));
Related Topic