Jump to content
Kegon

How to generate/get AdminProducts token in PrestaShop 1.7.x

Recommended Posts

Hi

I am trying to develop a module to help list products in various situations. How do I generate a token for at direct product link with PS 1.7.x? I can't seem to find any examples that helps.

I can generate tokens for customers and other stuff which works - and those tokens seems to be md5, but the tokens for AdminProducts seems to be another type of hash, like "HK5Z6KMpx_EP6-ykNM2Ju1QAkOqlFmskolAe3IXt8ss". Any help anyone?

Thanks for your answer.

Share this post


Link to post
Share on other sites

Hi, did you succeed with your issue? I'm currently having very similar problem, as I need to send my token from AdminProducts to my custom controller and I always receive token validation error in response.

Share this post


Link to post
Share on other sites

Hello, can anyone provide some informations on this subject? I saw some solutions similar to

 

$tokenProducts = Tools::getAdminToken(
            'AdminProducts'.
            (int)Tab::getIdFromClassName('AdminProducts').
            (int)$this->context->employee->id
        );

 

but the code I receive is always different from the one i see in the url in my browser after the _token parameter: index.php/product/catalog?_token=DIFFERENT_CODE_HERE

 

Edit: nevermind, have a look here.

Edited by Uff182 (see edit history)

Share this post


Link to post
Share on other sites
Posted (edited)

And if somebody wondering how just to generate a token, you can use:

Tools::getAdminTokenLite('AdminOrders')

 

Edited by soduno (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More