Zen Cart Logo
Forums / Addon Shipping Modules / Disabling UPS for certain categories

Disabling UPS for certain categories

Views: 1,430

Results 1 to 15 of 15
30 Aug 2011, 3:05 PM
#1
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Disabling UPS for certain categories

I need to disable UPSXML for categories 1, 38 and 39. I've read several threads on this and think this is all I need to do, but it doesn't work. Probably a syntax thing. Ideas?

Add this code to /includes/modules/shipping/upsxml.php. The commented out code is another unsuccessful try.

            if ($check_flag == false) {
                $this->enabled = false;
            }
// disable if master_categories_id 1 is in the cart
//      if ($_SESSION['cart']->in_cart_check('master_categories_id','1') > 0) {
//          $this->enabled = false;
//      }
// skip certain categories
      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0) {
        $this->enabled = false;
      }  
      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','38') > 0) {
        $this->enabled = false;
      }  
      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','39') > 0) {
        $this->enabled = false;
      }  
          }
30 Aug 2011, 3:20 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

If you add below the line:

// skip certain categories
global $cart;
30 Aug 2011, 3:25 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

Sorry goober moment ... I think you have the code in the wrong place ...

Can you move it a little higher up and below the code:

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
      }
30 Aug 2011, 3:26 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

NOTE: in UPSXML the code will probably look like:

        $this->enabled = ((MODULE_SHIPPING_UPSXML_RATES_STATUS == 'True') ? true : false);
30 Aug 2011, 3:50 PM
#5
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

That's it! Just pasting it higher, above this line makes it work beautifully.

          if (($this->enabled == true) && ((int)MODULE_SHIPPING_UPSXML_RATES_ZONE > 0)) {
            $check_flag = false;

Many thanks Ajeh! You rock. :clap:

30 Aug 2011, 4:05 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

You had put your code in a section where the Zone had to be tested but the Zone wasn't tested as there was no Zone set ...

Having you move it, places it outside of that Zone Test and the results will disable the Zone test from even being looked at ...

Thanks for the update that this is now working for you ... :smile:

30 Aug 2011, 4:38 PM
#7
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

Grrrrr! Works great for frozen items in the cart as now it doesn't show the UPS (priced) shipping options when Free is selectable right below it using freeshipper and 0 weight. But put a non-frozen item in the cart and now nothing shows at all, neither regular UPS options or the freeshipper option. Just empty. Going to checkout, the only option is store walkin. That ain't gonna work so I commented it out and UPS shows on frozen items which should be just freeshipper. Hmmm.

Seems like it should just display normal shipping for categories other than 1, 38 and 39, and show Shipping Included for those categories. Guess it's the combination that's screwing it up. Maybe I need a split category that allows a combination or something. Doesn't sound fun.

http://www.texastamale.com/store/

30 Aug 2011, 4:43 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

What is the ultimate goal that you are trying to achieve here?

Are you trying to turn off all of UPS when there is something in the cart from these categories or are you trying to turn off certain UPS shipping methods when something from these categories are in the cart? :unsure:

30 Aug 2011, 5:02 PM
#9
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

Good question. I suppose A) trying to turn off all of UPS when there is something in the cart from these categories. But UPS options need to kick in if there's a product with IDs other than those 3.

They're stating at the top of shopping cart contents that all frozen items will be shipped UPS 2-day service, so I'm using Freeshipper with 0 weight on the frozen products. The rest of the bottle and jar products have UPSXML and normal UPS shipping charges applied to them.

FROM THE SITE: All frozen items with SHIPPING INCLUDED will automatically be shipped, usually via UPS 2-day service, with no additional cost to the customer. Dry product may ship in separate package UPS Ground. Extra shipping charges will be applied to shipments going outside the 48 contiguous United States. Due to customs restrictions, frozen items can only be shipped within the 50 United States and to U.S. Territories.

Everything works fine with the exception that, for only frozen items, UPS options are being shown above my Freeshipper option "Your shipping is included - $0". They've had 2 customers click on the UPS Ground option (for extra $) instead of the free option below it just cause they didn't see it more than likely. So I'm trying to disable showing UPS options if there's only frozen items in the cart (categories 1, 38 and 39).

30 Aug 2011, 5:15 PM
#10
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

This is what's showing on only frozen items even though Freeshipper kicks in and says UPS You Shipping Is Already Included $0. Would like to not show this when only categories 1, 38 and 39 are in the cart. Being 0.00 lbs, I'm not sure what it's quoting. Guess a minimum charge.

United Parcel Service (1 pkg x 0.00 lbs total) (UPS Ground, ETA: September 02, 2011) $8.31
United Parcel Service (1 pkg x 0.00 lbs total) (UPS 2nd Day Air) $15.51
United Parcel Service (1 pkg x 0.00 lbs total) (UPS Next Day Air Saver, ETA: September 02, 2011) $22.67
United Parcel Service (1 pkg x 0.00 lbs total) (UPS Next Day Air, ETA: September 02, 2011) $26.11
United Parcel Service (Your Shipping Is Already Included!) $0.00
Store Pickup (Walk In - Distribution Center - 9087 Knight Rd, Mon–Fri 10-3pm) $0.00
Store Pickup (Walk In - Retail Outlet - 3340 Fountainview, Mon–Sat 8-4pm) $0.00

30 Aug 2011, 5:17 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

You could compare the total items from those categories to the total items in the cart to tell you that it is a mixed cart ...

If it is mixed, does this mean that the UPS should run normally?

30 Aug 2011, 5:48 PM
#12
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

That's correct, UPS should apply regular rules to other products in the cart.

30 Aug 2011, 5:58 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

If you use something like this?

// skip certain categories and disable if entire cart is only in specific categories
      if (IS_ADMIN_FLAG == false) {
        global $cart;
        $chk_frozen = 0;
        $chk_frozen += $_SESSION['cart']->in_cart_check('master_categories_id','1');
        $chk_frozen += $_SESSION['cart']->in_cart_check('master_categories_id','38');
        $chk_frozen += $_SESSION['cart']->in_cart_check('master_categories_id','39');
        if ($chk_frozen == $_SESSION['cart']->count_contents()) {
          $this->enabled = false;
        }
      }
30 Aug 2011, 6:16 PM
#14
getyler2 avatar

getyler2

New Zenner

Join Date:
Jul 2011
Posts:
44
Plugin Contributions:
0

Re: Disabling UPS for certain categories

Ajeh... You're Beautiful! That's it. Works perfectly. Thank you so much. I've been trying to accomplish this for weeks. You are such a huge asset to Zen-Cart and all of us using it! Where's that coffee can. Drinks are on me!

30 Aug 2011, 10:57 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Disabling UPS for certain categories

You are more than welcome and thanks for the support to the Team ... it really helps us greatly ... :smile: