Converting Currencies

Whatever you’re up to with e-commerce, your audience is global. Even if that’s not your intent, you’re going to have potential customers who aren’t necessarily familiar with the current value of the U.S. dollar. Is there a solution? Oh, yeah. A really good one.

The Universal Currency Converter (UCC) from XE.com is a must-have for any commercial site that expects to handle international business. Like most free services, it has a banner ad built into it, but you can negotiate with XE.com to remove it for a fee. The converter lets anyone convert any amount in any currency to the equivalent amount in any other currency.

The basic module has only the major world currencies in it. Don’t sweat it, though; if you need to include others, it doesn’t cost you anything. This limitation is only for practical reasons. After all, nearly every transaction takes place in one of the top currencies, and the more options you add, the slower things get. Really, how often do you need to figure out how many Seborga luiginos are equal to 800 Uzbekistan soms?

Adding the converter to your Web page

To add the converter to your Web page, follow these steps:

1.
2.
Read through the terms of use.

3.
Fill out the required form with your URL and contact information.

Notice that the URL must be the address of the Web page on which you will actually put the converter, not just the general URL of your domain.

4.
Click the Go! button.

You need to register each page you use the converter on.

5.
On the resulting page, click the Fast Track Instructions button.

Now, you’re back on the earlier page, right below the form you filled out. Yes, it’s a roundabout way to get there, but the registration process is legally required if you want to use the converter.

From here, you have two options. Both of them work fine, so it’s just a matter of how you like to do things.

6.
Use one of the following methods to get the code for the converter:

  • Download the compressed file for either Windows or Mac. You then need to unzip it and load the resulting HTML page into an editor before you can use the code.

  • Click the Click Here to See the Raw HTML link and just copy the code off your browser screen.

If you download the file, you see that the enclosed Web page, samp-ucc. htm, has none of the usual elements you’re used to — HTML, HEAD, and BODY. Yet it will still load into any browser and will work just fine. That’s because, as useful as those elements are for envisioning the structure of your Web page, they’re not technically required under the HTML standard. I’m not recommending that you leave them out of your pages, and I’m sure that XE.com did it just because the purpose of that page is only to hold the code for you to copy and paste. But it’s a decent bit of tech trivia you can amaze and amuse your friends with.

7.
Whichever way you get your hands on the code, paste it into your Web page and save the file.

8.
Upload the page to your Web server and try it out.

Figure 14-6 shows the converter on a Web page.

Figure 14-6. The UCC enables your visitors to convert an amount in one currency to the equivalent amount in another.


Customizing the converter

Now, this is one fine service as is. But you can customize it, too. XE.com will change practically anything about the currency converter for a fee, but the company has also built plenty of options into it that you can use on your own.

Changing the default currencies

If you know the country from which most of your foreign customers come, you may want to set the converter so that it’s ready to convert from your customers’ currency to yours right away. Say, for example, that you’re in the United States and you know that almost every one of your overseas customers is from the United Kingdom. You’d probably do well to set the conversion to default values of dollars to pounds in that case. This won’t prevent anyone from another country from using the converter in the normal way. All it does is set which currencies are selected at the start, so visitors can still choose other currencies if they want.

This is what you need to do to set the default currencies in the converter:

1.
Go into the HTML source code and find the SELECT elements.

The one whose name attribute has a value of From is — you guessed it — the currency to convert from. The one whose name attribute has a value of To is the currency to convert to.

One of the OPTION elements in each has the selected attribute. In the original version, the default From currency is the euro, and the default To currency is the U.S. dollar.

2.
To change the default, just delete the word selected from the OPTION elements for the current currency and add it to the ones you want to use.

Simple, ain’t it?

Setting the default amount

Now, what if you have only one product, or what if all your products are the same price? For example, suppose you have a price of USD $49.95 that most people will want to convert to some other currency. Having already set the From currency to U.S. dollars, you can now set the default amount to 49.95. This default makes it really easy on your customers — all they have to do is pick their native currency, and they’re off and running. To set the default amount, look for the following code line near the beginning of the form:

