Jump to content

Question regarding multipage module development/architecture


affect
 Share

Recommended Posts

Hi,

I've started developing modules for PrestaShop recently. I've seen some generic unofficial module creation guides, but those mostly cover just basics, which I've understood. I've created a simple module that gives scores to categories based on viewed and sold product count and then displays the most popular categories on home page. It's basically one php file, three default hooks and one template file.

But let's say I want to develop a question/answer module that will display a question input field in the left column and then store the question in the database, allowing administrator to answer it. Besides, questions and answers will be displayed on a separate page in the center column.

So, if I understand the structure correctly, I need main files besides stylesheets and translations like this:

-- modulename.php (that contains install(), uninstall() and other routines)

-- modulename-left.tpl (question input field template that gets hooked to the left column)

-- submit.php file that handles redirects from modulename-left.tpl, inserts questions in the database and redirects visitors to question list template

-- questionlist.tpl that outputs all the questions in the center column

-- ..or perhaps some class to handle it all?

The main issue for me is how to put it all together. I've seen different modules doing it in different ways and I'm not sure what's the right way to do it. Should I put all the files inside my module directory? What's the correct way to add redirects (for example from "submit question" button to the question list page? How do I make question list page appear in the center column? What will be the URL of this page (so I can put a redirect to it in different places)? I'd really appreciate if you clear things up for me (couldn't find any docs covering it all).

Thanks

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More