Jump to content

Variable to display total products?


zomex

Recommended Posts

Hello everyone,

I currently have a "we have x products" hardcoded section on my homepage. I'm wondering if there is a variable available to display the total products? I have checked the {debug} variables.

It would also be great to be able to display total brands and categories.

Thanks.

Link to comment
Share on other sites

You mean the total products in your shop?
Regardless of the version I think the easiest way is to code a simple module, hook it to the homepage and use a simple query like SELECT COUNT(id_product) from *prefix*product and return a string, even without template.
Here is how to make a simple module, the video down the page

http://nemops.com/prestashop-modules-course/

Apart from that I doubt there is a variable already available, at least as far as I know.
Or, you can use an override of FrontController.php, using the same query, and then adding the text in any template you choose.

  • Like 1
Link to comment
Share on other sites

Many thanks for your reply.

Yes that is correct, I was wondering if there was a pre-existing variable.

Thanks for confirming there isn't. In this case it makes sense for me to hardcode as there's only a slight time saving to having this dynamic.

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