0
用戶ID的字段名稱是id_customer和我使用的Prestashop 1.6.1.3 我已經嘗試過這個如何獲得的Prestashop用戶ID會話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;
}
但它不工作...,有人可以幫助我嗎? thx
*如果你有一個tpl函數來獲得id會話,請告訴我。
:您可以直接調用單
Context
對象這樣的'$這個 - >上下文>客戶 - > ID;'你可以轉儲'$這個 - >上下文> customer' OT甚至' $ this-> context'或'$ this' – 2016-06-08 02:15:53@Dagon是這樣的嗎? $ id = $ this-> context-> customer-> id; echo $ id; –
不問,如果你可以測試它。 – 2016-06-08 02:18:00