Cassiano Aquino Posted March 17, 2014 Share Posted March 17, 2014 (edited) Entrei no post abaixo ( em inglês );http://www.prestashop.com/forums/topic/164821-random-product-display-on-featured-page/page-4?do=findComment&comment=1594984Para resolver um "problema" na minha instalação do prestashop (1.5.6.2), e lendo as dicas dos moderadores e usuários, cheguei na seguinte solução; public function hookDisplayHome($params) { $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 : 8), "position"); if ($products) { shuffle($products); array_splice($products, ($nb ? $nb : 10)); } $this->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), )); return $this->display(__FILE__, 'homefeatured.tpl'); } Estou aberto a sugestões e melhorias da solução. Edited March 17, 2014 by Cassiano Aquino (see edit history) Link to comment Share on other sites More sharing options...
exadra37 Posted March 18, 2014 Share Posted March 18, 2014 Bem vindo á nossa comunidade @Cassiano Aquino Se pesquisar na nossa comunidade, essa questão e solução já foi apresentada diversas vezes... Obrigado na mesma pela dica e boa intenção demonstrada 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