MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Opps! My Contribution To The List For Canadian Shipping Problems



Well, I discovered I opened my mouth too soon!

The javascript at the bottom of this message for stripping out spaces does 
NOT work in Netscape, but is fine in IE.

Anyone know why and are the rest of you also tired of supporting two 
standards?


Cya,

Cameron






After using Tim Shea's code from a previous message, I was able to get 
MiniVend working correctly with Canadian purchases. However, I had this 
phantom amount of $5.00 being added to all orders. I finally discovered 
that this was due to a space between the first 3 digits of a Canadian 
postal code and the last 3. If I took out the space, the shipping was 
correct.

Also, If a person entered the postal code in lower case, it would not be 
looked up correctly because of the upper case entries in the zone file.

Steve Cockwell got me going with the case problem by supplying this added 
code that goes in the profile:

[perl values]
$Safe{'values'}{zip} = uc ($Safe{'values'}{zip});
return '';
[/perl]

I had limited the zip field to 6 characters and this would take care of 
most problems because most people would realize that they had not been able 
to enter the last digit if they had added the space after the third digit.

n6a4s5
^^^^^^^
123456

or

n6a 4s
^^^^^^
123456

So basically I still have the possibility of an added $5.00 if they don't 
notice they haven't typed the last digit.

Not good since I want this thing as foolproof as possible.

I set out on a mission to fix it, and actually did!

Here's the fix: (Add the script to your checkout.html page inside the 
<HEAD> </HEAD> then replace your existing "zip" input field with the one 
supplied below)


<TITLE>__COMPANY__ - [L]Check Out[/L]</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function replaceChars(entry) {
out = " "; // replace this
add = ""; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.subform.zip.value = temp;
}
//  End -->
</script>
</HEAD>


<INPUT TYPE="text" NAME="zip" VALUE="[value zip]" size=10 
onChange="replaceChars(document.subform.zip.value);">




As soon as the customer tabs or clicks off to the next field, any spaces 
will be stripped out!


Thanks for all the help guys!


Later,

Cameron B. Prince
Internet Experts Inc.




Search for: Match: Format: Sort by: