Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Need to block certain zip codes from UPS

Need to block certain zip codes from UPS

Locked

Views: 1,379

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
13 Feb 2010, 9:26 PM
#1
traderdog avatar

traderdog

New Zenner

Join Date:
Jan 2009
Posts:
9
Plugin Contributions:
0

Need to block certain zip codes from UPS

Hi,
I'm hoping someone can point me in the right direction. We offer free delivery to one set of US zip codes, flat rate shipping to another set of zip codes and UPS and USPS shipping to another set of zip codes. We also offer free shipping for several product categories.

We have Freeshipper, UPS, USPS and Zipcode rate (for the flat rate since it is zip code specific) mods installed. All calculations are correct for all zip codes at checkout, but what we need to do is block a module if it is not applicable.

In other words, when product is free shipping, the only information that shows up on the Delivery Options page is one box that says "Free Shipping Only." However, if the customer's delivery address is within the flat rate Zipcode rate area, he sees a box for the flat rate, a box for UPS, a box for USPS. As this is very confusing to the customer, all I want him to see is the box that lists the flat rate.

I've read numerous posts about how to block specific categories or items from certain shipping methods, but haven't found anything on blocking specific zip codes.

I suspect it may have something to do with adapting the following in each shipping module:

// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
}

but haven't been able to figure it out.

Thanks in advance for any help.

13 Feb 2010, 10:35 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Need to block certain zip codes from UPS

To block the Shipping or Delivery by Zip Code, you could use beneath that:

if (!IS_ADMIN_FLAG && in_array($order->delivery['postcode'], array(44026, 74136)) ) {
  $this->enabled = false;
}
17 Feb 2010, 9:36 PM
#3
traderdog avatar

traderdog

New Zenner

Join Date:
Jan 2009
Posts:
9
Plugin Contributions:
0

Re: Need to block certain zip codes from UPS

Hi Linda,
Thanks so much for your quick response. I apologize for not responding in kind.

Your solution worked perfectly. So perfectly, in fact, that I realized I had worked myself right into a pickle.

For ease of explanation, let's say we sell apples and oranges:

  1. We ship apples and/or oranges to zip code 10001 for $5 on orders under $39, and for free on orders over $39. For this zip code we use the Zipship add-on and block the zip from the UPS Shipping Module and the Flat Shipping Module by using

if (!IS_ADMIN_FLAG && in_array($order->delivery['postcode'], array(10001)) ) {
$this->enabled = false;
}

  1. We ship apples and/or oranges to zip code 10002 for $5, regardless of the order total. For this zip code I did what I did in 1) above.

  2. We ship apples to zip code 10003 for a flat rate of $5 regardless of the order total. For this we block zip codes 10001 and 10002 using the postcode "if" above, and we block the category ID for oranges by using

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','51') > 0)) {
$this->enabled = false;
}

in the Flat Shipping Module (where category 51 is oranges).

Then, so the UPS Module doesn't appear as a shipping option at checkout, we

// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','50') > 0)) {
$this->enabled = false;
}

in the UPS Shipping Module (where category 51 is apples).

  1. We ship oranges to zip code 10003 at UPS rates.

Enter pickle.

If a customer in zip code 10003 places both apples AND oranges in his cart, we want him to see the UPS rates. But, alas, he sees nothing, except my shipping pickle. The oranges were blocked in the Flat Rate Module and the apples were blocked in the UPS Module.

I tried a number of ways to get around this, such as statements ending with

$this->enabled = true;

and a few other things I found in other threads, but can't seem to find an easy solution.

For now, I've eliminated the Flat Rate shipping for apples to zip code 10003 and replaced it with UPS. Heck, if people don't want to order apples from me at UPS rates they can walk to the store in the snow.:smile:

Thanks again very much for your time.

18 Feb 2010, 12:28 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Need to block certain zip codes from UPS

Sound like you are going to need a lot more complex shipping method to manage your apples and oranges scenarios to work with zip code constrictions ...

If you cannot work it out on your own, you might look at the Commercial Help Wanted to see if this can be broken down in a better manner to manage the shipping and zip codes based on the products in the cart ...