Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Different shipping methods for different categories

Different shipping methods for different categories

Views: 107,624

Results 1 to 20 of 554
13 Mar 2008, 2:16 AM
#1
tylerd213 avatar

tylerd213

New Zenner

Join Date:
Sep 2006
Posts:
22
Plugin Contributions:
0

Different shipping methods for different categories

Hi, I have been searching around a lot and cant seem to find the answer to my question.. I have two categories of which i need to assign different shipping methods for each (Products in 1st category can be shipped with any shipping method but products in category 2 can only be picked up in store, so a forced in store pickup)

How would i go about doing this?? I read stuff about Mixed Carts, but am unsure what that is.

Thanks,
Tyler

15 Mar 2008, 6:03 PM
#2
tylerd213 avatar

tylerd213

New Zenner

Join Date:
Sep 2006
Posts:
22
Plugin Contributions:
0

Re: Different shipping methods for different categories

Anybody have any ideas??

Thanks!
Tyler

19 Mar 2008, 10:07 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

You could customize the shipping modules that when a given master_categories_id is in the shopping cart then only Store Pickup storepickup can run ...

Otherwise, when nothing from that master_categories_id is in the cart then all other Shipping modules run ...

You should also consider whether you want Store Pickup storepickup to always show as an option ...

19 Mar 2008, 10:50 PM
#4
tylerd213 avatar

tylerd213

New Zenner

Join Date:
Sep 2006
Posts:
22
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ok, this is basically what i want to do. Unfortunately i have no idea where to begin (Im new with PHP).

But to give you some more information, i only have one other shipping option in my cart (2 total with storepickup) which is Per Item. So what i would want to do is in the Per Item shipping module include code somewhere that states if the master_categories_id is 17 (the one i want storepickup on) then disable this shipping module.

Store pickup can be shown on all other products, it just has to be the only forced option in this one category :) :smile:

Thanks for your help thus far, its so much appreciated!!

21 Mar 2008, 5:28 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Let's say you want the Per Item item shipping module to turn off or hide when 1 or more products from categories_id 17 is in the shopping cart ...

Edit the shipping module:
/includes/modules/shipping/item.php

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        if ($_SESSION['cart']->in_cart_check('master_categories_id','17') > 0) {
          $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
        }
      }

This will cause the $this->enabled to evaluate as false and not show the Per Item item shipping module ...

21 Mar 2008, 8:58 PM
#6
tylerd213 avatar

tylerd213

New Zenner

Join Date:
Sep 2006
Posts:
22
Plugin Contributions:
0

Re: Different shipping methods for different categories

We are close!! Thanks so much! But a couple issues:

It seems to work backwards, it enables per item shipping for the category 17 but disables it for the rest of the categories.

second in the admin panel when i click on shipping modules it states:
Fatal error: Call to a member function on a non-object in /home/content/W/o/l/Wolves17/html/cart/includes/modules/shipping/item.php on line **28

**Thanks so much for your help so far! I will be donating :smile:

21 Mar 2008, 9:02 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Silly silly me ... such the dyslexic am I ... :blink:

You want this OFF when categories_id is in the shopping cart ...

Based on the assumption that these products use the master_categories_id 17, you need that to be > 0 so that it sets Per Item item shipping module to a false $this->enabled ...

I was sorta losing my mind at the time ... t'wasn't nothin' ... :lamo:

21 Mar 2008, 9:03 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Let me find the secret code for the admin conflict on the cart ... kinda forgot about that one ... :smartalec:

21 Mar 2008, 10:11 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

This would work better and not make the Admin have a fit:

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

      // disable for one master_categories_id
      if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','17') > 0)) {
          $this->enabled = false;
      }
22 Mar 2008, 4:45 AM
#10
tylerd213 avatar

tylerd213

New Zenner

Join Date:
Sep 2006
Posts:
22
Plugin Contributions:
0

Re: Different shipping methods for different categories

Wow, you are awesome! Thank you so much! It works great :)

25 Mar 2008, 4:20 PM
#11
pasher avatar

pasher

New Zenner

Join Date:
Dec 2005
Posts:
64
Plugin Contributions:
0

Re: Different shipping methods for different categories

I'm trying to do something similar, and this is the closest thread I've found to it ;-)

If the total value of items from a particular master category in the cart is less that £100, invoke the 'Low Order Fee' shipping module.

Is there a similar code patch to do this?

Thanks
Pa

3 Apr 2008, 9:39 PM
#12
kishore_peri avatar

kishore_peri

New Zenner

Join Date:
Oct 2007
Posts:
3
Plugin Contributions:
0

Re: Different shipping methods for different categories

Where did you place this code?

