PEPPE83 Posted December 29, 2015 Share Posted December 29, 2015 Hello, like the topic title, is possible randomize or shuffle the products showed in the standard "productscategory" module? Thank you. Link to comment Share on other sites More sharing options...
PEPPE83 Posted January 6, 2016 Author Share Posted January 6, 2016 bump Link to comment Share on other sites More sharing options...
vekia Posted January 6, 2016 Share Posted January 6, 2016 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 1 Link to comment Share on other sites More sharing options...
joe ramires Posted September 25, 2016 Share Posted September 25, 2016 On ps 1.6.0.14 it doesn't work. Shows only one product. Link to comment Share on other sites More sharing options...
vekia Posted September 26, 2016 Share Posted September 26, 2016 On ps 1.6.0.14 it doesn't work. Shows only one product. if it shows only one product, maybe the category that are selected has only one product ? Link to comment Share on other sites More sharing options...
joe ramires Posted September 26, 2016 Share Posted September 26, 2016 Of course not. Selected category has a lot of products. Link to comment Share on other sites More sharing options...
vekia Posted September 26, 2016 Share Posted September 26, 2016 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 More sharing options...
originmad Posted August 11, 2017 Share Posted August 11, 2017 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. 1 Link to comment Share on other sites More sharing options...
joe ramires Posted September 4, 2018 Share Posted September 4, 2018 @originmad - it works like a charm ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now