thelicker63 Posted December 31, 2012 Share Posted December 31, 2012 I am using version 1.5.2. I have set my featured to 8, and these do list proudly on my homepage. I am wondering if there is a way to change at random the images which get listed. Example, if I open my site in firefox and my site in IE, I will not show the exact same images, image position etc. I would like these 8 to say be pulled (used) from all the new images/products. Example if at one time I have added 20 products, it will choose 8 from them, then say tomorrow, I add another 50, for a total of 70. How may I get it to random featured products from the total 70 and not just the first 20 I added? I did follow the steps from here...http://mypresta.eu/en/art/tips-and-tricks/how-to-display-products-randomly-in-prestashop-home-featured-module.html and this only randomizes the order of the 8 which are already there. Thankx for the help in advance... Link to comment Share on other sites More sharing options...
razaro Posted January 1, 2013 Share Posted January 1, 2013 Try this. Instead code $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); shuffle($products); use $products = $category->getProducts((int)Context::getContext()->language->id, 1, 100); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } This part of code first gets 100 products, randomize it's order and then takes defined set of products. Note that if you have noticeable performance issues decrease number of products (here is 100 just for example). 4 Link to comment Share on other sites More sharing options...
thelicker63 Posted January 1, 2013 Author Share Posted January 1, 2013 Appears to work like a charm...TY muchly Link to comment Share on other sites More sharing options...
touchdez Posted June 12, 2013 Share Posted June 12, 2013 (edited) Thank you - it works perfectly! Edited June 12, 2013 by touchdez (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 12, 2013 Share Posted June 12, 2013 i know also free module for this: http://www.prestashop.com/forums/topic/238176-module-random-homefeatured/ Link to comment Share on other sites More sharing options...
dianapp Posted June 14, 2014 Share Posted June 14, 2014 hi all, I changed my homefeatured.php file like razaro said and it works great! (I just changed 100 to 50) thank you so much! Link to comment Share on other sites More sharing options...
sorina Posted August 26, 2016 Share Posted August 26, 2016 I use version 1.6.1.6 but none of the above solutions work. I want to have enabled cache and run random products on homefeatured. you have other ideas? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts