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

Different shipping methods for different categories

Views: 107,635

Results 81 to 100 of 554
1 Feb 2009, 12:02 AM
#81
shuch3n avatar

shuch3n

New Zenner

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

Different shipping methods for different categories

So can someone plz tell me step for step how to set different Shipping Method for Different Categories?

My Site:

Normal Category
- Free Shipping
FastSend Category
- Cost €XX

4 Feb 2009, 8:38 AM
#82
ladykaira avatar

ladykaira

New Zenner

Join Date:
Dec 2007
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

I'm sooooo close thanks to this thread.

I have a free shipping category. I want my free shipping options to ONLY show up when all items in the cart are Free Shipping items.

If someone adds anything that is not free shipping, I want the option hidden.

Here's what I have so far:

  • I have my free shipping items located in a master category called Free Shipping.
  • I installed FedEx and USPS modules.
  • I cloned the free shipping options module to freesoptionshide.
  • I added this to my new freeoptionshide module:
      // disable only when entire cart is free shipping

      if (zen_get_shipping_enabled($this->code)) {

          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONSHIDE_STATUS == 'False') ? true : false);
      }

	  // enable for one master_category (free shipping)
	  if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','17') > 0)) {
	    $this->enabled = true;
	  }

The problem with this logic is that if someone adds anything from the Free Shipping category, the whole order, including non-free-shipping-items, now has the option of free shipping.

How do I force the free shipping to only show when the entire cart is free shipping?

4 Feb 2009, 2:36 PM
#83
foxmob avatar

foxmob

New Zenner

Join Date:
Jul 2008
Posts:
14
Plugin Contributions:
0

Re: Different shipping methods for different categories

I think it would be easier to specify free shipping on a per item basis when you enter items into your catalog (radio button "always free shipping"). then that item isn't calculated in your shipping quote. and free shipping only kicks in when the entire order has no shipping cost. that's a vanilla feature of ZC. :-)

I'm not sure what difference it would make to force shipping calculations on free items when they're in a mixed order. the customer will just place two separate orders. one with free shipping. one without.

4 Feb 2009, 9:02 PM
#84
ladykaira avatar

ladykaira

New Zenner

Join Date:
Dec 2007
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

foxmob:

I think it would be easier to specify free shipping on a per item basis when you enter items into your catalog (radio button "always free shipping"). then that item isn't calculated in your shipping quote. and free shipping only kicks in when the entire order has no shipping cost. that's a vanilla feature of ZC. :-)

I'm not sure what difference it would make to force shipping calculations on free items when they're in a mixed order. the customer will just place two separate orders. one with free shipping. one without.

I do use the "Yes, Always Free Shipping" option on the free shipping items, but to make a free shipping icon show up on those items, I need to also place them in a Free Shipping master category.

This is the scenario without any of my changes to the freeoptions module.

  • Place ONLY a free shipping item in the cart, and there is the option for free shipping, as well as FedEx shipping options.
  • Place ONLY a normal shipping item in the cart, and free shipping option still shows up. Not good!

With my changes to the freeoptions module (freeoptionshide) this is what I get.

  • Place ONLY a free shipping item in the cart, and there is the option for free shipping, as well as FedEx options.
  • Place ONLY a normal shipping item in the cart, and only the FedEx options show up. Good!
  • Place BOTH a free shipping and normal shipping item in the cart, and now there is the option for free shipping. Not good!
4 Feb 2009, 11:04 PM
#85
ladykaira avatar

ladykaira

New Zenner

Join Date:
Dec 2007
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

:clap::clap::clap:

Well, I've managed to somehow get it working. I'm no coder, so if this has the potential to break anything major, please let me know!

     // enable only when entire cart is free shipping

      if (IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
	    $this->enabled = true;
	  }

      // disable when entire cart is not free shipping

      if (zen_get_shipping_enabled($this->code)) {

          $this->enabled = ((MODULE_SHIPPING_FREEOPTIONSHIDE_STATUS == 'False') ? true : false);
      }

That was all I needed.
Now:

  • Add ONLY a free shipping item to the cart, you get free shipping option as well as normal shipping options.
  • Add ONLY a normal item to the cart, you get only the normal shipping options.
  • Add BOTH a free shipping item and a normal item, you get only the normal shipping options.

I also have this restricted to the continental 48 states. Shipping to Hawaii, Alaska, etc gives only the option of normal shipping.

Hopefully this helps someone else who needs the same feature.

5 Feb 2009, 12:49 PM
#86
tiger avatar

tiger

New Zenner

