SGuszti Posted August 6, 2020 Share Posted August 6, 2020 I have a module, that displays a link in the ToolbarTopMenu on the Customer details window in the back office. In previous versions of Prestashop I was able to query the Customer ID with the following code: Tools::getValue('id_customer') After upgrading my shop from 1.7.4.2 to 1.7.6.5, the customer detail window has changed, and Tools::getValue('id_customer') returns nothing. How can I get the Customer ID in my modules hook? Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2020 Share Posted August 8, 2020 hookHeader Link to comment Share on other sites More sharing options...
SGuszti Posted August 8, 2020 Author Share Posted August 8, 2020 35 minutes ago, Guest said: hookHeader What do you mean? Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2020 Share Posted August 8, 2020 public function myCustomHook($params) { if ($params){action;} } public function hookHeader () { if (isset (Tools::getValue ('id_customer')) {$this->myCustomHook ((int)Tools::getValue ('id_customer'));} } Link to comment Share on other sites More sharing options...
SGuszti Posted August 8, 2020 Author Share Posted August 8, 2020 1 hour ago, Guest said: public function myCustomHook($params) { if ($params){action;} } public function hookHeader () { if (isset (Tools::getValue ('id_customer')) {$this->myCustomHook ((int)Tools::getValue ('id_customer'));} } The problem is, that in v1.7.6.5 the Tools::getValue ('id_customer') returns nothing. If I turn on Debug mode, than I see a customerId in the Request Attributes, but I don't know, how to access it in the hooks code. As you can see on the screenshot, there is only 1 parameter in GET section, and nothing in the POST. Link to comment Share on other sites More sharing options...
SGuszti Posted August 8, 2020 Author Share Posted August 8, 2020 Finally I found it! The actual customer object is in: $this->context->customer 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now