Omitting UPS shipping from PO Box addresses

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
foodsleuth
Commander (CMDR)
Commander (CMDR)
Posts: 139
Joined: Wed Mar 31, 2010 8:59 pm

Omitting UPS shipping from PO Box addresses

Post by foodsleuth » Mon Jul 05, 2010 9:51 am

From an old post, Feb, 2009: PO Box addresses would not render an option for UPS shipment. Was that a customization or should that be working now? We are having problems with people providing PO Boxes then selecting UPS as a shipping method.
Any workaround for this?
Thanks

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Omitting UPS shipping from PO Box addresses

Post by mazhar » Mon Jul 05, 2010 11:28 am

This is something that we handled in 7.0.5 work out of the box.
http://bugs.ablecommerce.com/show_bug.cgi?id=6878

Here is the workaround for you. Edit your ConLib/OnePageCheckout.ascx.cs file and locate following code lines

Code: Select all

foreach (ShipRateQuote quote in rateQuotes)
{
then update it as below

Code: Select all

foreach (ShipRateQuote quote in rateQuotes)
{
                        System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b");
                        if (quote.ShipMethod.ShipGateway != null && quote.ShipMethod.ShipGateway.Name == "UPS OnLine® Tools" && (regex.IsMatch(shipment.Address.Address1) || regex.IsMatch(shipment.Address.Address2)))
                        {
                            continue;
                        }
that's it. Actually all I am doing here is to see if shipping address contains PO Box address then hide those methods associated with UPS.

Post Reply