Jump to content

[resolvido]Home com produtos aparecendo aleatoriamente.


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...