hOW do I set zen to not allow people to ship to PO Boxes??
thanks.
hOW do I set zen to not allow people to ship to PO Boxes??
thanks.
I did the following on one site:
includes/modules/shipping/ups.php
line 118 starts with:I added a couple lines after that to check for PO boxes, like this:PHP Code:
function quote($method = '') {
global $_POST, $order, $shipping_weight, $shipping_num_boxes;
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
PHP Code:
function quote($method = '') {
global $_POST, $order, $shipping_weight, $shipping_num_boxes;
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
// disable this module if address contains "PO Box"
$addr_check = str_replace(array('.',' ', '/'),'',strtoupper($order->delivery['street_address']));
if (strstr($addr_check,'POBOX') || strstr($addr_check,'POSTOFFICEBOX')) {
$this->quotes = array('module' => $this->title,
'error' => 'UPS cannot ship to a PO Box address.');
return $this->quotes;
}
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Dr Byte: I am using the Flat Shipping, is this the same code?
most likely would work the same.... don't add the code I repeated in the second box, just the extra code added
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
what version of the module are you quoting above? in the latest version, that piece of code readsOriginally Posted by DrByte
so are you embedding the new code within the body of that IF statement, or before it now?PHP Code:
if ( (zen_not_null($method)) && (isset($this->types[$method])) ) {
oops ... skip that line altogether ... I had relocated it from later in the file for other purposes
Skip this in my examples above:- thx for the catch JeffPHP Code:
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
no problem - just wanted to make sure I wasnt missing something
so now, with the addition of your code snippet, it will look like this (correct?):
PHP Code:
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
// disable this module if address contains "PO Box"
$addr_check = str_replace(array('.',' ', '/'),'',strtoupper($order->delivery['street_address']));
if (strstr($addr_check,'POBOX') || strstr($addr_check,'POSTOFFICEBOX')) {
$this->quotes = array('module' => $this->title,
'error' => 'UPS cannot ship to a PO Box address.');
return $this->quotes;
}
return $this->quotes;
}
You also need to check for "BOX" at the beginning of the string, because not everyone specifies "PO" in their address.
PHP Code:
if (strstr($addr_check,'POBOX') || strstr($addr_check,'POSTOFFICEBOX') || strstr($addr_check,'BOX')) {
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
BOX alone may not be ideal ...
The problem being folks using Mailboxes etc. my say Box 12 where they won't say PO Box 12 ...
And Mailboxes etc. is a real location so UPS does deliver ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Bookmarks