Jump to content

{if customergroup == 2} ... {/if}


kiamaru

Recommended Posts

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

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

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....

  • Like 1
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...