8

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?

9
    //$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'),
            ),
        )
    ));
  • @Homidjonov, tried with ur answer and it is getting the previous result itself. – basha Jun 5 '13 at 11:18
  • see updated version ($link) – mageUz Jun 5 '13 at 12:10
  • @Homidjonov, it worked. – basha Jun 5 '13 at 12:33
  • 1
    The link is really ugly to read... try this: Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit', array('id' => '$entity_id')); It worked for me. – Shadowbob Feb 18 '15 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.