dprovost1990 Posted May 20, 2015 Share Posted May 20, 2015 Since php tags no longer work inside smarty, how can I run php code from my prestashop site? I have a php script that checks users location and if in a certain area it will call a javascript function that displays a warning. Since I can't add this code directly to my .tpl files, how can run the script from within prestashop. It should work on all pages, incase someone enters the site from outside the landing page. Also, can I make the script only run once, so that if a user has been to any store page already the code is just ignored? Link to comment Share on other sites More sharing options...
PascalVG Posted May 21, 2015 Share Posted May 21, 2015 (edited) I think I would try to would make a small template 'plugin' and use that to get the answer of in/outside the area. Then based on the answer run some javascript. This was quite a clear example for me: http://www.smarty.net/best_practices My 2 cents, pascal. P.S. smarty var in JS: http://iamrookie.com/blog/296/using-smarty-variable-within-javascript-or-jquery-function.html Edited May 21, 2015 by PascalVG (see edit history) Link to comment Share on other sites More sharing options...
Rolige Posted May 21, 2015 Share Posted May 21, 2015 Create a basic module to run in the header, top or footer is the best option and clean solution. 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