gtonti Posted August 3, 2012 Share Posted August 3, 2012 (edited) If I have 12 products shown in homepage but I have, tipically, 50 products suitable to be shown, how can I do this? My wish is to have 50 or more products in HOME category and 12 of this, random select, shown in homepage each load of the page. It is possible? Prestashop 1.4.8.2 with Prestahop-Alt theme Edited August 3, 2012 by gtonti (see edit history) Link to comment Share on other sites More sharing options...
ysco Posted August 3, 2012 Share Posted August 3, 2012 (edited) Hello gtonti, Yes thats possible, great thanks goes to IWAN1979 for this great fix and his code found here http://iwanmadan.com/prestashop-random-product-listing/. Replace the following code below found in /modules/homefeatured/homefeatured.php $products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); with: $products = $category->getProducts(intval($params['cookie']->id_lang), 1, 100); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } This works perfect on PS 1.4.8.2. as i m also use this on this PS version with succes;) Best regards, ysco.. Edited August 3, 2012 by ysco (see edit history) 1 Link to comment Share on other sites More sharing options...
gtonti Posted August 3, 2012 Author Share Posted August 3, 2012 Very very thank you. Perfect! I don't know how to set this topic as solve, but SOLVED! Link to comment Share on other sites More sharing options...
Premsig.com Posted March 15, 2013 Share Posted March 15, 2013 Anyone know if this will work with 1.5.3? Link to comment Share on other sites More sharing options...
ospnz Posted April 17, 2013 Share Posted April 17, 2013 Hello gtonti, Yes thats possible, great thanks goes to IWAN1979 for this great fix and his code found here http://iwanmadan.com...oduct-listing/. Replace the following code below found in /modules/homefeatured/homefeatured.php $products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); with: $products = $category->getProducts(intval($params['cookie']->id_lang), 1, 100); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } This works perfect on PS 1.4.8.2. as i m also use this on this PS version with succes;) Best regards, ysco.. This work perfectly in PS 1.5.3. Thanks ysco Link to comment Share on other sites More sharing options...
HairMaker.Gr Posted May 7, 2013 Share Posted May 7, 2013 Can i ask if works in all browsers even ie 7-10 version.?? Link to comment Share on other sites More sharing options...
benjamin utterback Posted May 7, 2013 Share Posted May 7, 2013 Hello hairmania, I don't think that these changes will effect the display in browsers, it should work. 1 Link to comment Share on other sites More sharing options...
HairMaker.Gr Posted May 7, 2013 Share Posted May 7, 2013 Thanks for your fast reply!!! Link to comment Share on other sites More sharing options...
benjamin utterback Posted May 7, 2013 Share Posted May 7, 2013 No problem hairmania, make sure to confirm a backup of your store before you change any files! That is rule number 1! Good luck 1 Link to comment Share on other sites More sharing options...
Recommended Posts