angelyssa Posted September 16, 2016 Share Posted September 16, 2016 Hi guys, I am trying to figure out what these do in PrestaShop? var static_token = '{$static_token}'; var token = '{$token}'; They are found in /theme/header.tpl in the <head> code, and then the token also gets populated in the <form> for the add-to-cart button... Does anyone know what these are or what they do? Can I make them STATIC, and if so, will it effect anything in my shop? Reason for that, is this: https://www.prestashop.com/forums/topic/555525-how-to-create-static-product-pages-without-token/ thanks! Elyssa Link to comment Share on other sites More sharing options...
modprestashop Posted September 16, 2016 Share Posted September 16, 2016 For security reason PrestaShop generate MD5 hashed token which is appended to each AJAX call URL to make sure that the request comes by human activity and not by a boat. Both token are created by PrestaShop and we need to use it in our code too, so what code you mentioned is declare variable in JavaScript and assign value of token and static token to those JavaScrip variable. After that we have both token value in JavaScript variable and we can use it in our code. When we made any AJAX call, token will be compared against the token which is stored in cookie/session to make sure there is not any malicious activity by that particular AJAX call. 1 Link to comment Share on other sites More sharing options...
angelyssa Posted September 16, 2016 Author Share Posted September 16, 2016 i *sort* of understand what you are saying... i'm not a programmer though hehe.. so, my question is... if i populate the token codes in the header.tpl, and I use the same tokens on the static product pages I make, will that work? So basically, ALL customers would use that token... will the cart work? Thanks! Elyssa Link to comment Share on other sites More sharing options...
modprestashop Posted September 17, 2016 Share Posted September 17, 2016 Yes, when you will use $token and $static_token variable you don't need to worry if it is same for all customer or not. It will fetch value from those variable, whatever it is. Link to comment Share on other sites More sharing options...
angelyssa Posted September 17, 2016 Author Share Posted September 17, 2016 ok thanks.. as of now on the website, I have put a value in each of $token and $static_token, so all the pages call the same tokens... however, upon testing the page, it sometimes does NOT add the product to the shopping cart... sometimes i will just go directly to this page: www.allo.com/shop/ sometimes it will show cart page (which shows as blank page for some reason) Are you able to test this page, and see if you can add-to-cart without issues? http://www.allo.com/sparky/sparky-sbc.html Please tell me your results... I tried from my cell phone at an airport, and still, I got this page: www.allo.com/shop/ but sometimes I get the summary page, like with URL like this https://www.allo.com/shop/order?ipa=43 i cannot figure out why if no one can buy anything, i will have huge problems with my boss! lol Thanks for your help! Elyssa Link to comment Share on other sites More sharing options...
rocky Posted September 18, 2016 Share Posted September 18, 2016 Have you tried going to Preferences > General and changing "Increase front office security" to "No"? I hope you're ready to take the blame from your boss if your website is hacked in the future because you reduced the security. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now