In this post I am going to explain how to get current logged in customer details in PrestaShop 1.7.
1) Inside module or controller file (php)
if ($this->context->customer->isLogged()) {
$customerId = $this->context->customer->id;
$firstname = $this->context->customer->firstname;
$lastname = $this->context->customer->lastname;
$email = $this->context->customer->email;
echo $customerId . "<br>";
echo $firstname . "<br>";
echo $lastname . "<br>";
echo $email . "<br>";
// Do something here
} else {
// Do something here
}2) Inside template file (tpl)
{if $customer.is_logged}
{$customer.id}
{$customer.firstname}
{$customer.lastname}
{$customer.email}
{/if}
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!



May 6, 2020 at 12:20 pm
Thank you so much for sharing such a useful information.