crespim Posted November 16, 2013 Share Posted November 16, 2013 Como posso colocar os produtos na home para aparecerem randomicamente? Link to comment Share on other sites More sharing options...
crespim Posted November 18, 2013 Author Share Posted November 18, 2013 Usei na 1.5.6...public function hookDisplayHome($params){global $smarty;$category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT'));$nb = (int)(Configuration::get('HOME_FEATURED_NBR'));$products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10));shuffle($products);$products = array_slice($products, 0, ($nb ? $nb : 10));$smarty->assign(array('products' => $products,'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),'homeSize' => Image::getSize('home')));return $this->display(__FILE__, 'homefeatured.tpl');} http://customizarts.com.br/loja/ Link to comment Share on other sites More sharing options...
FelipeGallo Posted November 20, 2013 Share Posted November 20, 2013 (edited) Em qual arquivo vc usou esse código? EDIT: Achei aqui, é no homefeatured.php, só inserir o shuffle($products); Shuffle serve para combinar aleatóriamente valores de um array. Falow Edited November 20, 2013 by FelipeGallo (see edit history) Link to comment Share on other sites More sharing options...
aldoscully Posted November 22, 2013 Share Posted November 22, 2013 Bom dia, pessoal. Pra mim ate deu certo na versao que uso 1.5.6 mas fica randomicamente somente os produtos de uma categoria.. minhas outras categorias nao aparecem.. alguem sabe o que pode ser?? 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