Join Date:
Oct 2006
Posts:
56
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hey. This seems a simple edit but it doesn't work for me. Could it have anything to do with the fact that i used the Ultimate SEO Urls contribution and so the category numbers don't show up in my Urls?

5 Feb 2009, 7:45 PM
#87
ladykaira avatar

ladykaira

New Zenner

Join Date:
Dec 2007
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

tiger:

Hey. This seems a simple edit but it doesn't work for me. Could it have anything to do with the fact that i used the Ultimate SEO Urls contribution and so the category numbers don't show up in my Urls?

Are you referring to my edit?

5 Feb 2009, 8:11 PM
#88
tiger avatar

tiger

New Zenner

Join Date:
Oct 2006
Posts:
56
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hey
Thanks for getting back to me. I'm talking about the original edit:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabledCOLOR=#007700) {
$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; 
  }  [/COLOR]

Still can't figure what i'm doing wrong as it seems dead straight forward!

5 Feb 2009, 11:33 PM
#89
ladykaira avatar

ladykaira

New Zenner

Join Date:
Dec 2007
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

tiger:

Hey
Thanks for getting back to me. I'm talking about the original edit:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabledCOLOR=#007700) {
$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; 
  }  [/COLOR]

Still can't figure what i'm doing wrong as it seems dead straight forward!

Did you change the Master Category ID # to point to the category you want to apply this to? Like where '17' is, change it to your category ID.

6 Feb 2009, 9:14 AM
#90
tiger avatar

tiger

New Zenner

Join Date:
Oct 2006
Posts:
56
Plugin Contributions:
0

Re: Different shipping methods for different categories

I thanks for the reply. Yes, i did change it to the right category id. There are subcategories under it before you reach the products - does this matter? I did also try putting the subcategory id however and this didn't work either! Still miffed! :frusty:

14 Apr 2009, 10:09 PM
#91
helmetdecals avatar

helmetdecals

New Zenner

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

Re: Different shipping methods for different categories

Ajeh...you are awesome...it took me awhile...but I got it. I had to enter all the subcats individually to make it work.
Thanks
https://www.helmet-decals.com

15 Apr 2009, 1:43 PM
#92
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

tiger:

I thanks for the reply. Yes, i did change it to the right category id. There are subcategories under it before you reach the products - does this matter? I did also try putting the subcategory id however and this didn't work either! Still miffed! :frusty:

The reference to the master_categories_id needs to be the one in the products table ... not the parent of the categories inside of it ...

15 Apr 2009, 1:44 PM
#93
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

helmetdecals:

Ajeh...you are awesome...it took me awhile...but I got it. I had to enter all the subcats individually to make it work.
Thanks
https://www.helmet-decals.com

Thanks for the update ... perhaps you can post how you referenced the multiple categories to help out others ... :smile:

18 Apr 2009, 5:57 PM
#94
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Different shipping methods for different categories

I've been reading this thread quite a lot, trying to grasp what it is telling me and I think it will solve the problem I posted under taxes:
http://www.zen-cart.com/forum/showthread.php?t=125083. I will repeat it just to make sure that I am clear what I want to do.

I sell products that fall into two tax categories, a high and a low. Unfortunately the tax law states the shipping should be taxed according to the products being sold.

I've set up zone taxes so that in zones 1 and 2, the taxes apply and zone 3 they do not. My problem is that if someone orders a product from category 3 and only category 3, the tax on shipping falls into the low tax rate. If they order other products or a combination of category 3 and other products, the shipping is taxed on the high rate.

I've cloned zone rating so that one module adds the low shipping tax and another that adds the high shipping tax.

What I cannot quite yet grasp is the next step: how do I get the shipping module for the lower shipping tax to only appear when exclusively products from zone 3 are in the shopping cart?

I tried adding the code that Ajeh suggested on the first page of this thread, but am not quite sure if I need to add both the changes in reply 5 to the includes/modules/shipping/item.php as well as reply 9. Or does reply 9 do the trick. I tried a few times to just add what is in reply 9, but to no avail yet. May I assume that the master category ID number is the same number that appears in the admin page/catalog/categories-products-top page under ID?

21 Apr 2009, 8:52 AM
#95
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Different shipping methods for different categories

I have not received any answer in a week, so I will try to rephrase what I am asking.

I have two types of products that fall into two different tax rates. My problem is that these tax rates need to be reflected in the taxation of the shipping costs as well.

Example: product A is taxed 19%. It costs €3.50 to ship it to Germany, but the €3.50 needs to be taxed at 19%
Product B is taxed at 6%. It also costs €3.50 to ship to Germany, but the €3.50 shipping cost is now taxed only 6%.
If products A and B are bought and shipped to Germany, the shipping needs to be taxed at 19%.

