easynow Posted October 21, 2016 Share Posted October 21, 2016 How to show this php code just after <body> in header.tpl? $ip = !empty($_SERVER["HTTP_X_FORWARDED_FOR"])?$_SERVER["HTTP_X_FORWARDED_FOR"]:$_SERVER["REMOTE_ADDR"]; <script>ip = [{"visitorNo":<?php echo .'"' .$ip . '"' ?>}];</script> Link to comment Share on other sites More sharing options...
endriu107 Posted October 21, 2016 Share Posted October 21, 2016 I think the best solution is create module to do this. Link to comment Share on other sites More sharing options...
easynow Posted October 21, 2016 Author Share Posted October 21, 2016 I think the best solution is create module to do this. Hi, Thanks for your reply. Can you please show how to do this in details? I am not a developer, so it's hard for me to write the module code. Thanks. Link to comment Share on other sites More sharing options...
endriu107 Posted October 21, 2016 Share Posted October 21, 2016 Sorry but I can't show you how to do this in details because it is similar to do this module for you, but I have no time to this. You can use module generator https://validator.prestashop.com/auth/login it make almost ready module for you, after generate you need to add your code into it. Link to comment Share on other sites More sharing options...
rocky Posted October 22, 2016 Share Posted October 22, 2016 It might be possible without a module just by editing header.tpl in your theme. For example, something like: {if !empty($smarty.server.HTTP_X_FORWARDED_FOR)} {assign var='ip' value=$smarty.server.HTTP_X_FORWARDED_FOR} {else} {assign var='ip' value=$smarty.server.REMOTE_ADDR} {/if} <script type="text/javascript">var ip = '{$ip}';</script> 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