Jump to content

Is it possible to shuffle products?


Recommended Posts

Hello!

 

Maybe there is a way to shuffle products ?

I mean shuffle chaotic order in which products are displayed !

 

I found that there is option in control panel > catalog >products ,,there you can change position manually with arrows up and down ! But it is very complicated to change all products position !

 

Is there another way?

 

Thanks ! :)

Edited by johnxl (see edit history)
  • Like 1
Link to comment
Share on other sites

Category::getProducts accepts a bool value for the random options. So, if you want to display random products in category, I would create a category controller override. Locate the call to getProducts and add TRUE to the random variable.

Link to comment
Share on other sites

Ccontrollers/categoryController.php

 

line 193:

 

$this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay);

 

Change it into

$this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay, false, true, true);

 

The last parameter is for random

Link to comment
Share on other sites

but what with pagination in this case? i never tested it so just want to ask about that.

For example, with shuffle effect turned on, while browsing the pages of category i can see the same product several times?

Am I right?

Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...