Jump to content

How to display customers group name on front store?


Recommended Posts

For example, add group name which a specific customer belongs to after logged in:

Welcome, XXX Log out. You are (group name)

 

I found some way to do it but these solutions works in older version

 

I'm using prestashop 1.5.6.1

 

Im so newbie so plz explain it easly :)

 

Thanks in advance.

Sukho

 

 

Link to comment
Share on other sites

Hi thanks for quick reply 

 

I added "'group' => new Group($this->context->customer->id_default_group);"  to php file 

 

so now its look like this now

 

{

if (!$this->active)
return;
 
$this->smarty->assign(array(
       'cart' => $this->context->cart,
'cart_qties' => $this->context->cart->nbProducts(),
'logged' => $this->context->customer->isLogged(),
'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
'group' => new Group($this->context->customer->id_default_group),
                        'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
));
return $this->display(__FILE__, 'blockuserinfo.tpl');
}
 
but i dont know how should i add 'group' to tpl file. this is my tpl
 
<p id="header_user_info">
{if $logged}
<a href="{$link->getPageLink('my-account', true)}" class="account hidden-phone"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
<a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log me out' mod='blockuserinfo'}" class="logout">{l s='Log out' mod='blockuserinfo'}</a>
{else}
<a id="openloginform">{l s='Log In' mod='blockuserinfo'}</a> {l s='or' mod='blockuserinfo'} <a href="{$link->getPageLink('my-account', true)}" class="login">{l s='Create An Account' mod='blockuserinfo'}</a>
{/if}
</p>
</div>
 
So i tried to make
 
<a href="{$link->getPageLink('my-account', true)}" class="account hidden-phone"><span>{$cookie->id_default_group}</span></a>
 
i made this and
 
<a href="{$link->getPageLink('my-account', true)}" class="account hidden-phone"><span>{$cookie->customer_group}</span></a>
 
 
this.
 
but both are not working..
 
Thanks for helping me and plz help this too..
 
sorry about doing dumb..
 
 
 
Edited by Naughtyfox (see edit history)
Link to comment
Share on other sites

  • 1 year later...

you need to assign group object to smarty array in blockuserinfo module Top Hook

 

'group' => new Group($this->context->customer->id_default_group);

 

Hi Vekia, where you take this name "id_default_group"? I like to have a list of all the contexts values. Thanks

Link to comment
Share on other sites

×
×
  • Create New...