airakaz900 Posted July 24, 2012 Share Posted July 24, 2012 Bonjour, Je souhaite masquer le module produits phases aux utilisateurs non inscrits, et pour que les utilisateurs puissent voir ce module, ils doivent se connecter, et je ne vois pas comment je dois procéder pour faire cela ? Merci d'avance Link to comment Share on other sites More sharing options...
Reda OULED Posted July 24, 2012 Share Posted July 24, 2012 (edited) Bonjour, Il faut faire 2 modifs: 1. modifier le fichier homefeatured.php Remplacer : function hookHome($params) { global $smarty; $category = new Category(1, Configuration::get('PS_LANG_DEFAULT')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($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'); } par: function hookHome($params) { global $smarty, $cookie; $category = new Category(1, Configuration::get('PS_LANG_DEFAULT')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10)); $smarty->assign(array( 'logged' => $cookie->isLogged(), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize('home'))); return $this->display(__FILE__, 'homefeatured.tpl'); } 2. Modifier le fichier homefeatured.tpl Rajouter avant la div {if $logged} et à la fin {/if} {if $logged} <!-- MODULE Home Featured Products --> <div id="featured-products_block_center" class="block products_block"> ... </div> <!-- /MODULE Home Featured Products --> {/if} Et voilà, le tour est joué ! Edited July 24, 2012 by OEB (see edit history) 1 Link to comment Share on other sites More sharing options...
Reda OULED Posted July 27, 2012 Share Posted July 27, 2012 (edited) Même pas 1 retour pour savoir si ça marche pour vous ou pas ! Vive l'esprit communautaire ! Edited July 27, 2012 by OEB (see edit history) 1 Link to comment Share on other sites More sharing options...
jeckyl Posted July 27, 2012 Share Posted July 27, 2012 Bonjour, Pas besoin de modifier les fichiers php il suffit d'utiliser la variable global suivante : {$logged} Permet de vérifier si le client est connecté, utile pour afficher des éléments uniquement aux visiteurs enregistrés. (ex : {if $logged}Vous êtes connecté{/if} 1 Link to comment Share on other sites More sharing options...
airakaz900 Posted July 31, 2012 Author Share Posted July 31, 2012 Merci beaucoup pour votre réponse OEB, ça marche parfaitement 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