Jump to content

How to get id_product in displayBackOfficeHeader in PS


Recommended Posts

In 1.6 it was easy to get id_product like this:


In previous versions of 1.7 it was more complicated, but still possible:

global $kernel;
$id = $kernel->getContainer()->get('request')->get('id');

But in PS it doesn't work. So, is there any standard way to get ID of current product, except relying on $SERVER['REQUEST_URI']?

Link to comment
Share on other sites

  • 2 weeks later...

You can use the hookDisplayAdminProductsExtra() function instead of hookDisplayBackOfficeHeader() function to find the id_product and then perform the necessary action. 

public function hookDisplayAdminProductsExtra($params)
        $id_product = $params['id_product'];
        if (!$id_product) {
        } else {
           //perform action

Hope it will help.
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...