Search code examples
phpprestashopsmartyprestashop-1.7

Generate admin product route in Prestashop 1.7


I would like to know how to generate the "admin product route" in php using prestashop 1.7.

In my case I got the product id I need and I would like my custom controller redirect me to this given admin product route such as :

admin/index.php/sell/catalog/products/[id_product]?_token=[token]

Is there any solution ?


Solution

  • Use

    Tools::getAdminTokenLite
    

    To get a token (more info here)

    For the admin directory, I gave a tip here: How to get name of admin folder in prestashop?

    For example use scandir in the root directory of prestashop, then scandir all the directories you find, looking for "get-file-admin.php" or any admin-specific file, and you're done.