Jump to content

Stop redirection on extra tab of product


Nadjib BELLOUNDJA

Recommended Posts

Hi everybody,

 

I am coding my own module to enable extra customisations on each product of my shop. So I used the hook "DisplayAdminProductsExtrta" mymodule.php in order to create an extra tab ("Custom Stamp for Client", check the picture) in each product page of Catalog/Products in the admin back office.

 

Now in the hook, I use $this->display("mymodule_admin.tpl"). It is a template file in which there is a form. The form allows the admin to chose some colors available for this product. The form has a submit button and by submitting, the chosen colors are saved in the database.

 

My problem is that each time I submit the form on the mymodule_admin.tpl, I am being redirected to the tab "Information" of my product admin page. I don't want to be redirected, I want to stay on the same tab after submitting. My purpose is to be able to then update the values on that same tab without being redirected.

 

Can someone help me how to stay on the same tab after submit?

 

(Exemple: On all the other tabs, there are two buttons on the right side, one that is "Save" and one "Save and Stay". I would like to have the same thing as "Save and Stay".)

 

post-1000928-0-74074800-1434966346_thumb.png

Link to comment
Share on other sites

Hi Vekia,

 

I didn't put anything in action="". I tried to put the template file or the controller pf my module (.php) but it didn't work.

 

So what I did is that I added <div id="product-tab-content-CustomStampForClient" class="product-tab-content">

<input type="hidden" name="submitted_tabs[]" value="CustomStampForClient" id="myForm"/>
 
ANd this
 
<div class="panel-footer">
<a href="{$link->getAdminLink('AdminProducts')}" class="btn btn-default"><i class="process-icon-cancel"></i>
{l s='Cancel'}
</a>
<button type="submit" name="submitAddproduct" class="btn btn-default pull-right"><i class="process-icon-save"></i>
{l s='Save'}
</button>
<button type="submit" name="submitAddproductAndStay" class="btn btn-default pull-right"><i class="process-icon-save"></i>
{l s='Save and stay'}
</button>
 
And know I have a Save and Stay button. Is it the right way to do it?
 
Or is it also possible to add a custom form? What would be the right "action" for the form? Thanks.
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...