Jump to content

How to get admin product token on smarty


Recommended Posts

Hello, I'm writing a module that it will add an extra tab on the edit product page (back office). I did a small research and I saw many people that they are suggesting the following methos

 

Tools::getAdminTokenLite('AdminModules')
$token = Tools::getAdminToken($tab.(int)(Tab::getIdFromClassName($tab)).(int)($cookie->id_employee));
'token' => Tools::getToken(false)

 

I did several combinations, like changing tabs, module names etc, but non of them returned the same token that exist on the URL.

 

Does anyone know what method to use in order to get the same token on my tbl  with the one on the URL? 

Also how I can build a friendly url on the smarty?

Now it is 

index.php?controller=AdminProducts&token={$token|escape:'html':'UTF-8'}"

 

And i need something like this

index.php/product/catalog?_token=

 

Thanks

Share this post


Link to post
Share on other sites

  • 1 year later...
  • 1 year later...

in Backoffice some time you need juste the current user id to generate the token

?token='.Tools::getAdminToken((int) $this->context->employee->id)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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