I have a region table shipping module installed. I wanted to use this for few categories only. And i want to use flat rate for other categories. I have tried to use your code. but it does not work. Please help me here.

Thanks,
Krishna Peri

5 Apr 2008, 5:56 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

All of the Shipping Modules have their code stored in the:
/includes/modules/shipping

directory ...

Each has a similar section of code for the:
$this->enabled

that can be controlled in a similar manner ...

The example posted was for the Item Rate item shipping module ... you want to do this for the Table Rate table shipping module ... see if you can't follow along on the similarities to get this working for you and post back your results ... :cool:

5 Apr 2008, 5:59 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

pasher:

I'm trying to do something similar, and this is the closest thread I've found to it ;-)

If the total value of items from a particular master category in the cart is less that £100, invoke the 'Low Order Fee' shipping module.

Is there a similar code patch to do this?

Thanks
Pa

You would need to write a function to calculate the totals from the master_categories_id in question and see what that total is ...

Based on this total, you could them customize the Low Order Fee ot_loworderfee order totals module in:
/includes/modules/order_total

to manage this for you in a similar manner ...

7 Apr 2008, 6:20 PM
#15
graniteman44 avatar

graniteman44

Zen Follower

Join Date:
Dec 2007
Location:
Michigan
Posts:
160
Plugin Contributions:
0

Re: Different shipping methods for different categories

I would like to do what the original poster asked. If I want to use "per item" on more than one category, do I have to duplicate the

  • if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','17') > 0)) {
    $this->enabled = false; *

for each category?

Or can I list the others within the same line as the '17' ?

example: 'master_categories_id','17','18', '20')

Thank you.

G

8 Apr 2008, 6:34 AM
#16
xam avatar

xam

New Zenner

Join Date:
Apr 2008
Posts:
23
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hi ..

I need this code but quite the other way around.

I have 4 categories BSC, SPC, RAI and VAN.

I would like to enable a shipping method called "Distingo" when only RAI products are in cart.
When RAI + other cat products (or only other Cat products) are in cart then I need to use the "Colissimo" method.

The other tricky point is :
when I need to send 1 or 2 RAI products, shipping cost is 2.50
when I need to send 2 to 4 RAI products, shipping cost is 3.00
when I need to send 5 to 10 RAI products, shipping cost is 4.00
and for more than 10 RAI products, I would send it "Colissimo".

How shall I modify that code to make it work ?

Thanks

Xam

8 Apr 2008, 8:03 AM
#17
xam avatar

xam

New Zenner

Join Date:
Apr 2008
Posts:
23
Plugin Contributions:
0

Re: Different shipping methods for different categories

I should maybe add that the "Distingo" method should be only available for 1 of my Zones

15 Apr 2008, 11:44 PM
#18
cwsites avatar

cwsites

New Zenner

Join Date:
Apr 2008
Location:
Georgia
Posts:
15
Plugin Contributions:
0

Re: Different shipping methods for different categories

Help?

I have a master category "15" that I want to only use UPS for shipping, but everything else on the site I don't want to show UPS as an option... How do I do this?

Thanks in advance.

18 Apr 2008, 3:29 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

CWSites:

Help?

I have a master category "15" that I want to only use UPS for shipping, but everything else on the site I don't want to show UPS as an option... How do I do this?

Thanks in advance.

What happens when 1 product is in 15 and 3 products are in other categories?

If then you still do not want UPS, then you can block UPS when the whole cart is not categories_id 15 ...

If you need 1 product to be from 15 to allow UPS you can do that too ...

But you need to further define which way you want this to go ...♠

18 Apr 2008, 3:35 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Xam:

Hi ..

I need this code but quite the other way around.

I have 4 categories BSC, SPC, RAI and VAN.

I would like to enable a shipping method called "Distingo" when only RAI products are in cart.
When RAI + other cat products (or only other Cat products) are in cart then I need to use the "Colissimo" method.

The other tricky point is :
when I need to send 1 or 2 RAI products, shipping cost is 2.50
when I need to send 2 to 4 RAI products, shipping cost is 3.00
when I need to send 5 to 10 RAI products, shipping cost is 4.00
and for more than 10 RAI products, I would send it "Colissimo".

How shall I modify that code to make it work ?

Thanks

Xam

You would need a customization on the shipping modules to test the cart content to determin which module to enable and then set the prices ...

From what this looks like, on the pricing the Zone Rate zones could be used for both the pricing method and the Zone filtering ...

The customization on what shipping method is used can be filtered in a similar manner to how the master_categories_id is used in the example above ...

If you are a coder, this just takes a bit of thought to manage the filters for enabling the right shipping module ...

If you are not a coder, then you may wish to have someone write this for you ...