Jump to content

Random Product Listing


Recommended Posts

Hi,


 


I use prestashop version 1.5.6.1 and I am looking to configue all product-listing types to Random. I mean in category, search or home. Sadly there is no option for this on admin yet.  How can i do it? I found solutions for some older versions but 1.5.x classes are different.  


 


Please help


 


Ergin,


Link to comment
Share on other sites

hello

 

it's not good idea. why? if product will be displayed randomly, some of them will not be displayed at all, some of them will appear several times on different pages (pagination).

To display products randomly you have to change code of categoryController a little.

there is a code:
 

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

you have to change it to:

$this->cat_products = $this->category->getProducts($this->context->language->id, (int)$this->p, (int)$this->n, $this->orderBy, $this->orderWay,false,true,true);
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...