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

Different shipping methods for different categories

Views: 107,637

Results 101 to 120 of 554
26 Jun 2009, 5:01 AM
#101
fxn2 avatar

fxn2

New Zenner

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

Different shipping methods for different categories

Ajeh and everyone in here,
This is an excellent thread. I have been looking for solutions to my shipping problem. Let's just jump straight to my questions:

  1. Is there a way to differentiate a shipping method by items instead of using category? And this should be entered done in one of fields for the item. And if there are mix of shipping methods in shopping cart pick request for quote shipping method (this is one of the shipping module in download area).

  2. Is there a way to differentiate a shipping method by the higher category container than the one next to the item for example, I have the following nested category: Car->Year->Maker->BMW
    Now under BMW you have several cars (which is the actual item). The method that has been discussed in this thread is to filter on "master_category_id" which is BMW, is there anyway to filter based on Maker or Year and so on?

Of course there is always a question what happen if you have a mix category in the cart. My solution to this is to force a to a shipping method "Request for quote" which is one of the shipping method in download area.

This topic probably has been discussed somewhere in the thread, I might have missed it. Can someone help me out?

Thanks

24 Jul 2009, 9:41 PM
#102
spid3r1987 avatar

spid3r1987

Zen Follower

Join Date:
Jul 2009
Posts:
497
Plugin Contributions:
0

Re: Different shipping methods for different categories

hi there, sorry about this
i have 3 categories
cat A
cat B
cat C

Category A has a flat fee of 6.95
Category B has a flat fee of 12.50 + vat
Category C has a flat fee of <value>(unknown price as of yet)

if somebody orders from cat a and cat b, then option of PLEASE CALL for shipping quote

how would i sort this, please please help me

25 Jul 2009, 5:15 PM
#103
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 are looking at totally customized shipping modules to manage shipping based on these Category issues ...

26 Jul 2009, 2:26 PM
#104
spid3r1987 avatar

spid3r1987

Zen Follower

Join Date:
Jul 2009
Posts:
497
Plugin Contributions:
0

Re: Different shipping methods for different categories

so it requires alot of customisation?

26 Jul 2009, 3:20 PM
#105
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

It would need to check the categories_id based on the master_categories_id of the products table to determine all of the categories in the cart and then something to build the flat rate cost for each one ...

Not impossible to do, but definitely a custom job ...

19 Aug 2009, 2:49 PM
#106
jolla avatar

jolla

New Zenner

Join Date:
Mar 2009
Posts:
18
Plugin Contributions:
0

Re: Different shipping methods for different categories

Thank you for the great info!

I managed to set up a shipping module that only works with a specific category and I also managed to "hide" all other shipping options when a product from such category is selected.

I ran into a small "glitch" when it comes to the default shipping selection. In general the cheapest shipping option is selected but when applying this mod some funky things happen.

Lets say that there are 2 categories and one product in each category.
Category 1 can only use shipping 1 and 2.
Category 2 can only use shipping 3.

If you begin shopping and add a product from category 1, you will have one of shipping 1 or 2 by default and you can easily checkout.

Lets say you decide to change your mind on a product and go and replace it with product with Category 2, then when checking out you will have no shipping option selected by default. You will have to manually click the radio button for shopping 3.

This is a small annoyance but the same occurs with payment options too. So if I customize payment options too... it could be quite a problem. I have COD on some shipping options but not on others so it might apply COD fees even if they shouldnt be there...

any help is appreciated!!!

Thanks!!

31 Aug 2009, 7:09 AM
#107
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: Different shipping methods for different categories

Linda (or anyone else of course..)

While you're in the mood for answering questions about shipping... :)

We sell event tickets and customers can choose between shipping method "By Mail" or "Store Pickup", however, about 3 days before the actual event, I want to be able to disable the "By Mail" shipping option only for this particular product (event) as tickets will obviously not get there in time if they choose this method - so they should only be able to choose "Store Pickup" (or as we call it "Box Office Collection")

Is there a way to make this happen that you can think of?

Thanks

Cliff

31 Aug 2009, 7:56 AM
#108
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: Different shipping methods for different categories

I found an interim solution for your information:

As I am not using "weight" in the store, until I hear from you for a more elegant solution, what I've done is, that when a product (event) reaches 3 days before it's end date, then I assign a weight of "1" to it. In the "By Mail" shipping module I added the following code:

global $cart;
    if (IS_ADMIN_FLAG === true || $_SESSION['cart']->show_weight() > 1) {
        $this->enabled = false;
    }

immediately after this code:

$check->MoveNext();
      }

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }

which then disables the shipping method for the cart if the weight is "1" or more.

Of course if the customer has more than one event in the cart then the method will be disabled for both. Now need to scratch my head to get around that one!!

Cheers

Cliff

31 Aug 2009, 8:08 AM
#109
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: Different shipping methods for different categories

I should add that I used the same code very successfully as well in the PAYMENT MODULE, so that customers are precluded from paying by Check/Money Order or Direct Bank Transfer if the event (Product) is 3 days away (i.e. weight =1 or more). So they will only get presented with the PayPal or Credit Card payment methods.

Linda, as you always say - a whole new world of possibilities....

3 Sep 2009, 3:48 PM
#110
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Good use of the code on that ... :smile:

Creativity does help a lot on customization ... :cool:

16 Sep 2009, 6:04 PM
#111
webpdq avatar

webpdq

New Zenner

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

Re: Different shipping methods for different categories

I have read this thread through for several days and I am still unable to hide a shipping method.

