Jump to content

[Resolu] - Produit Phare Aleatoire - Ps 1.6


Recommended Posts

Bonjour,

 

j'utilise le module inclus "produit phare" sur PS 1.6

J'ai bien sélectionné l'affichage aléatoire, mais suivant la fréquence de rafraîchissement n'est pas systématique...

Je me retrouve donc avec des produits aléatoires qui ne le sont pas...

 

Comment le corriger?

 

Merci

 

Edited by Jean.M (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

Bonjour
 
Il faut changer dans :
 
votredomaine.com/module/homefeatured/homefeatured.php
 

public function hookDisplayHome($params)
{
if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
{
$this->_cacheProducts();
$this->smarty->assign(
array(
'products' => HomeFeatured::$cache_products,
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
)
);
}


return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());
}

par :

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 : 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');
}
  • Like 2
Link to comment
Share on other sites

Merci @solmicro qui vient de règler un problème non résolu depuis maintenant plus d'un an!!!  :D  :D  :D  :D  :D  :D  :D

 

Je marque le sujet comme résolu en espérant que cela puisse aider d'autres personnes dans mon cas... c'est d'ailleurs étonnant qu'il n'y en est pas plus!

 

Encore merci!

Link to comment
Share on other sites

  • 3 weeks later...
  • 11 months later...

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...