kiamaru Posted February 13, 2013 Share Posted February 13, 2013 Hello if a good soul to the solution to give me to tell me what files to modify codes and a provider of 1.5.3 so that I can add the tpl code like: {if customergroup == 2} ... {/ if} to render visible parts as a group. that I would remove a thorn from my foot thank you Link to comment Share on other sites More sharing options...
ebonit Posted February 13, 2013 Share Posted February 13, 2013 first of all, your smarty code is wrong. it should be {if $customergroup == 2} ... {/ if} you forgot the $-sign for the variable. Link to comment Share on other sites More sharing options...
kiamaru Posted February 13, 2013 Author Share Posted February 13, 2013 hi he was just an example. i do not anything yet. i'm looking for the code and the files to change in presta 1.5.3.1 for do this have you an idea to do that? Link to comment Share on other sites More sharing options...
ebonit Posted February 13, 2013 Share Posted February 13, 2013 your question is not totally clear. What information do you want to show in that customer group and, more important maybe, where do you want to show that, frontend or backend, what page? another thing is that you are not supposed to change the core files since updating will destroy your changes. you should write your own code in the overrides or make your own module that does what you want. Link to comment Share on other sites More sharing options...
Paul C Posted February 13, 2013 Share Posted February 13, 2013 The problem would be that customers can be in more than one group, so what would you expect to happen if the group you're testing isn't their default group... ? Link to comment Share on other sites More sharing options...
kiamaru Posted February 13, 2013 Author Share Posted February 13, 2013 hi i need to hide some part of website to other group Link to comment Share on other sites More sharing options...
Paul C Posted February 13, 2013 Share Posted February 13, 2013 Well, what you should do is override the FrontController class and pass the current customer's DEFAULT group to the smarty variable. e.g. <?php // Place the following in: <install-root>/override/classes/controller/FrontController.php class FrontController extends FrontControllerCore { function init() { parent::init(); if (isset($this->context->customer->id) && $this->context->customer->id != 0) { $default_group = Customer::getDefaultGroupId($this->context->customer->id); } else { $default_group = 0; } $this->context->smarty->assign('customergroup', $default_group); } } You can now test this variable on ANY page on the site.... 1 Link to comment Share on other sites More sharing options...
kiamaru Posted February 15, 2013 Author Share Posted February 15, 2013 Amazing thanks a lot. it's Work. 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