Magento – How To add import button in custom grid

importexportmagento-1.9

I have to use this link for add import button in custom grid.

How to add Upload Button for importing a csv file in the Custom Admin Grid Container?

but I don't know how to add its action?

it is my makemodel.php file

<?php

class Sigmasolve_Makemodel_Block_Adminhtml_Makemodel extends Mage_Adminhtml_Block_Widget_Grid_Container
{
    public function __construct()
    {
        $this->_controller = 'adminhtml_makemodel';
        $this->_blockGroup = 'makemodel';
        $this->_headerText = Mage::helper('makemodel')->__('Item Manager');
        $this->_addButtonLabel = Mage::helper('makemodel')->__('Add Item');
        parent::__construct();

        $this->_addButton("Import", array(
            "label" => Mage::helper("core")->__("Import"),
            "onclick" => "location.href = '" . $this->getUrl('makemodel/adminhtml_import') . "';",
            "class" => "btn btn-danger",
        ));
    }
}

Best Answer

Please make "Import" controller and "index" as shown below:-

class YourPackageName_YourModuleName_Adminhtml_ImportController extends Mage_Adminhtml_Controller_action{
   public function indexAction() {
      //your import codes write here
    }
} 
Related Topic