| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Disable UPS and FedEx for P.O. Boxes | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Disable UPS and FedEx for P.O. Boxes
Disclaimer: I am not responsible for any failed or lost orders due to the implementation of this modification. It is up to you to fully test it on a staging system before deploying it to production.
This tends to be a relatively annoying issue for a lot of people. A customer order's and item (usually a rather large item) and has it shipped to a P.O. Box only to have UPS or FedEx reject the delivery. While it is true they can ship to Post Office Boxes not all of them are either accessible to UPS/FedEx or they are too small for the parcel in question. Unfortunately X-Cart by default gives no option for people to disable shipping via these methods to those addresses. We've been using this modification for the past 2 years (though with slightly different logic) so I've decided to strip out the code sealed under NDA and share the open version with everyone else. Note: The following modification was written around X-Cart versions 4.1 and 4.2 and has not been tested for 4.3. The first file you need to modify is shipping/myshipper.php. Open the file and at the very bottom of the code add the following function: PHP Code:
Next you will need to edit two files, shipping/mod_UPS.php and depending if you're using X-Cart 4.1 or 4.2 either shipping/mod_FEDEX.php (4.2) or shipping/mod_FEDEX_direct.php (4.1) shipping/mod_UPS.php: After: PHP Code:
Add: PHP Code:
shipping/mod_FEDEX.php (4.2) or shipping/mod_FEDEX_direct.php (4.1) After: PHP Code:
Add: PHP Code:
Once you have made these modifications truncate the xcart_shipping_cache table and you should be good to go. This will disable UPS and FedEx for any address that is considered a P.O. Box by the regular expression (this expression has been thoroughly tested against thousands of customers who tried to get around it) Enjoy |
|||||||
|
#2
|
|||||||||
|
|||||||||
Re: Disable UPS and FedEx for P.O. Boxes
This should really be in the core code of xcart. Thanks Alan
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
Re: Disable UPS and FedEx for P.O. Boxes
Quote:
I agree, I also have similar procedures for blocking real-time shipping methods to zones (which it cannot do by default) and I also patched them to pass the customer's shipping address in the lookup for accurate rates (something else it should be doing by default but isn't) |
|||||||
#4
|
|||||||
|
|||||||
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:
Code:
__________________
X-Cart v4.3 |
|||||||
#5
|
|||||||
|
|||||||
Re: Disable UPS and FedEx for P.O. Boxes
I implemented this code and it works properly. The only issue I have since I am using one page checkout in 4.4 2, I have to refresh a screen in order to display if shipping is allowed. Any advise? Also how can I display a message indicatting that we do not ship to P.O. Boxes ?
Thanks, Fred. |
|||||||
|
|||
X-Cart forums © 2001-2020
|