Reputation: 21
function get_user_id()
{
global $cookie;
$userid = NULL;
if (isset($cookie->id_customer))
{
$userid = $cookie->id_customer;
}
return $userid;
}
Why the user ID keep return null even with login?
Upvotes: 2
Views: 12060
Reputation: 766
If using Prestashop 1.5 use Context
object instead:
$this->context->customer->id;
or
Context::getContext()->customer->id
If there is no context inherited from parent classes.
Upvotes: 9
Reputation: 2115
$params['cookie']->id_customer
and you shouldnt use global variables.
Upvotes: 0