[英]How to add another action button in prestashop 1.6.1.3 back end list/grid view panel
[英]How to get user id session in prestashop 1.6.1.3
用户ID的字段名称是id_customer,我正在使用prestashop 1.6.1.3,我已经对此进行过尝试
$id = $this->context->customer->id_customer;
这个
$id = (int)$this->context->cookie->id_customer;
这个
if ($this->context->customer->isLogged()) {
echo $this->context->customer->id_customer;
}
else{
echo 'Not LoggedIn';
}
和这个
$id_customer = null;
if ($this->context->customer->isLogged()) {
// code to execute if i am logued
$id_customer = $this->context->customer->id;
}
但它不起作用...,有人可以帮助我吗? 谢谢
*另外,如果您有tpl函数来获取ID会话,请告诉我。
而不是调用$this
,这取决于您正在使用的控制器/模块。 您可以像这样直接调用单例Context
对象:
if (Context::getContext()->customer->id)
{
$id_customer = Context::getContext()->customer->id;
}
else
{
$id_customer = false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.