Amin Hoseiny
Amin Hoseiny

Reputation: 3

Get customer id_default_group in Prestashop

I need to check customer id_default_group in TPL File.

Like

{$cookie->customer_firstname}

But this code

{$cookie->id_default_group} 

doesn't work!

How can I get the ID Group when customer logins?

Upvotes: 0

Views: 6138

Answers (2)

Roberto Minini
Roberto Minini

Reputation: 11

In PS 1.6.15 I use

{Group::getCurrent()->id}

Maybe this will work for you too.

Upvotes: 1

Indrė
Indrė

Reputation: 1136

php

Try this

$this->context->customer->id_default_group; // your variable to be used

or

$context = Context::getContext();
$context->customer->id_default_group; // your variable to be used

.tpl

If you want use it in .tpl first of all you need to pass your variable to your template file writing in php.

$this->context->smarty->assign(array(
    'customer' => $this->context->customer
));

Then use it in .tpl

{if isset($customer->id_default_group)}
    {$customer->id_default_group|intval}
{/if}

Upvotes: 3

Related Questions