<INPUT type="text" name="Amount" value="1" SIZE=10><BR>   

Just change the value of the value attribute. To set it to 49.95, change the code to this:

<INPUT type="text" name="Amount" value="49.95"            
								           SIZE=10><BR>                                   

Users can still change the default value to anything they want by simply typing over it, just like they can select different currencies by selecting something other than the default selections.

If you want to change the order of the currency choices from alphabetical to some other method — such as placing the most likely currencies on the top of the list — all you have to do is to cut and paste the OPTION elements that reflect the currency values in the listings. Remove them from their current positions and paste them into their new positions. That’s all there is to it.

If, for some reason, you don’t want to give your users any choice in these things, UCC accommodates your wishes through the use of hidden variables. To do this, you add some INPUT type="hidden" elements right after the <FORM> tag and just before the <TABLE> tag.

To set the From currency so that it can’t be changed, use the following code:

<INPUT type="hidden" name="From" value="xyz">             

Replace the placeholder xyz with the three-digit code for the currency — such as USD for U.S. dollars or GBP for United Kingdom (or Great Britain) pounds.

To set the To currency, you do the same thing, but the line reads as follows:

<INPUT type="hidden" name="To" value="xyz">               

To set the value so that it can’t be altered (which prevents people from using your version of the UCC for test purposes unrelated to your site), add the following line of code:

<INPUT type="hidden" name="Amount" value="xyz">           

Replace the placeholder xyz with the amount to be converted (for example, 49.95).

Adding and deleting currencies

If you want to add more currencies, check out the Full Universal Currency Converter at www.xe.net/ucc/full.shtml and copy and paste the appropriate currency to your version. Just add a new OPTION element under the To and/or From SELECT element for each new currency.

If you want to delete currencies from the listings, you need to delete the entire line for that currency, beginning with the <OPTION> tag and ending with the </OPTION> tag.

Customizing the results page

If you want to customize the default results page that appears after a currency conversion calculation, as shown in Figure 14-7, you need to go a bit deeper. Customization requires creating not only an element or an attribute, but also a header and a footer. The header contains HTML that is displayed before the calculation results, and the code in the footer goes in after them.

Figure 14-7. The UCC results page.


To set up the header and footer, think about your HTML code ahead of time, as well as consider the variations that the UCC demands of you. The header has to go right after the line with the <FORM> tag and has to include the [HTML], [HEAD], [/HEAD], and [BODY] tags. Notice anything weird about these? Yeah, the brackets aren’t the regular angle braces; they’re regular brackets. This way, a Web browser that reads this code won’t get confused by encountering two identical tags such as <HTML> in the same page. You put these odd-looking quasi-HTML elements in as values of a hidden INPUT element, and the UCC software reinterprets the squared brackets just as though they were angle braces when it comes time to create the results page.

So if you wanted to put in the following regular HTML code as your header . . .

<HTML>                                                      
								<HEAD>                                                      
								<TITLE>                                                     
								This is a currency converter.                               
								</TITLE>                                                    
								</HEAD>                                                     
								<BODY>                                                      

. . . you’d add it to the line in the currency converter code, like this:

<INPUT type="hidden" name="Header"                          
								           value="[HTML][HEAD][TITLE]This is a currency     
								           converter.[/TITLE][/HEAD][BODY]">                

Then comes the regular output of the converter. After that comes the footer. If you wanted to add the following HTML code to it . . .

<B>Thanks for using the converter!</B>                      
								</BODY>                                                     
								</HTML>                                                     

. . . you’d do it like this:

<INPUT type="hidden" name="Footer" value="[B]Thanks for     
								           using the converter![/B][/BODY]">                

The Shopper’s Currency Converter (www.xe.net/ecc/shoppers) provides the same functionality as the UCC, and versions are available that work in both Internet Explorer and Netscape Navigator.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.54.63