Doccc010 Posted March 12, 2013 Share Posted March 12, 2013 Bonjour, J'ai modifié mon fichier blocknewproducts.php afin de pouvoir mettre le module sur ma Home. Le problème c'est que j'utilise cette fonction : public function hookHome($params){ return $this->hookRightColumn($params); } Et qu'elle retourne bien mon module sur la Home : Nouveaux produit avec un bouton en dessous : Tous les nouveaux produits. Je n'arrive pas à faire une fonction pour retourner les nouveaux produits directement sur la page d'accueil et ne pas avoir à cliquer sur le bouton et aller sur une autre page Merci de votre aide Link to comment Share on other sites More sharing options...
webpulser Posted March 12, 2013 Share Posted March 12, 2013 Bonjour, Je ne saisis pas tout ton problème. Tu as juste un bouton "les nouveaux produits" ? As tu bien enregistrer le hook dans l'install de blocknewproducts ( $this->registerHook('home') ) ? Puis réinstaller le module. Link to comment Share on other sites More sharing options...
Doccc010 Posted March 12, 2013 Author Share Posted March 12, 2013 Bonjour, Merci pour la réponse, actuellement j'ai sa qui s'affiche (voir PJ) et quand je clique sur le bouton, j'ai mes nouveaux produits. Je souhaiterais afficher directement sur ma page les nouveaux produits. J’espère que mes explications seront plus clair ! Merci Link to comment Share on other sites More sharing options...
webpulser Posted March 12, 2013 Share Posted March 12, 2013 Dans Prestashop 1.5, le hook se nomme DisplayHome. A l'install : $this->registerHook('displayHome') == false et la fonction public function hookDisplayHome($params) Link to comment Share on other sites More sharing options...
Doccc010 Posted March 12, 2013 Author Share Posted March 12, 2013 C'est ce que j'ai fait et tu met quoi comme fonction pour afficher directement les nouveaux produits ? Merci Link to comment Share on other sites More sharing options...
Doccc010 Posted March 13, 2013 Author Share Posted March 13, 2013 J'ai testé : public function hookDisplayHome($params){ global $smarty; $currency = new Currency(intval($params['cookie']->id_currency)); $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, Configuration::get('NEW_PRODUCTS_NBR')); $new_products = array(); if ($newProducts) foreach ($newProducts AS $newProduct) $new_products[] = $newProduct; $smarty->assign('new_products', $new_products); return $this->display(__FILE__, 'blocknewproducts.tpl'); } Mais cela me retourne une miniature, avec la description en dessous + le bouton : " Tous les nouveaux produit. Pour l'instant, je n'arrive pas à avoir la même mise en page que "Featured product" Link to comment Share on other sites More sharing options...
webpulser Posted March 13, 2013 Share Posted March 13, 2013 Pour ma part, j'ai ceci et ca fonctionne. public function hookRightColumn($params) { $newProducts = Product::getNewProducts((int)( $params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); if (!$newProducts && !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; $this->smarty->assign(array( 'new_products' => $newProducts, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); return $this->display(__FILE__, 'blocknewproducts.tpl'); } Link to comment Share on other sites More sharing options...
Doccc010 Posted March 13, 2013 Author Share Posted March 13, 2013 Je dois avoir un problème de css car la présentation est vraiment pas chouette Je vais regarder 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