|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Total price in Other Currency (Real time rate)
Hi guys,
This may prove to be a real challenge, (well for me anyway )...I've just launched a web site that sells collectibles. To do this I've got a ASP shopping cart with a checkout process. As all the prices on my site are in Australian Dollars, I' trying my very best to find a way to display the total price in USD as well.... Eg: Total Price : $ AUD 100.00 Total Price : $ USD 79.00 (real time rates) I need to do this because I also want to Accept PAYPAL account payments which cannot be made in AUD. Please help guys, |
|
#3
|
||||
|
||||
|
If a few people want this, I might consider sorting out an OandA (or similar) account and provide a simple means to collect exchange information from my site (for a small fee of course!)
MK |
|
#4
|
||||
|
||||
|
Ok - I've found a free feed. I've not checked whether the exchange rate is correct, but this script should work (also attached for better code formatting):
Code:
<%
' Parameters
GBL_URL = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=#From#&ToCurrency=#To#"
GBL_FROM = "AUD"
GBL_TO = "USD"
%>
<%
' Strip HTML tags from a string
Function RemoveHTML( str_HTMLString )
Dim RegExp
Set RegExp = New RegExp
RegExp.Pattern = "<[^>]*>"
RegExp.Global = True
str_HTMLString = Replace(LCase(str_HTMLString), "<br>", chr(10))
RemoveHTML = RegExp.Replace(str_HTMLString, "")
End Function
' Collect a remote URL response
Function GetURL( str_URL )
Set obj_XMLHTTP = Server.CreateObject ("Microsoft.XMLHTTP")
obj_XMLHTTP.Open "GET", str_URL, False, "", ""
obj_XMLHTTP.Send()
If Err.Number = 0 Then
If obj_XMLHTTP.Status = 200 Then
GetURL = obj_XMLHTTP.ResponseText
Else
GetURL = "*Error*"
End If
Else
GetURL = "*Error*"
End If
Set obj_XMLHTTP = Nothing
End Function
' Cleanup extraneous characters
Function Cleanup( str_String )
str_String = Replace(str_String,vbcrlf,"")
str_String = Replace(str_String,vbcr,"")
str_String = Replace(str_String,vblf,"")
Cleanup = str_String
End Function
%>
<%
' Use query string?
If Len(Request.QueryString("From")) = 3 Then GBL_FROM = UCase(Request.QueryString("From"))
If Len(Request.QueryString("To")) = 3 Then GBL_TO = UCase(Request.QueryString("To"))
' Format GET string
GBL_URL = Replace(GBL_URL,"#From#",GBL_FROM)
GBL_URL = Replace(GBL_URL,"#To#",GBL_TO)
' Get the URL and cleanup HTML tags and extraneous line feeds
str_GetURL = Cleanup(RemoveHTML(GetURL(GBL_URL)))
%>
1 <%= GBL_FROM %> = <%= str_GetURL %> <%= GBL_TO %>
|
|
#5
|
||||
|
||||
|
No - no need to thank me!
![]() |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Total price in Other Currency (Real time rate) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|