Jump to content

How to add a dynamic class to the body element


canelones

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...