Jump to content

How to display sub-lists in admin area?


codeburger

Recommended Posts

I am writing a PS 1.6 module which uses two custom database tables, let's call them "mymodule" and "mymodule_element". for each "mymodule" entry there can be several "mymodule_element" entries.

 

I successfully created an AdminController (attached to a back office admin tab) to display the list of "mymodule" entries. I also enhanced the list view to enable the user to view the entry detail and the add/edit form. So far everything is by the book.

 

But now I'd like to display a list of "mymodule_elements" on the detail page (all entries attached to this specific "mymodule" entry). I want to enabe the user to add "mymodule_element" entries to the "mymodule" entry. What is the best / most elegant way to code this with PrestaShop 1.6?

Link to comment
Share on other sites

I'd use a custom method from your module, called from the displayForm method that's triggered on clicking each Mymodule element.

Use that to grab all mymodule_element entries from the table, where the mymodule_id matches. Then, I'd write an add method in the postProcess function, which lets your users add their own entry

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...