Jump to content

How To Shuffle Products In The "productscategory" Module?


PEPPE83

Recommended Posts

in module file near line 130 you can find something like:

$category_products = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */

try to change it to:

$category_products = $category->getProducts($this->context->language->id, 1, 100,null,null,null,true,true); /* 100 products max. */

the last "true" reffers to getProducts function param "random" - if we will set to true, prestashop will get random products

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

so it should display more products, i checked it in my 1.6.0.14 test environment and it works.

let's  clarify. module displays products from category that is a default category of viewe product, products from other categories are not included to the list of products.

can you please share link to product page where you've got the problem?

Link to comment
Share on other sites

  • 10 months later...

in module file near line 130 you can find something like:

$category_products = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. */

try to change it to:

$category_products = $category->getProducts($this->context->language->id, 1, 100,null,null,null,true,true); /* 100 products max. */

the last "true" reffers to getProducts function param "random" - if we will set to true, prestashop will get random products

 

 

Vekia solution is right but missed one parameter:

 

You need to specify the number of random products if you set random products to "true"

 

$random_number_products Number of products to return if random is activated

$category_products = $category->getProducts($this->context->language->id, 1, 100,null,null,null,true,true,100); /* 100 products max. */

will work.

 

It's been too long but someone may need this.

 

 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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