I have set up zone shipping, but it is only possible to show one tax rate using that module. I therefore cloned the zone rate module so that one module uses the 6% tax rate on the shipping costs and the other uses the 19% shipping rate.
Both modules now function, but they both appear regardless of what is in the shopping cart.

I tried adding the mod that Ajeh suggested in reply 9 to the includes/modules/shipping/item.php:

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

but this didn't affect anything. I think that one of my problems is that I do not understand the basic concept of the master_categories_id. I tried adding different id numbers, but nothing seemed to make a difference.

Could somebody please help me here? How do I get the one shipping module to appear if only items from category 3 (the lower-taxed items) are in the shopping cart and the other shipping module to appear in all other cases (for all higher-taxed items as well as a mix of high and low taxed items). And could somebody explain the master_categories_id to me, or point me to a post where it is explained?

I've been searching here for a few weeks, reading everything I can, but need help! :(

21 Apr 2009, 7:19 PM
#96
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Different shipping methods for different categories

:clap: Got it, well almost. My mistakes were: adding the code to the wrong .php file (duh!). Master_categories_id is the id number of the lowest sub-category closest to the products.

I have been able to add more than two master-categories_id restrictions, but I think I'll play around with product types ids to see if that helps. Then get my mind around the permutations that Foxmob explained. If I understand correctly, since I only have two product types and two shipping mods, I only need three permutations, either A, B or AB where A uses Zone, B uses Zone2 and AB uses Zone. Thank you Cellmonsters, Foxmob and especially Ajeh for the explanations. Sorry for cluttering up this thread.

1 May 2009, 6:50 PM
#97
kunal avatar

kunal

New Zenner

Join Date:
May 2009
Posts:
86
Plugin Contributions:
0

Re: Different shipping methods for different categories

hey guys,

I have the table rate clone mod added. BUT i want only certain rates to apply to certain products.. but we have the master_category_id limited to 2, and the products_model only works if your models are all the same, which in my opinion, is not very organized.

i found the common denominator to be products_sort_order. now, for those who don't care about the sort order of your products within a category, this will be your solution:

// disable/enable for based on product sort order
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_sort_order','1') > 0)) {
// show shipping method
$this->enabled = true;
} else {
// hide shipping method
$this->enabled = false;
}

so, for example, if you are drop shipping like me, then have all product sort orders from one vendor be 1

and the next vendors products be sort order 2 and so on.

this can be updated in mass via .csv directly from the database tables export/import feature..

add this to whatever shipping method you want to use and only that will show up for that vendor..

now, if a customer adds products from multiple vendors then you have to have some sort of flat rate or table based on price for mixed products in cart. this is the only solution i've found, it's not very creative, but it gets the job done.

i hope this helps, i've been pulling my hair out on this issue like a lot of you..

oh! and to the developers, please look over the code and concept of this method.. let us know how we can improve it :smile:

8 May 2009, 3:23 PM
#98
bassface avatar

bassface

New Zenner

Join Date:
Jan 2005
Location:
Aurora, CO USA
Posts:
71
Plugin Contributions:
1

Re: Different shipping methods for different categories

Help! I'm almost there!
I've cloned the shipping module 'flat' and renamed it 'flathalf' (to differentiate between a full-year vs half-year delivery charge). I have it activated and believe it is working properly as it shows up in the Shipping Modules list.
I have 2 sub-categories under the main category Wine of the Month (cat. 66)

  • Wine of the Month - Full Year (cat. 72)
  • Wine of the Month - Half Year (cat. 71)

I added this code to 'flat' to make it not show on the half-year products and it works.

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

I added this code to 'flathalf' to make it not show on the full-year products and it doesn't work.

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

I have verified that the products do have the proper master_categories_id.

Did I mess something up with my cloning? Or is it in my code to disable each module?

8 May 2009, 3:34 PM
#99
bassface avatar

bassface

New Zenner

Join Date:
Jan 2005
Location:
Aurora, CO USA
Posts:
71
Plugin Contributions:
1

Re: Different shipping methods for different categories

Never mind. SOLVED

I had duplicate sort orders in the shipping modules, and that apparently caused a conflict. Once I gave each shipping module it's own sort order, it showed up.

8 May 2009, 4:12 PM
#100
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Thanks for the update ...

What happens is the shipping builds an array and the sort order is used and when you duplicate the sort order, it will overwrite the array for that sort order value ...

So it is always best to use Sort Orders and never duplicate them ... I like to number in 10s for easy resorting later ... :smile: