Jump to content

Implement Product search in HelperForm from a controller in custom module


sttaq

Recommended Posts

Hi

 

I have custom module which has got it's very own controller. In the controller I am managing a very simple database table which happens to have id_product as one of it's columns. I have implemented a simple renderForm method for the controller as below:

        // Building the Add/Edit form
        $this->fields_form = array(
            'legend' => array(
                'title' => $this->l('Simple Object')
            ),
            'input' => array(
                array(
                    'type' => 'text', 
                    'label' => $this->l('Product Id'), 
                    'name' => 'id_product',
                    'size' => 50,
                    'required' => true,
                    'desc' => $this->l('Please provide a valid product Id.')
                )//...
            ),
            'submit' => array(
                'title' => $this->l('    Save   '),
                'class' => 'button'
            )
        );

Now this works fine but as you see it will display a text box for entering a product id which is not very helpful. Every time someone clicks on Add new button they will have to remember the product id for which they are creating a new record.

 

I would like to find out how I can override this default behavior to show a Product search box just as in the Orders page or in Supply Order page?

 

After looking around I am guessing that I need to put my helper override in /modules/mymodule/views/templates/admin/_configure/helpers/form/form.tpl

 

Please correct me if I am wrong.

 

I am not sure what to put in this tpl file and also how to modify my renderForm method such that it picks up this new tpl file?

 

Thanks in advance

Link to comment
Share on other sites

  • 2 weeks later...

Someone must know where I need to put the override for admin form.tpl in my back office module controller? The following path does not work

 

/modules/mymodule/views/templates/admin/_configure/helpers/form/form.tpl

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...