Manu-41 Posted September 14, 2018 Share Posted September 14, 2018 Bonjour, je cherche une solution pour un module qui affiche les promotions, mais quand il n y a pas de promo, le bloc s'affiche quand même. Comment faire pour ne pas afficher ce block quand il n y a pas de promo? presta 1.6 merci pour votre aide Link to comment Share on other sites More sharing options...
Eolia Posted September 14, 2018 Share Posted September 14, 2018 Modifier le code du module^^ Mais normalement il ne devrait pas if (BlockSpecials::$cache_specials === false) return false; Link to comment Share on other sites More sharing options...
Manu-41 Posted September 14, 2018 Author Share Posted September 14, 2018 (edited) 2 hours ago, Eolia said: Modifier le code du module^^ Mais normalement il ne devrait pas if (BlockSpecials::$cache_specials === false) return false; Je n'ai pas cette ligne, dans le fichier php. ce n'est pas le module d'origine, c'est un module qui n'est plus suivie qui propose l'affichage des nouveauté, meilleure vente et promo. Le problème, c'est que quand il n y a pas de nouveautés, ou promos, le titre nouveau ou promo s'affiche quand même. Edited September 14, 2018 by Manu1238 (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted September 15, 2018 Share Posted September 15, 2018 Dans le module d'origine: public function hookDisplayHomeTab($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('tab.tpl', $this->getCacheId('blockspecials-tab'))) BlockSpecials::$cache_specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR')); if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockspecials-tab')); } public function hookDisplayHomeTabContent($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('blockspecials-home.tpl', $this->getCacheId('blockspecials-home'))) { $this->smarty->assign(array( 'specials' => BlockSpecials::$cache_specials, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'blockspecials-home.tpl', $this->getCacheId('blockspecials-home')); } Inspirez vous de ce code dans votre module. Si pas de résultats, return false; 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