Aaron Karp Posted July 1, 2011 Share Posted July 1, 2011 I need to be able to determine what group a customer is in in order to display help text as needed. Specifically, I want users in the "Wholesale" group to see something like "Wholesale prices require a minimum purchase of 10 items" on the product page. There are other group-sensitive bits of information I'd like to show for other groups, so if anyone could tell me a good way to determine the current user's group, I'd really appreciate it. Link to comment Share on other sites More sharing options...
Aaron Karp Posted July 1, 2011 Author Share Posted July 1, 2011 Once again, after searching for quite some time prior to posting this thread, right after I post it I find what I was looking for in the first place. Those looking to make this work, take a look at http://www.prestashop.com/forums/viewthread/74259/general_discussion/solvedhow_to_show_customer_group_name_automatically_at_front_officeTo make it work, I created a new file, specifically /override/classes/FrontController.php, and duplicated the entire init() function from FrontControllerCore.php in it. Within the new override version of the init code, I added rocky's code from the thread linked above after $cookie = new Cookie('ps'); and that enabled me to use {$groupName} in all of my .tpl files.NOTE: In rocky's code, he assigns the group's name to 'groupName', but another poster in the original thread indicated that that variable name may be in use elsewhere. To play it safe, I changed $smarty->assign('groupName', $group->name[intval($cookie->id_lang)]); to $smarty->assign('custGroupName', $group->name[intval($cookie->id_lang)]); and use {$custGroupName} wherever I need it in my templates. It may work fine using just $groupName, but I erred on the side of caution.Thanks to rocky for this and all of his other great work helping others develop in PrestaShop! 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