If this is your first visit, check our documentation. To post, register or login.
Forums / Built-in Shipping and Payment Modules / Different shipping methods for different categories

Different shipping methods for different categories

Started by tylerd213 on 13 Mar 2008, 2:16 AM · Views: 107,884

Results 201 to 220 of 554
18 Dec 2009, 2:22 AM
#201
ajeh avatar

ajeh

Oba-san

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

Different shipping methods for different categories

What happens when I order 2 Products from 1 of the 5 categories_id and 10 Products from the other 15 categories_id ...

Is the low order amount based on the "order total" or is it based on the total of just those 2 Products ...

Or, do you just care if the "low order total" is <= "order total" when ALL of the Products in the cart come from the 5 categories_id ...

Or ... could you get really, really specific here and type really, really slow ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Dec 2009, 8:48 PM
#202
bfunk1972 avatar

bfunk1972

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: Different shipping methods for different categories

Thanks again.
The way it's going to be set up is - the categories will be exclusive to different customers.
I change the wording from low order fee to "handling fee".
Some categories will have the handling fee and some will not.
So clients will only be ordering from one categorie and categories will never be mixed in the carts.

19 Dec 2009, 5:22 AM
#203
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Would something like this work:

// count how many products are in the cart from various categories
// add a new check for each categories_id to match a master_categories_id
global $cart;
$chk_cats = 0;
$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','10');

