View Single Post
  #4  
Old 03-11-2010, 01:37 PM
 
DocOrtho DocOrtho is offline
 

Newbie
  
Join Date: Jan 2007
Posts: 5
 

Default Re: Disable UPS and FedEx for P.O. Boxes

I have flat rates and don't use real time calculations. It was just as easy to edit the shipping/shipping.php file:

Around line 288
Code:
if (!$enable_shipping || $config["Shipping"]["realtime_shipping"] != "Y") { # # Get ALL shipping methods according to the conditions (W/O real time) # $shipping = func_query("SELECT * FROM $sql_tbl[shipping] WHERE active='Y' $destination_condition $weight_condition ORDER BY orderby");
Change to:
Code:
if (!$enable_shipping || $config["Shipping"]["realtime_shipping"] != "Y") { # # Get ALL shipping methods according to the conditions (W/O real time) # // {{{ func_is_postal_box() /** * This function checks to see if the customer's * shipping address is a United States Post Office * Box. * * @param string $address Customer's Street Address * @return boolean true if post office box; false if not */ function func_is_postal_box($address) { $postalBoxRegex = '/^([pP]{1}(.*?)[oO]{1}(.*?))?([bB][oO]?[xX])(\s+)([0-9]+)/iD'; @preg_match($postalBoxRegex, trim($address), $isPostalBox); if (is_array($isPostalBox) && (count($isPostalBox) > 0)) { return true; } else { return false; } } // }}} if (func_is_postal_box($userinfo['s_address'])){ $shipping = func_query("SELECT * FROM $sql_tbl[shipping] WHERE active='Y' AND code='USPS' $destination_condition $weight_condition ORDER BY orderby"); }else{ $shipping = func_query("SELECT * FROM $sql_tbl[shipping] WHERE active='Y' $destination_condition $weight_condition ORDER BY orderby"); }
__________________
X-Cart v4.3
Reply With Quote