Php prestashop 1.6-检查用户是否在组中

Php prestashop 1.6-检查用户是否在组中,php,smarty,prestashop,prestashop-1.6,Php,Smarty,Prestashop,Prestashop 1.6,在PS 1.6中,我尝试使用以下方法检查用户是否在id为6的组中: 控制器: 'hisGroup' => ($this->context->customer->logged AND (Customer::getDefaultGroupId((int)$this->context->customer->id) == 6) ? true : false) 第三方物流: 虽然它不起作用。你知道为什么吗?试着这样做: $some = $this->con

在PS 1.6中,我尝试使用以下方法检查用户是否在id为6的组中:

控制器:

'hisGroup' => ($this->context->customer->logged AND (Customer::getDefaultGroupId((int)$this->context->customer->id) == 6) ? true : false)
第三方物流:

虽然它不起作用。你知道为什么吗?

试着这样做:

$some = $this->context->customer->logged AND (Customer::getDefaultGroupId((int)$this->context->customer->id));
$this->context->smarty->assign('hisGroup', $some);
第三方物流:

{if $hisGroup == 6} ... {/if}
试着这样做:

$some = $this->context->customer->logged AND (Customer::getDefaultGroupId((int)$this->context->customer->id));
$this->context->smarty->assign('hisGroup', $some);
第三方物流:

{if $hisGroup == 6} ... {/if}

使用此代码,您将检查客户的默认组。 若要检查客户是否在独立于默认组的组中,请尝试以下操作

'inCustomerGroup' => in_array(4, Customer::getGroupsStatic($this->context->cart->id_customer)) ? true : false,

使用此代码,您将检查客户的默认组。 若要检查客户是否在独立于默认组的组中,请尝试以下操作

'inCustomerGroup' => in_array(4, Customer::getGroupsStatic($this->context->cart->id_customer)) ? true : false,

一个简单的答案是使用{Group::getCurrent()->id}。使用prestashop 1.6进行测试+
希望能帮助其他人

一个简单的答案是使用{Group::getCurrent()->id}。使用prestashop 1.6进行测试+ 希望能帮助别人