pasta.pesto Posted November 12, 2009 Share Posted November 12, 2009 Bonjour,j'ai bricolé le bloc nouveau produits pour qu'il m'affiche toutes les photos de mes articles, il s'affiche donc partout, le problème c'est que ça ne m'intéresse pas qu'il s'affiche sur la page ou l'on voit déjà tous les produit c'est redondant ...En résumé j'aimerais qu'il s'affiche partout sauf sur : http://*****/category.php?id_category=2 j'ai déjà essayé de mettre "category.php?id_category=2" mais ça n'est pas pris en compte cela c'est comme si je mettais rienJe pense qu'il y a truc à bricolé dans le fichier blocknewproducts.php un etst pour vérifier si url=??? alors on affiche pas le bloc mais je ne sais pas comment récupérer l'urlJ'ai un début de réponse ici : Liendonc le code ressemblerais à ça (merci yoya971 ) : global $cookie; $tmpCust = new Customer(intval($cookie->id_customer)); if(!$tmpCust->isMemberOfGroup(2)) return false; si quelqu'un a une idée --------------------------------------------------------------------------------------------------------------------------------Edit : Bon ba j'ai tenté ça en farfouillant les variable du mode debug et ça à l'air de marché je continue de tester je mettrais résolu quand je suis sûre :Fichier blocknewproducts.phpRajouté au début et à la fin : {if $id_category != 2} le code pour le bloc {/if} Link to comment Share on other sites More sharing options...
Laurent71 Posted April 13, 2010 Share Posted April 13, 2010 Bonjour,Je suis dans le même cas de figure.Votre solution fonctionne t'-elleSi oui, où placez vous le code?Merci par avance,Laurent<?phpclass BlockNewProducts extends Module{ private $_html = ''; private $_postErrors = array(); function __construct() { $this->name = 'blocknewproducts'; $this->tab = 'Blocks'; $this->version = 0.9; parent::__construct(); $this->displayName = $this->l('New products block'); $this->description = $this->l('Displays a block featuring newly added products'); } function install() { if (parent::install() == false OR $this->registerHook('rightColumn') == false OR Configuration::updateValue('NEW_PRODUCTS_NBR', 5) == false) return false; return true; } public function getContent() { $output = ' '.$this->displayName.''; if (Tools::isSubmit('submitBlockNewProducts')) { if (!$productNbr = Tools::getValue('productNbr') OR empty($productNbr)) $output .= ''.$this->l('You should fill the "products displayed" field').''; elseif (intval($productNbr) == 0) $output .= ''.$this->l('Invalid number.').''; else { Configuration::updateValue('NEW_PRODUCTS_NBR', intval($productNbr)); $output .= ' l('Confirmation').'" />'.$this->l('Settings updated').''; } } return $output.$this->displayForm(); } public function displayForm() { $output = ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post">_path.'logo.gif" alt="" title="" />'.$this->l('Settings').''.$this->l('Products displayed').' <input type="text" name="productNbr" value="'.intval(Configuration::get('NEW_PRODUCTS_NBR')).'" />'.$this->l('Set the number of products to be displayed in this block').' <input type="submit" name="submitBlockNewProducts" value="'.$this->l('Save').'" class="button" /> </form>'; return $output; } function hookRightColumn($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(array( 'new_products' => $new_products, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blocknewproducts.tpl'); } function hookLeftColumn($params) { return $this->hookRightColumn($params); }}?> Link to comment Share on other sites More sharing options...
pasta.pesto Posted April 13, 2010 Author Share Posted April 13, 2010 Oui ça fonctionne parfaitement Editer le fichier "blocknewproducts.tpl" et vous mettez {if $id_category != 2} en 1ère ligne et {/if} en dernière ligne Link to comment Share on other sites More sharing options...
Laurent71 Posted April 13, 2010 Share Posted April 13, 2010 Merci infiniment pour votre réponse aussi rapide.Testé et approuvé...Bonne fin de journée 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