PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 26, 2022

[FIXED] How to get product id on Product Editing page in BackOffice Prestashop 1.7

 October 26, 2022     prestashop-1.7     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing