English 中文(简体)
获得用户 ID 前台
原标题:Get User ID Prestashop
  • 时间:2012-05-22 16:50:28
  •  标签:
  • prestashop
function get_user_id() 
{
    global $cookie;
    $userid = NULL;

    if (isset($cookie->id_customer))
    {
        $userid = $cookie->id_customer;
    }

    return $userid;
}

为什么用户身份识别即使登录也保持无效返回无效?

问题回答

如果使用 presstashop 1.5 使用 Context 对象代之以 Context 对象:

$this->context->customer->id;

Context::getContext()->customer->id

如果没有从家长班继承的上下文。

$参数[cookie]- & gt; id_ 客户端

并且不应使用全局变量。





相关问题
Noob way to login the user in Prestashop

This is a walkthrough on how to make a user login on prestashop without passing through the login screen. This is helpful if you do not want the user to login again like when you want to transfer his ...

Prestashop no errors / blank page

I m developing a module in PHP for Prestashop and I m having a tough time trying to debug code. Whenever something falls over it doesn t display errors, just a blank page - either on the front end ...

Prestashop Code Blocks

I ve been thrown in at the Prestashop deep end, have a couple of questions and wondered if anyone could help. I need to add fields to a form. This form was marked-up by me, then somehow integrated ...

Presta shop - smarty cache problem

The question is that has anyone setup the presta shop with cache true and compile false smarty options? If this options are enabled nothing is working as it schould the smarty ->assing can be done ...

Prestashop Newsletter Module [closed]

I m looking for the best prestashop newsletter module, that allows me to manage custom newsletter layout and newsletter sending. Has anyone ever used one? Wich one would you recomend? Thanks!

Reconfiguring PHP Mail() Smarty Contact Form

I m using Prestashop as my ecommerce shopping cart and CMS solution and was having problems receiving emails sent via the contact form. I asked around and found the problem to be due to the fact that ...

Prestashop compared to Zen-Cart and osCommerce [closed]

I m considering Prestashop for a new project. It seems to be younger than Zen-Cart and osCommerce. Since I just found it by Google, I d like to gather comments and experience and comparison of ...

热门标签