danmikkelsen Posted June 13, 2011 Share Posted June 13, 2011 I can't really find many global variables except a page that has 20 or so (it's also in this forum)But if a user is logged in, I need to know his user id and which groups he belongs to. Link to comment Share on other sites More sharing options...
Asenar Posted June 13, 2011 Share Posted June 13, 2011 Hi,it's depends on which page you are maybe, here some you can have everywhere (or almost)$cookie->id_customer maybe.For the group, you can use $customer->getGroups() or Customer::getGroupsStatic($id_customer); but you can find better, sorry I don't remember exactly. 1 Link to comment Share on other sites More sharing options...
danmikkelsen Posted June 13, 2011 Author Share Posted June 13, 2011 Those worked perfectly! Thanks Link to comment Share on other sites More sharing options...
robinos Posted November 17, 2011 Share Posted November 17, 2011 Can you explain more precisely what did you do? I see those lines in the class product.php but i don't know how to use it... Link to comment Share on other sites More sharing options...
Jupiterr Posted February 8, 2012 Share Posted February 8, 2012 I used this on the override FrontController.php (attached). You should copy the entire FrontController.php and paste it on /override/classes/FrontController.php. Paste the following code on line 32. This checks if a user is on certain group. $customer = new Customer(intval($cookie->id_customer)); /* The group (number 1, in this case) you want to check */ $specificGroup = $customer->isMemberOfGroup(1); $smarty->assign('customerGroup', $specificGroup); I created the "customerGroup" variable and I used it on the blockcategories.tpl file to show another categories block with only certain categories (the ones who's have a special discount). As you can see, I wanted to show categories 22, 23 and 24. {if $customerGroup} <div id="categories_block_left" class="block"> <h4>{l s='Categories' mod='blockcategories'}</h4> <div class="block_content"> <ul class="tree {if $isDhtml}dhtml{/if}"> {foreach from=$blockCategTree.children item=child name=blockCategTree} {* If the category is 22, 23 or 24, show it *} {if $child.id==22 || $child.id==23 || $child.id==24} {if $smarty.foreach.blockCategTree.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child} {/if} {/if} {/foreach} </ul> {* Javascript moved here to fix bug #PSCFI-151 *} <script type="text/javascript"> // <![CDATA[ // we hide the tree only if JavaScript is activated $('div#categories_block_left ul.dhtml').hide(); // ]]> </script> </div> </div> {/if} Good luck. Note: It worked perfectly with 1.4.5.1, but with 1.4.6.2 it throws a warning and I get it working just by adding the code directly to the FrontController.php file (and not the override one). Anyway, this is the wrong way FrontController.php 2 Link to comment Share on other sites More sharing options...
lain Posted May 6, 2013 Share Posted May 6, 2013 Thank you Jupiterr! 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