Jump to content

Link to specific tab in back office


Recommended Posts

I'm currently in the process of updating a module which is not supported for Prestashop 1.5 (we purchased it before realising), and I am most of the way there. However, I am having issues figuring out how to refresh a specific tab on the Products page [back office] (that is, when a product is selected for editing). I have tried adding &action=[TabName] to the URL (along with all of the other relevant information like controller and &updateproduct), which I even copied straight from the URLs each of the tabs actually link to. The links still default back to the "Information" tab when I load the page.

 

My question is, is there a built in ajax call to refresh a specific tab without reloading the entire page and defaulting back to the "Information" tab; and if not, how do I create a link that will allow me to post back to the same page and default to a specific tab?

 

Thanks in advance.

 

*Edit*

 

I found that &key_tab=[Tab Name] posts back to the same tab, so that appears to be the solution I was after.

Edited by Jarred Mack (see edit history)
Link to comment
Share on other sites

As an update, I was looking through the other product tabs to see if any pages had similar functionality, and I came across the Suppliers page which tells the user to click "Save and Stay" to refresh the page, which then refreshes and loads the correct tab. I will look for the Save and Stay code now and see if I can use that; does anyone happen to know where that code lives?

Link to comment
Share on other sites

I've run into another issue now... the module is currently using echo statements to print out the form data, so when I load directly to the tab, this data is just being dumped at the top of the page. What do I have to assign the form data to in order to get it to print inside the form like the other products tabs?

 

*Edit*

 

The hook is actually trying to assign the form data to tpl_form_vars['custom_form'], so I've solved this issue by returning my output to the hook instead of echoing in the module itself.

 

This is currently "working", but I have run into another issue. When I click a link to post back to the module tab, it processes correctly and displays the form as expected. However, if I click on the form field, the onClick event deletes the value in the key_tab hidden field, sets the module to display: none, and breaks the JS on the rest of the page. Any ideas?

Edited by Jarred Mack (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...