Issue
I am trying to get the product id of the product that is being edited in BackOffice (products page). The controller used there is AdminProducts. I tried to get the value by using Tools class as we do to get the product id on the front office but that doesn't work here. This is the link that I get on that page and after analyzing you can see there is no product id here. Although 1 is the product id meaning not specified like is done in prestashop 1.6. I am using prestashop 1.7. Any idea how I can get the product id in prestashop 1.7 on the products editing page? Also everything else works like if you use Tools class to get the controller name it will give you AdminProducts, only the product id is not there that is being edited.
http://localhost/prestashop/admin14pm/index.php/product/form/1?_token=eVl4wEOMTc2Jo#tab-hooks
Solution
As you mentionned, the 1
in the url is indeed the product id even if it is not any more mentionned like on PrestaShop 1.6 with id_product=1
And you can get this id on the product page in your BO the same way you did before by using Tools::getValue('id_product')
Answered By - ébewè Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.