|
<<prev |
1 |
2 |
3 |
4 |
5 |
next>>
Smart Shipping Based on Country - Specifying the correct country field
Since RealCart is compatible with so many methods of checkout there are a lot of possibilities for this particular line of code:
var nIdx = eval(document.pay.Country.selectedIndex);
Below is a table showing what the name for the country field is, depending on how you have RealCarts Checkout Wizard set up.
| Checkout Method | Country Field Name |
| Correct line of code to use: |
My NT Server My UNIX Server PayPal PayPal (for NT) PayPal (for UNIX) eCheck EMS Ecommerce WorldPay JR | country or shipcountry* Note uppercase and lowercase.
COUNTRY does not equal country |
var nIdx = eval(document.pay.country.selectedIndex);
(Use the above line for eCheck, EMS Ecommerce, and others as listed above) |
Authorize.Net 2.5 Intellipay | COUNTRY or SHIPCOUNTRY* |
var nIdx = eval(document.pay.COUNTRY.selectedIndex);
(Use the above line for AuthNet 2.5, Intellipay) |
Authorize.Net 3.x BluePay eProcessing Network iTransact WebLink | x_Country or x_Ship_To_Country* |
var nIdx = eval(document.pay.x_Country.selectedIndex);
(Use the above line for Authnet 3.x, BluePay, eProcessing, etc...) |
| BeanStream | ordCountry or shipCountry* |
var nIdx = eval(document.pay.ordCountry.selectedIndex);
(Use the above line for Bank of America) |
| LinkPoint HTML | bcountry or scountry* |
var nIdx = eval(document.pay.bcountry.selectedIndex);
(Use the above line for LinkPoint HTML) |
| PayFlowLink | COUNTRYSEL or COUNTRYTOSHIPSEL* |
var nIdx = eval(document.pay.COUNTRYSEL.selectedIndex);
(Use the above line for PayFlowLink) |
| PayReady | txtBillingCountry |
var nIdx = eval(document.pay.txtBillingCountry.selectedIndex);
(Use the above line for PayReady) |
| Total Payment Network | cust_bill_country |
var nIdx = eval(document.pay.cust_bill_country.selectedIndex);
(Use the above line for Total Payment Network) |
| ViaKlix | ssl_country |
var nIdx = eval(document.pay.ssl_country.selectedIndex);
(Use the above line for viaKlix) |
*Only if supported by gateway and only if Get shipping
address is checked in RealCarts checkout wizard.
One last thing you might want to do just to be 100% sure this modification works every time is to delete your home country from the LATTER part of the code and leave it remaining ONLY as position #2 (3rd option) in the country pull-down menu. If using the U.S.A. as the home country you will want to delete it from the lower part of the select code like this:
<option value="UA">Ukraine
<option value="GB">United Kingdom
<option value="US">United States
<-- remove
<option value="UY">Uruguay
<option value="UZ">Uzbekistan
If your home country is The U.K.:
<option value="UA">Ukraine
<option value="GB">United Kingdom
<-- remove
<option value="US">United States
<option value="UY">Uruguay
<option value="UZ">Uzbekistan
Save your snippit, rebuild your checkout and try it out. Publish your checkout page back to your web server and test it out. When you are finished testing dont forget to comment out the two alert statements we addded at the beginning of the course. Locate this:
alert("ship index = " + i);
alert("country index = " + nIdx);
var strLabel = shipOption[nIndex].Label;
Add the double-slashes back in before the word alert on both of these lines. Change it to look like this:
// alert("ship index = " + i);
// alert("country index = " + nIdx);
var strLabel = shipOption[nIndex].Label;
Rebuild checkout once again, republish and happy selling.
Checklist - Troubleshooting
- Make sure to clone jsship.snp before you begin.
- Be sure to change the country field reference if needed. (1st red line)
- Make sure to change the domestic index numbers in the if statement. (2nd red line)
- Make sure to change the default international index number in two places. (3rd and 4th red lines)
- Remember to comment out the two alert statements by adding the double slashes back in.
- Rebuild your checkout page and publish.
Error messages
If you see the error:
Error: 'document.pay.country.selectedIndex' is null or not an object.
This means that the country field is called something other than what you specified in this line:
var nIdx = eval(document.pay.country.selectedIndex);
To change it to x_Country use this:
var nIdx = eval(document.pay.x_Country.selectedIndex);
If you get other JavaScript errors you will want to double check your changes and make sure you didnt accidentally remove a ( || ) ; { or }.
To see an already modified file for My NT Server, My UNIX Server, PayPal, PayPal (for NT), PayPal (for UNIX) etc... please view this file to see which lines are to remain intact without wrapping. To see the entire modified jsship.snp file please click here. The changes are highlighted with red type. You may download this modified jsship.zip file, extract it and then save the new jsship.snp file to your current theme folder called jsship.snp. Rebuild Checkout, republish and enjoy.
This concludes the course on Smart Shipping Based on Country.
<<prev |
1 |
2 |
3 |
4 |
5 |
next>>
|