Jump to content

[Module] Random homefeatured (fast loading time)


Recommended Posts

Hello all,

Attached is the homefeatured module which can display 8 random products at a time. Please see the original post for details and the significant line added by rocky:
http://www.prestashop.com/forums/viewthread/49960/P0/general_discussion/so_so_so_so_slow_and_i_cant_figure_why

This is an improved version which will request 8 random products from the database instead of request all products from the database and display only 8 of them. This helps a lot on cutting the homepage loading time.

homefeatured.zip

Share this post


Link to post
Share on other sites

How about this ?
in line 70

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, 8, NULL, NULL, false, true, true, 8); 


i changed with

$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 8), NULL, NULL, false, true, true, ($nb ? $nb : 8)); 


and in line 72

array_splice($products, ($nb ? $nb : 10));


i changed with

array_splice($products, ($nb ? $nb : 8));

Share this post


Link to post
Share on other sites
  • 3 months later...
  • 1 year later...
  • 2 months later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More