Jump to content



Latest News: (loading..)

- - - - -

PO Box Shipping Issues


  • Please log in to reply
2 replies to this topic

#1   talon177

talon177
  • Members
  • 409 posts
  • Real Name:Talon

Posted 04 April 2004 - 06:25 PM

Just wondering how do you guys configure your shipping modules to work with P.O. Boxes?

For instance i'm using FedEx Direct contribution, and i'm wondering if I use the USPS module, will osC know when a customer has a P.O. box and only display usps module prices and not the fedex?

#2   FlyingMonkey

FlyingMonkey
  • Members
  • 882 posts
  • Real Name:Calvin K

Posted 06 April 2004 - 02:29 AM

:rolleyes:
Most likely your question has been answered, please do a search first.

#3   talon177

talon177
  • Members
  • 409 posts
  • Real Name:Talon

Posted 06 April 2004 - 02:39 AM

Found a link hthat mentioned this but it doesn't seem to be working

Quote

icx's code will function, but only if the customer types in his address as PO BOX 12345 in all upper case without periods. Here's my code to work around that:

CODE 
$test = strtolower(str_replace(".","", $street_address));//define $test as $street_address without periods and in all lower case ("P.O. Box" becomes po box)
if (substr_count($test, "po") == 0 && substr_count($test, "box") == 0)//does $test contain "po" and "box"?
   {



There are many different ways to say "PO Box." You could have:
P.O. Box
PO Box
po box
p.o.box
P.O. box


strtolower() will take a string of upper case or mixed case and make it all lower case. Thus "sTrInG" becomes "string" and more importantly, "PO Box" becomes "po box".

str_replace() replaces one character with another. In this case, all periods (.) are replaced with nothing, in effect removing them.

Combining these two functions makes every one of the above examples into "po box."

substr_count() returns the number of times one string occurs within another. The code above counts how many times "po" and "box" occur in the address.

If either of those is not zero, you could display the message about "No PO Boxes." The downfall of this code is a customer who lives on a street that happens to have "po" and "box" as part of the name...but I haven't had anyone from PoBox Street register at my store.