I have a basic grid with edit and save:

├── Block
│   ├── Adminhtml
│   │   ├── Stores
            ├── Edit
                ├── Form.php
            ├── Grid.php
            ├── Edit.php
        ├── Stores.php
├── controllers
    ├── Adminhtml
        ├── StoresController.php

I want to add a button that will load another form. So insider Store.php I added the button:

                'label'     => 'Import CSV',
                'onclick'   => "setLocation('{$this->getUrl('*/stores/importfile')}')",
                'class'     => 'add',

and inside StoresController.php I started a new method for Module_Adminhtml_StoresController:

public function importfileAction()

But I am stuck now and don't know how to proceed.

When clicking on the Import CSV button you should go to a new form where you can upload a file. How should I proceed with the grid?

Thank you!

  • have you need file save code in StoresController.php?
    – Abdul
    Nov 10 '15 at 9:09
  • Sorry, but I don't understand your question Nov 10 '15 at 15:42

Add a form - read one of the many blog articles how to do it.

Then you can load this form using your controller importfileAction and handle the upload e.g. in importfilePostAction

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.