2

I am using magento 1.8. My requirement is to display delete option in product grid in front of each product like "Edit" option. I have created column and able to display the Delete option in grid using following code in

Npm_Product_Adminhtml_Block_Catalog_Product_Grid

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

When I click on delete it redirecting but showing 404 error, Any idea how can I implement this requirement?

How can I call productController deleteAction from here with parameter product id Thanks in advance:)

1
  • 1
    there is a spelling mistake in url 'base' =>'*/*/delete' Jun 30, 2014 at 6:52

2 Answers 2

2

try this

       $this->addColumn('delete',
            array(
                'header'    => Mage::helper('catalog')->__('Delete'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('catalog')->__('Delete'),
                        'url'     => array(
                            'base'=>'*/*/delete',
                            'params'=>array('store'=>$this->getRequest()->getParam('store'))
                        ),
                        'field'   => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false,
                'index'     => 'stores',
            ));
1
  • if it works than please mark it as accepted Jul 1, 2014 at 3:43
0
    protected function _prepareColumns()
    {
            $this->addColumn("videogallery_id", array(
            "header" => Mage::helper("videogallery")->__("ID"),
            "align" =>"center",
            "type" => "number",
            "index" => "videogallery_id",
            ));
            $this->addColumn("videogallery_url", array(
            "header" => Mage::helper("videogallery")->__("Video Thumbnail"),
            "index" => "videogallery_url",
            "align" =>"center",
            "width" => "200px",
            'renderer'  => 'videogallery/renderer_image',
            ));

            $this->addColumn("name", array(
            "header" => Mage::helper("videogallery")->__("Video Name"),
            "index" => "name",
            ));
            $this->addColumn('action',
            array(
                'header' => Mage::helper('videogallery')->__('Action'),
                'width' => '120',
                'type' => 'action',
                'getter' => 'getId',
                'actions'   => array(
                    array(
                        'caption'   => Mage::helper('videogallery')->__('Delete Video'),
                        'url'       => array('base'=> '*/*/delete'),
                        'field'     => 'id',
                        'confirm'  => Mage::helper('videogallery')->__('Are you sure?')
                    )
                ),
                'filter' => false,
                'sortable' => false,
                'index' => 'stores',
                'is_system' => true,
            ));
     $this->addRssList('videogallery/adminhtml_rss_rss/videogallery', Mage::helper('videogallery')->__('RSS'));
        $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV')); 
        $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));

            return parent::_prepareColumns();
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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