I have two shipping methods, zone and item.

I checked in the products table and one of the items I wanted to only display item shipping had a master id of 6. I change it as below edited the item.php file.

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

Then I changed the zones.php to
// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','6') > 0)) {
// show
$this->enabled = false;
} else {
// hide
$this->enabled = true;
}
I switched the true and false in the last two statement. I even made them all false but nothing I do makes either of the shipping methods disappear.

In Products, I then edited the products_model to be 'book' (which is really what I want to do) and tried this code
// disable for one products_model
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','book') > 0)) {
// hide

      $this->enabled = false;
  } else {

// show
$this->enabled = true;
}
Still no luck. Can someone (Linda?) show me the error of my ways?
Here's my store's url. It is not live yet. Thanks!

16 Sep 2009, 7:33 PM
#112
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Did you add the line:

global $cart;

Just above the IF statement?

16 Sep 2009, 7:50 PM
#113
webpdq avatar

webpdq

New Zenner

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

Re: Different shipping methods for different categories

Thanks for the quick reply but I guess I put it in the wrong place because I did this in the zones.php file

define('MODULE_SHIPPING_ZONES_TEXT_TITLE', 'Zone Rates');
define('MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION', 'Zone Based Rates');
define('MODULE_SHIPPING_ZONES_TEXT_WAY', 'Shipping to');
define('MODULE_SHIPPING_ZONES_TEXT_UNITS', ' grams');
define('MODULE_SHIPPING_ZONES_INVALID_ZONE', 'No shipping available');
define('MODULE_SHIPPING_ZONES_UNDEFINED_RATE', 'The shipping rate cannot be determined at this time');
// disable for one master_categories_id
global $cart;
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','6') > 0)) {
// show UPS
$this->enabled = false;
} else {
// hide UPS
$this->enabled = true;
}
?>
And now I see this error text in my cart
PS $this->enabled = false; } ?> PS $this->enabled = true; } ?>
Obviously I put that statement in wrong place to get this syntax error. Can you take a look and tell me where I went wrong?

16 Sep 2009, 8:25 PM
#114
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

It looks like you stuck the new code in the bottom of the language file and not in the shipping code module ...

There are two files:
/includes/modules/shipping/zones.php
/includes/languages/english/modules/shipping/zones.php

You need to be customizing the file:
/includes/modules/shipping/zones.php

17 Sep 2009, 12:59 AM
#115
webpdq avatar

webpdq

New Zenner

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

Re: Different shipping methods for different categories

Geez, I knew I was missing something. Yea. It works for selecting on products_model 'book'. thank you thank you thank you.

Now one more questions... please. In this thread, people have mentioned cloning shipping methods. I need to clone the zone shipping methods. Can you tell me exactly which files I need to copy and rename?

Thanks again. You are a life saver.:clap:

For those just checking in, here's my code for zones.php which hides zones when the product model is book.

// disable for one products_model is books
global $db;
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','book') > 0)) {
// hide

$this->enabled = false;
} else {
// show
$this->enabled = true;
}

20 Sep 2009, 6:43 PM
#117
christmascoralfarm avatar

christmascoralfarm

New Zenner

Join Date:
Sep 2009
Posts:
1
Plugin Contributions:
0

Re: Different shipping methods for different categories

I know this is an older post, but it is relevant to me. Instead of just one master category, I want it to apply to several. How could I modify the code for that?

20 Sep 2009, 10:07 PM
#118
webpdq avatar

webpdq

New Zenner

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

Re: Different shipping methods for different categories

I got the this code to work by putting 'book" in the model and using that code that I posted a couple of days ago. So if you can use the model field in the product info, that should work. My main problem is now that my code works too well. I would really like it to just show item shipping when ALL the items are books. I am not a php programmer but I put this code together. The logic being that if the number of items in the cart are equal to the number of books in the cart then show item shipping. Here's my code. It does NOT work but maybe someone can show me how to fix it.
// disable when products_model is not all books this goes in item
global $db;
if (($total_count - $_SESSION['cart']->count_contents('products_model','book') = 0)) {
// show
$this->enabled = true;
} else {
// hide
$this->enabled = false;
}

21 Sep 2009, 11:26 AM
#119
ooba_scott avatar

ooba_scott

Zen Follower

Join Date:
Jul 2009
Posts:
218
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hi all, i have been trying to implement the code from page 1 into my table rate php file, but with no luck....it just doesnt seem to make any difference

Here is a little bit of info about what i am trying to achieve.....for ease lets say i have 2 categories, each with x amount of products in.

Category 1 is chairs, and needs 2 shipping options, 48hr delivery at £15 and 24hr delivery at £30. But if you buy 2 you get it for cost of one delivery rate ( hence why i chose table rate shipping)

Category 2 is stools, and needs 2 shipping options, 48hr delivery at £10 and 24hr delivery at £20. And once again if you buy 2 you get it for cost of one delivery rate

I decided that probably best way would be to duplicate the table shipping rate 3 extra times, and then only show 2 that is needed per category.

Sadly i cant seem to get the code from page one to work correctly ( i did change the category id to be my id, and changed it from ITEM to TABLE)

Where should this code be placed, and does it overwrite any other code?

Any help would be greatly appreciated!!

Thanks in advance

Scott

21 Sep 2009, 12:32 PM
#120
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

christmascoralfarm:

I know this is an older post, but it is relevant to me. Instead of just one master category, I want it to apply to several. How could I modify the code for that?

You can use multiple IF statements one for each of the categories ...