Jump to content

Displaying Group name of logged customer on blockuserinfo (1.6.1.7)


phaaze

Recommended Posts

Hello, 

we are using the 1.6.1.7v, and searching on the whole forum about displaying the group name after the name of the customer, but we have't found a solution or a module to do that.

We are using the transformer theme, I tried to add a smarty string to : blockuserinfo.php on the root module folder because there were no php files on theme/module/blockuserinfo folder.

I added:

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

 

Then I tried to delete the {$cookie->customer_lastname} on blockuserinfo.tpl and nav.tpl on the root blockuserinfo folder and on the nav.tpl on the theme/module/blockuserinfo but nothing happened, it still display the lastname on the userinfo block, so I need to understand were the magic happens.

The idea was to add a string to blockuserinfo.tpl

 

from this:

{if $logged}
<div class="header_user_info">
    <a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
</div>
{/if}
<div class="header_user_info">
    {if $logged}
        <a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Sign out' mod='blockuserinfo'}</a>
    {else}
        <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">{l s='Sign in' mod='blockuserinfo'}</a>
    {/if}
</div>

to this:

 

{if $logged}
<div class="header_user_info">
    <a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
</div>

<div class="header_user_info">

    <p><span>{$cookie->customer_group}</span></p>

</div>
{/if}
<div class="header_user_info">
    {if $logged}
        <a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" rel="nofollow" title="{l s='Log me out' mod='blockuserinfo'}">{l s='Sign out' mod='blockuserinfo'}</a>
    {else}
        <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">{l s='Sign in' mod='blockuserinfo'}</a>
    {/if}
</div>

 

 

 

Edited by phaaze (see edit history)
Link to comment
Share on other sites

A customer can be in more than one group, so you need to decide what to do or show when that happens

as for doing it, I would suggest altering the module so that you obtain the groups the customer belongs to and their names.  Then create a string inside that module code that you want to show in the UI.  Then place that string inside a new smarty variable.  Then change your module template to use that new smarty variable.

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