Jump to content

Question About Custom Theme / Modules


Recommended Posts

Hello,

First time prestashop user. I've copied the default theme and am rebuilding it to look like our current website. My question is for something like a navigation bar, where I want to display links to the different categories, should I make a module and a hook for this specific purpose? From what I've read and seen from other examples different blocks are represented using modules and hooks.

So for example if I want a list of the categories, I would create a blockCategory Module, define a 'display categories' hook, and then in my controller I'd execute the hook, assign the output to a smarty variable ($HOOK_CATEGORIES), and then use the smarty variable in my template file to display the categories.

Assuming that I am understanding that correctly, should I create a new module every time I need a piece of dynamic content in my template? The navigation is going to be in the header, so it will be there on every page, and it seems like I could also just extend the FrontController, add a getNavigation method, and use that instead.

Appreciate any input you can offer. 

Thanks,

Don

 

Link to comment
Share on other sites

Thanks for the reply. I've looked at the block top menu and block categories layout but they generate HTML that does not fit with the custom theme we are using(a bootstrap theme, but not designed for prestashop). For example I have a navigation bar which is an unordered list and need to generate a few list item elements that each hold a link to a category.

 

If I try to use the displayTop hook from the block top menu I get many more elements than just the <li> that I need. So I then I figure I would need to overwrite the template code in the display top template to use the code from our custom theme, or create a new module and try to use the display top block module as a reference for how to pull categories. Perhaps you can tell me which of these methods is better? (Seems like maybe I should be override the module templates in my theme the more I think about it)

Thanks for taking the time to reply.

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