Jump to content

Random display of products in categories Prestashop 1.7.2.x


texxo

Recommended Posts

Hello guys,

i am trying to customize a theme i bought to suit my needs.

My current problem is that when i click on a category, the products are being listed with the same order each time.

I would like for them to be listed randomly but i dont know which file is responsible for this so i go and "touch it".

Any help or direction would be highly appreciated.

Thank you.

Nikos

Link to comment
Share on other sites

Hey, 

i am on 1.6.0.9, 

in /classes/category.php

around line 603: 

public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null)

==> replace  $random = false by $random = true , and also $random_number_products =30 or 50 ..

Hope it ll works

cheers

  • Like 1
Link to comment
Share on other sites

Didn't do the work, even if i put it out from the variables declaration.

Maybe it is also messing up with the options about the products listing from the back office and they are overriding it?

I don't know but it would be really nice to be displaying randomly the products in the categories listings that to always be the same items in same positions.

(gets boring)

 

Link to comment
Share on other sites

  • 3 years later...
On 11/29/2017 at 6:15 AM, col_vert said:

Hey, 

i am on 1.6.0.9, 

in /classes/category.php

around line 603: 

public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null)

==> replace  $random = false by $random = true , and also $random_number_products =30 or 50 ..

Hope it ll works

cheers

Thank you so much dude, code is working :)

Link to comment
Share on other sites

  • 6 months 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...