Jump to content

How to get the Customer ID in hookDisplayDashboardToolbarTopMenu


SGuszti

Recommended Posts

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

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

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.

2020-08-08.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...