paulormf Posted September 17, 2013 Share Posted September 17, 2013 (edited) good night in my homefeatured, I put to appear randomly, but they do not change, just change positions, can anyone help me? prestashop 1.5.5.0 Thanks! Edited September 18, 2013 by paulormf (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 17, 2013 Share Posted September 17, 2013 have you tried this module? http://www.prestashop.com/forums/topic/238176-module-random-homefeatured/ Link to comment Share on other sites More sharing options...
paulormf Posted September 17, 2013 Author Share Posted September 17, 2013 have you tried this module? http://www.prestashop.com/forums/topic/238176-module-random-homefeatured/ tks vekia, but the link is giving error :/ I searched google but all the links point to the same place .. Link to comment Share on other sites More sharing options...
paulormf Posted September 18, 2013 Author Share Posted September 18, 2013 tks vekia, but the link is giving error :/ I searched google but all the links point to the same place .. --- Solved changing /modules/homefeatured/homefeatured.php type hookDisplayHome function: public function hookDisplayHome($params) { global $smarty; $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); /*$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));*/ $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10), 'date_add', 'DESC', false, true, true, $nb); shuffle($products); $this->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize('home_default'), )); return $this->display(__FILE__, 'homefeatured.tpl'); } Link to comment Share on other sites More sharing options...
vekia Posted September 18, 2013 Share Posted September 18, 2013 so you added shuffle function? Link to comment Share on other sites More sharing options...
paulormf Posted September 18, 2013 Author Share Posted September 18, 2013 (edited) so you added shuffle function? --- I do not quite understand how it works, but basically that was it. I think the solution to my case was the code "$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10), 'date_add', 'DESC', false, true, true, $nb);" It worked well. Edited September 18, 2013 by paulormf (see edit history) 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