if ( ($pass == true) && ($chk_cats > 0) ) {
  $pass = 'true';
}
//        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
        if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {

This example is testing for products in the categories_id 4 and 10 where master_categories_id match these values ...

You can use the code:

$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','10');

for each categories_id you need to check for by just adding them one by one and just change the 10 to the master_categories_id that needs to be checked in the cart ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Dec 2009, 5:33 AM
#204
bfunk1972 avatar

bfunk1972

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: Different shipping methods for different categories

This did not work but it's the concept I'm looking for.
I'd like to be able to add additional categories like you did here:
"$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','10');"

Here is the code I am using. (it's on line 37 of includes/modules/order_total/ot_loworderfee.php)

// if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
if ( ($pass == true) && ($_SESSION['cart']->in_cart_check('master_categories_id','2') > 0) ) {
$charge_it = 'true';
$cart_content_type = $_SESSION['cart']->get_content_type();
$gv_content_only = $_SESSION['cart']->gv_only();
if ($cart_content_type == 'physical' or $cart_content_type == 'mixed') {
$charge_it = 'true';
} else {

20 Dec 2009, 5:51 AM
#205
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 gives the number of products in multiple categories for categories 4 and 10 ... just keep adding new lines until all are covered and the $chk_cats will have the number of items from all the categories checked:

// count how many products are in the cart from various categories
// add a new check for each categories_id to match a master_categories_id
global $cart;
$chk_cats = 0;
$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_cats += $_SESSION['cart']->in_cart_check('master_categories_id','10');

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Dec 2009, 1:47 PM
#206
bfunk1972 avatar

bfunk1972

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: Different shipping methods for different categories

how would I incorporate that into my code above?
sorry, I'm new at this. :wacko:

20 Dec 2009, 3:45 PM
#207
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 using this IF statement:

if ( ($pass == true) && ($_SESSION['cart']->in_cart_check('master_categories_id','2') > 0) ) {

After all the calculations are done you can use, instead the total in:
$chk_cats

By replacing it with:

if ( ($pass == true) && ($chk_cats > 0) ) {

So by adding a line for each category to the code above that, you can add as many categories that you want to check the master_categories_id on ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Dec 2009, 6:30 PM
#208
bfunk1972 avatar

bfunk1972

New Zenner

Join Date:
Nov 2009
Posts:
8
Plugin Contributions:
0

Re: Different shipping methods for different categories

THANKS !!! That did it !!
You are a life saver !!
Thanks Again.:clap:

20 Dec 2009, 7:38 PM
#209
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 most welcome ... thanks for the update that this worked for you ...

Remember us when you are rich and famous ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Dec 2009, 10:11 PM
#210
colema avatar

colema

New Zenner

Join Date:
Dec 2009
Location:
California
Posts:
25
Plugin Contributions:
0

Re: Different shipping methods for different categories

Alright... So, I asked a question similar to this once before - and I thought I got it answered...but now I'm not so sure.

MY ISSUE:
I have two products (in category 1) that cannot be shipped together. Fortunately, they are the heaviest products, and so I was able to fix that by lowering the maximum permitted weight per box to where they barely won't fit together. However, there is one of the nine products (in category 2) that cannot ship with the products in category 1 simply because it won't fit in the box. It is a relatively lightweight product, however, and so the weight rule won't work with it.

MY CURRENT SETTINGS:
I have a mod installed to allow UPS to read the dimensions of my products - because of the oversizedness of the products in category 1. The kits in category 1 are as follows:
21 lb
45" x 20" 10"

So, my box weight limit is 40lb, which automatically disallows the two kits to be in a box together.

However, the bucket (in category 2) is as follows:
3 lb
16" x 14" x 14"
So, obviously it is too light to get thrown into a second box with the weight limit, and I can't lower the weight limit to accommodate it because than other items, which are heavier, won't be able to be included in with the products in category 1.

Any thoughts would be helpful!

5 Mar 2010, 7:43 PM
#211
flipperry avatar

flipperry

New Zenner

Join Date:
Feb 2009
Posts:
79
Plugin Contributions:
0

Re: Different shipping methods for different categories

:dontgetit

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

Where would I put this code in the freeshipper.php and storepickup.php files? I already have the code in my other shipping modules, just not sure since there isn't a line that says:

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

I am going to be putting some items in a category that have to use this shipping method, but if there aren't any items from category "C", then they can use other shipping options, but if there are items from category "C", then only one shipping method (Zones Table Rate from add on section) can be used.

Example 1: 1 Item from category A = normal shipping options WITHOUT Zones Table Rate

Example 2: 1 Item from category A, 1 Item from Category "C" = Zones Table Rate ONLY!

Example 3:1 Item from Category "C" = Zones Table Rate ONLY!

Thank you!:smile:

Flip Perry
S~Scents

5 Mar 2010, 8:41 PM
#212
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

The FREE SHIPPING! freeshipping shipping module is a "Special" kind of shipping module and when it is showing, no other shipping module is showing ...

You really want to use the Free Shipping Options freeoptions shipping module so you can control when it shows at the same time as when other shipping modules are showing ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Mar 2010, 8:47 PM
#213
flipperry avatar

flipperry

New Zenner

Join Date:
Feb 2009
Posts:
79
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

The FREE SHIPPING! freeshipping shipping module is a "Special" kind of shipping module and when it is showing, no other shipping module is showing ...

You really want to use the Free Shipping Options freeoptions shipping module so you can control when it shows at the same time as when other shipping modules are showing ...

If something is free shipping, then it won't be added to the shipping cost, right? We only have one item that is FREE and FREE SHIPPING, and it is marked that way in the product set-up.

But what about the storepickup.php file? That one only shows when I enable it for special customers (i.e. friends that don't want to pay for shipping when they can just walk down the road to pick up the order) but if they order items from Category "C" it is shipped from the other side of the country! (It's a drop-ship program...). Where would I need to put the "IF" statement in this file?

Flip Perry
S~Scents

5 Mar 2010, 11:33 PM
#214
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

When something is marked Always Free Shipping or 0 weight and 0 weight is defined as Free Shipping then the Free Shipping freeshipper is used ...

When something is marked as Always Free Shipping or 0 weight and when shipping is by weight or price or item count on an order with Products that use shipping these items are not included in shipping charges ...

I am not sure what all shipping you are using as you seem to reference you are using other methods ... could you list them all and on Zones or Table if you are using Price or Weight or Item Count?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Mar 2010, 3:25 AM
#215
flipperry avatar

flipperry

New Zenner

Join Date:
Feb 2009
Posts:
79
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

When something is marked Always Free Shipping or 0 weight and 0 weight is defined as Free Shipping then the Free Shipping freeshipper is used ...

When something is marked as Always Free Shipping or 0 weight and when shipping is by weight or price or item count on an order with Products that use shipping these items are not included in shipping charges ...

I am not sure what all shipping you are using as you seem to reference you are using other methods ... could you list them all and on Zones or Table if you are using Price or Weight or Item Count?

I am using the following:
(All of the ones that are "name"2.php are copied from their original counterparts, with global replaces on all of them)

freeshipper2.php

storepickup2.php (installed, but not currently active. This is the one I'm not sure where to put the code at since there isn't a "disable if all items are free shipping" line of code)

ups2.php (has the "IF" code installed to disable if category "C" is present)

usps2.php (updated to the Jan. 4th, 2010, and has the "IF" code to disable if category "C" is present)

zonetable.php (from add on section, has the "IF" code, but this one is the one that can ONLY show if category "C", and then be the ONLY option even with other items from other categories)

I just reversed the "True" and "False" from the code you posted WAY earlier in this thread for the shipping modules that I want disabled.

And the zonetable.php is set to price.

Flip Perry
S~Scents

6 Mar 2010, 4:16 AM
#216
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

On store pickup, are you saying if there is Free shipping that they cannot pick it up at the store?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Mar 2010, 6:12 AM
#217
flipperry avatar

flipperry

New Zenner

Join Date:
Feb 2009
Posts:
79
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

On store pickup, are you saying if there is Free shipping that they cannot pick it up at the store?

No. I don't think I need the code in the freeshipper2.php since that is only triggered if ALL of the items in the cart are marked as free shipping....... Right? It's just that I don't want anyone to try to do store pickup or ANY other shipping option besides the zonetable for orders that contain items from category "C". These items are shipped by a drop shipper on the other side of the country, and I don't want them to try and pick up an item that we don't have in stock.

:dontgetitI just need to know where in the storepickup2.php file I need to put the "IF" code:

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

That way, if there is an item from "C" PLUS an item from any other category (even the free item), or just an item from "C", the only option that can show is the zonetable. They can use any payment option (I even have an in-store cash payment option for certain people, such as friends, so they don't have to pay online), I just don't want any other shipping option to show up besides the zonetable one.

Flip Perry
S~Scents

6 Mar 2010, 5:02 PM
#218
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Now I get it ... :smile:

Look at Category C and find out what its categories_id is ...

Are all of the Products in Category C using this as the master_categories_id

If so, then use that value for C ...

Place the IF statement underneath this line for the Store Pick Up storepickup shipping module ...
$this->enabled = ((MODULE_SHIPPING_STOREPICKUP_STATUS == 'True') ? true : false);

Above the IF you need to add:
global $cart;

so you can test the cart contents ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

26 Mar 2010, 2:10 AM
#219
pamcc avatar

pamcc

New Zenner

Join Date:
Aug 2009
Posts:
16
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hi. Was working on this also... but had an issue...

I have two shipping modules enabled- USPS and Per Unit

If there are products on the cart under Laptop Category, then USPS is disabled.

But what if on the cart there are products from Laptop Category and from other categories?

Right now, of course, USPS is disabled and it's all using the Per Unit.

:dontgetit

26 Mar 2010, 3:27 AM
#220
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 have to decide what you want to happen and customize your shipping modules accordingly ...

There can only be 1 shipping module ...

You are trying to use both USPS and Per Unit perweightunit and those would conflict when there are both kinds of products in the cart at the same time as the Per Unit perweightunit is using the weight field as the actual shipping price and the USPS is using the weight field as the actual weight of the Product ...

This is going to conflict on a mixed cart ...

The USPS module is going to attempt to use the weight of a product setup to use the weight as the shipping cost as the actual weight and that will not calculate right ...

You might need to post in the commercial help wanted forum and have someone write something specific for you to manage this properly for mixed carts ...

Something like a separate field to handle the shipping cost that you are currently using the weight field for the Per Unit perweightunit so that when you have a mixed cart the amount could be added to the USPS rate quotes ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!