canelones Posted May 5, 2016 Share Posted May 5, 2016 In a Prestashop 1.6 site I need add a dynamic class to the body element (just in frontend). The class should be 'group-[group-name-id]' where group-name-id is the group name id of the visitor. I found this, but it seems outdated, since it is for PS 1.4:https://www.prestashop.com/forums/topic/179593-adding-category-class-id-to-product-page-body/ Link to comment Share on other sites More sharing options...
canelones Posted May 6, 2016 Author Share Posted May 6, 2016 Anyone? I get this so far:In FrontController.php in folder 'override/classes/controller/' and put in this code class FrontController extends FrontControllerCore { public function init() { parent::init(); $this->context->smarty->assign('group_id', $this->context->customer->getGroups(); } Then open header.tpl file in 'themes/your_theme/' and add code to body class group-{$group_id} It almost works but I get this class "group-array". I need to print all the values of the array like class="group-1 group-2 group-3". Link to comment Share on other sites More sharing options...
Prestachamps Posted May 8, 2016 Share Posted May 8, 2016 Hi, You will have to use {foreach} in tpl for parsing the elements of the array. http://www.smarty.net/docsv2/en/language.function.foreach.tpl Regards, Leo 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