{"id":7493,"date":"2019-10-11T08:06:33","date_gmt":"2019-10-11T02:36:33","guid":{"rendered":"https:\/\/www.hiddentechies.com\/blog\/?p=7493"},"modified":"2020-10-09T18:45:08","modified_gmt":"2020-10-09T13:15:08","slug":"prestashop-get-current-logged-in-customer-details","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/prestashop\/prestashop-get-current-logged-in-customer-details\/","title":{"rendered":"Prestashop 1.7 \u2013 Get current logged in customer details"},"content":{"rendered":"<p>In this post I am going to explain how to get current logged in customer details in PrestaShop 1.7.<\/p>\n<p><strong>1) Inside module or controller file (php)<\/strong><\/p>\n<pre class=\"lang:default decode:true \">if ($this-&gt;context-&gt;customer-&gt;isLogged()) {\r\n\t$customerId = $this-&gt;context-&gt;customer-&gt;id;\r\n\t$firstname = $this-&gt;context-&gt;customer-&gt;firstname;\r\n\t$lastname = $this-&gt;context-&gt;customer-&gt;lastname;\r\n\t$email = $this-&gt;context-&gt;customer-&gt;email;\r\n\t\r\n\techo $customerId . \"&lt;br&gt;\";\r\n\techo $firstname . \"&lt;br&gt;\";\r\n\techo $lastname . \"&lt;br&gt;\";\r\n\techo $email . \"&lt;br&gt;\";\r\n\r\n\t\/\/ Do something here\r\n} else {\r\n\t\/\/ Do something here\r\n}<\/pre>\n<p><strong>2) Inside template file (tpl)<\/strong><\/p>\n<pre class=\"lang:default decode:true \">{if $customer.is_logged}\r\n    {$customer.id}\r\n    {$customer.firstname}\r\n    {$customer.lastname}\r\n    {$customer.email}\r\n{\/if}<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"angwp_12010 _ning_cont _ning_hidden _ning_outer _align_center responsive\" data-size=\"custom\" data-bid=\"12010\" data-aid=\"0\" style=\"max-width:800px; width:100%;height:inherit;\"><div class=\"_ning_label _left\" style=\"\"><\/div><div class=\"_ning_inner\" style=\"\"><a href=\"https:\/\/www.hiddentechies.com\/blog?_dnlink=12010&t=1775893658\" class=\"strack_cli _ning_link\" target=\"_blank\">&nbsp;<\/a><div class=\"_ning_elmt\"><img decoding=\"async\" src=\"https:\/\/www.hiddentechies.com\/blog\/wp-content\/uploads\/angwp\/items\/12010\/Banner-2.png\" \/><\/div><\/div><\/div><div class=\"clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>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-&gt;context-&gt;customer-&gt;isLogged()) { $customerId = $this-&gt;context-&gt;customer-&gt;id; $firstname = $this-&gt;context-&gt;customer-&gt;firstname; $lastname = $this-&gt;context-&gt;customer-&gt;lastname; $email = $this-&gt;context-&gt;customer-&gt;email; echo $customerId . &#8220;&lt;br&gt;&#8221;; echo $firstname . &#8220;&lt;br&gt;&#8221;; echo $lastname . &#8220;&lt;br&gt;&#8221;; echo $email&#8230; <\/p>\n<div class=\"actions\"><a href=\"https:\/\/www.hiddentechies.com\/blog\/prestashop\/prestashop-get-current-logged-in-customer-details\/\">Continue Reading<\/a><\/div>\n","protected":false},"author":1,"featured_media":7538,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[221,222,2139],"tags":[629,313,329,331],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7493"}],"collection":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/comments?post=7493"}],"version-history":[{"count":1,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7493\/revisions"}],"predecessor-version":[{"id":7494,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7493\/revisions\/7494"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/7538"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=7493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=7493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=7493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}