![]() |
Display Customer IP during checkout
First, my apologies if this has been addressed elsewhere - I've searched and seen the posts regarding capturing the IP address for back-end purposes but hadn't seen anything quite exactly like this.
Also this may seem a bit pretentious to post in Custom Mods, (it's just a simple hack) so moderators please feel free to move to more appropriate forum. It is also a good example/excercise of how you can use your own "pseudo" variables in any of your language variables. Say for instance, you would like to display to a customer during checkout that their IP address is part of your anti-fraud technology - please, let's skip the debate as to whether this is useful or not; some clients want this based on the high-risk markets they are in and feel it is at least a minor deterrent. :wink: Okay, first create a new text label: Administration -> Languages -> Select Language -> Select Topic -> Text For variable put: msg_customer_IP For Description put: Customer IP address For Value use something like this (note the double curly brackets around the word customer_ip: Code:
<font color=red>*NOTE*</font> Your IP address : {{customer_ip}} is tracked during the checkout process as part of our anti-fraud technology. Then to display this information wherever you want, use: Code:
{$lng.msg_customer_ip|substitute:"customer_ip":$smarty.server.REMOTE_ADDR} The "substitute" pipe replaces your pseudo variable "customer_ip" with the smarty global containing the remote IP address. Credits go to PhilJ for putting me on to the smarty global thing: http://forum.x-cart.com/viewtopic.php?t=14490&highlight=remoteaddr I was trying to use a PHP global and couldn't get it to work quite right. Thanks Phil 8) |
isn't this IP already intergrated with latest version?
if you go to order and click on whatever order you wanted you wil lsee just under status: and tracking number: IP address: xxx.xxx.xxx.xxx |
x-online,
Please read my post and its purpose carefully - this is for display to customer during checkout :wink: |
Sorry for my misreading ^_^''
Nice work! |
small change
i just implemented this and had to make one small change. the code:
Code:
{$lng.msg_customer_ip|substitute:"customer_ip":$smarty.server.REMOTE_ADDR} should be: Code:
{$lng.msg_customer_IP|substitute:"customer_ip":$smarty.server.REMOTE_ADDR} |
I don't think the default takes Proxies or IP's behind LAN's into consideration. Here's a function that can easily be used in config.php to grab the absolute IP of the user. Thanks to NuLime for the function.
Code:
function fetch_remote_address() { |
Dear Boomer,
Where exactly to put this code in config.php ? We need to just put this code & nothing else ? will it display the customer's original IP on chekout ? |
Quote:
Place it towards the bottom of the file, before the WARNING comment. Add this afterwards to call the IP anywhere: Code:
$smarty->assign("customers_ip", fetch_remote_address()); |
Place it towards the bottom of the file, before the WARNING comment.
Add this afterwards to call the IP anywhere: Code: $smarty->assign("customers_ip", fetch_remote_address()); And call the variable in any .tpl {$customers_ip} Boomer, what do you mean by "And call the variable in any .tpl {$customers_ip}" I copied the code into config like you said and added the line afterwards, but I'm still not seeing an IP. Thanks.[/quote] |
Code:
die(fetch_remote_address()); |
Quote:
That means you will have to put {$customers_ip} in .tpl file where you want to display IP address. For example if you want to show IP on checkout page then place following code at the end of the file cart_totals.tpl which is at skin1/customer/main/cart_totals.tpl Code:
<font color=red>*NOTE*</font> Your IP address : {$customers_ip} is tracked during the checkout process as part of our anti-fraud technology. |
Quote:
Boomer is that the right way to put die(fetch_remote_address()); |
Re: Display Customer IP during checkout
This doesn't seem to work, does any genius know how to implement this in 4.1.8 ?
|
Re: Display Customer IP during checkout
Quote:
Hi anandat is it possible to track Private ip address of a customer for dynamic ip service provider's internet connection?Can you give neat and clean code to do this!!!! |
Re: Display Customer IP during checkout
Quote:
No that'd be a violation of the RFC if private addresses were leaked. |
Re: Display Customer IP during checkout
Quote:
That is true.But I want to place a standalone pc in different shopping malls with dynamic ip broadband connection and want to display my webstore to the customer and sell products online. Than How can I track those order status with different location with different dynamic ip? Can you help me how to track those pc's ip address to know the exact location of the order status. Can anyone help me? Thanks to all. |
Re: Display Customer IP during checkout
Quote:
Quote:
Hi anandat can you help me- 1) what is the exact code for displaying ip address? 2)Can you able to do it successfully ? 3)Is it possible to track customers private ip address from this? Actually I cannot able to do display the ip address.I want to do this. Can you help me? Can anyone help me... |
All times are GMT -8. The time now is 12:37 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.