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,885

Results 421 to 440 of 554
7 Jan 2012, 5:13 PM
#421
starmands avatar

starmands

New Zenner

Join Date:
Sep 2010
Posts:
29
Plugin Contributions:
0

Different shipping methods for different categories

Hi, I'm looking for a similar solution to shipping as this one but can't find it. I basically want to use flat rate shipping for specific categories but still use per item shipping for others. It would be very useful if for example instead of a Zone in the flat rate shipping module it allowed you to enter categories.

Any help would be appreciated.

7 Jan 2012, 5:18 PM
#422
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

And what happens on a Mixed Cart when there are Products from multiple Categories and some are from the Flat Rate categories and some from the others ... :unsure:

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!

7 Jan 2012, 5:41 PM
#423
starmands avatar

starmands

New Zenner

Join Date:
Sep 2010
Posts:
29
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ideally, if a per item shipping charge product is chosen as well as a flat rate item I wouldn't charge the flat rate, I would include the flat rate product in the same box (because they are small and my per item products are large). I want store pickup to still appear considering this is always a free option for customers.

7 Jan 2012, 7:32 PM
#424
starmands avatar

starmands

New Zenner

Join Date:
Sep 2010
Posts:
29
Plugin Contributions:
0

Re: Different shipping methods for different categories

I think I found something that works. I installed the free shipping module and set a price, let's say $4. I went into the products that I wanted this to apply to and chose free shipping. When a customer selects those products only, at check-out it offers them the $4.00 price as well as a price by courier from my per item shipping module. If a customer chooses the free prodcuts as well as products that have not been chosen as free shipping the free shipping option does not appear and the customer only sees options for the per item shipping. This way I would include the smaller free products in the larger per item shipping box. I also changed the name from Free Shipping! to Flat Rate Shipping so my customer isn't confused by the charge.

14 Feb 2012, 5:24 PM
#425
rabbitnutrition avatar

rabbitnutrition

New Zenner

Join Date:
Sep 2011
Posts:
81
Plugin Contributions:
0

Re: Different shipping methods for different categories

ok
i've read and re-read but i can't seem to find my answer so here goes
at the moment i am only selling seeds so i have the seeds categories set up and working. it also has sub-categories.
i am using the flat rate of 90p for all seeds regardless of how many/few packs are seeds are bought.
it's working fine for me and i don't want to change the flat rate but...
i now want to add other categories that will also have sub-categories. i think i will have to use perweightunit but i don't know how to set it.
these are the postage prices i need to use:
for any amount of items that add to and not over the weight of 100gs, postage will be 90p
for any item/s that weigh up to 250g postage will be £1.72
for any item/s that weigh up to 500g postage will be £2.61
and so on...
i am a total newbie. hoping someone can guide me

14 Feb 2012, 5:54 PM
#426
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

If you want to use the Per Unit perweightunit shipping module, you can actually enter the shipping charger per quantity ...

So if a Product shipping cost per quantity is 1.72, just enter 1.72 ...

Now when that product is ordered:
quantity 1 x 1.72 = 1.72
quantity 2 x 1.72 = 3.44
quantity 3 x 1.72 = 5.16
etc. etc.

Now, you want to charge the 90 if there are any seeds in the order ...

Customize the function quote in the file:
/includes/modules/shipping/perweightunit.php

with the code in RED:

  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    // bof: charge .90 for master_categories_id 70, 76 and 78
    $extra_shipping = 0.00;
    $chk_cat = 0;
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','70');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','78');
    if ($chk_cat >= 1) {
      $extra_shipping = .90;
    }

    $total_weight_units = $shipping_weight;
    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
                                                   'cost' => MODULE_SHIPPING_PERWEIGHTUNIT_COST * ($total_weight_units * $shipping_num_boxes) +
                                                   (MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING) + $extra_shipping ) ));
    // eof: charge .90 for master_categories_id 70, 76 and 78


    if ($this->tax_class > 0) {

Now, just set the seed Products to have the weight of 0 ... in the Configuration ... Shipping/Packaging ... make sure that you have:
Maximum Weight 5000
Tara Rates at 0:0
Order Free Shipping 0 Weight Status set to 0

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!

14 Feb 2012, 6:10 PM
#427
rabbitnutrition avatar

rabbitnutrition

New Zenner

Join Date:
Sep 2011
Posts:
81
Plugin Contributions:
0

Re: Different shipping methods for different categories

i'm not sure if i'm explaining myself properly -sorry
i will be adding many new items and their weights are all goin to differ.
i need to charge these postage prices:
for any amount of items that add to and not over the weight of 100gs, postage will be 90p
for any item/s that weigh up to 250g postage will be £1.72
for any item/s that weigh up to 500g postage will be £2.61
and so on...
regardless of quantity
if the weight of a total order weighs up to 500g the postage needs to be £2.61 whether 2 items or 20 items have been bought.
what i'm trying to do is to charge postage by the total weight rather than per item

14 Feb 2012, 6:36 PM
#428
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

If the shipping is based on total weight of the order, then you could use either Table Rate table or Zone Rates zones ...

If you have the same prices for all Zones then the Table Rate table would work ...

And to manage the seeds, set their weight to 0 and use the custom code in there ...

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!

14 Feb 2012, 9:35 PM
#429
rabbitnutrition avatar

rabbitnutrition

New Zenner

Join Date:
Sep 2011
Posts:
81
Plugin Contributions:
0

Re: Different shipping methods for different categories

please can you also help me out with zones
i am struggling
i will be posting within the uk only

14 Feb 2012, 11:35 PM
#430
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Peek in the FAQs and do a search on:
Zone

and see if those help you clear up the confusion ... :blink:

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!

15 Feb 2012, 11:21 AM
#431
rabbitnutrition avatar

rabbitnutrition

New Zenner

Join Date:
Sep 2011
Posts:
81
Plugin Contributions:
0

Re: Different shipping methods for different categories

i have zone name UK zone description UK local sales tax zone status is a green button.
in details: country united kingdom zones all zones
this is right?
please can you help me understand this
Shipping Table
The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc
You can also use percentage amounts, such 25:8.50,35:5%,40:9.50,10000:7% to charge a percentage value of the Order Total

25:8.50
is the 25 the category id and the 8.50 the postage charge?

15 Feb 2012, 2:18 PM
#432
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

No the that is setup to represent either the Price, Weight or Item count vs the Rate to charge it has nothing to do with Categories ...

First, setup the Table Rate for what you want to charge based on weight ...

Next, you can customize the code for how much to charge for the seeds, example if the seeds use master_categories_id 70, 76 and 78 the code in RED would add the extra charge of .90 to the shipping when they are in the cart:

// bof: charge .90 for master_categories_id 70, 76 and 78
    $extra_shipping = 0.00;
    $chk_cat = 0;
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','70');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','76');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','78');
    if ($chk_cat >= 1) {
      $extra_shipping = .90;
    }

    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
    'cost' => $shipping + (MODULE_SHIPPING_TABLE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLE_HANDLING) + $extra_shipping ) ));
    // eof: charge .90 for master_categories_id 70, 76 and 78

    if ($this->tax_class > 0) {
      $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    }

adding your Zone for the UK to the Table Rate table shipping module will then only allow the UK to checkout ...

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 Feb 2012, 6:31 AM
#433
angellionel avatar

angellionel

New Zenner

Join Date:
Jan 2012
Posts:
11
Plugin Contributions:
0

Re: Different shipping methods for different categories

I have spent a good amount of time reading through all of the posts in this thread, and have tested several where what I want to happen almost works, but not quite. I am still perplexed as to how to use what has been posted for my particular case. :blush:

Here is what I am trying to do, but a bit of detail on settings first:

I have free shipping available for the lower 48 U.S. states for one category only. I created a zone for such, and installed the U.S.P.S. module for all others.

The shipping modules I have enabled are:

  • Free Shipping Options with lower 48 states zone included.
  • FREE SHIPPING! without lower 48 states zone included
  • United Sates Postal Service

What I am attempting to do is to have the U.S.P.S option not be displayed when the customer is from the lower 48 states and when the only items in the cart are from the one specific category, as items in that category will have free shipping. Only the free shipping option would be displayed. However, I do want both options (free shipping and U.S.P.S.) to be displayed if a customer from the lower 48 has selected an item from the free shipping category and another from a different category that does not.

If a customer is from outside the 48 lower states, then only the U.S.P.S option is displayed (or FedEx if added), as free shipping is not available.

Always Free Shipping is available to all only on gift certificates.

I hope I'm making sense. :unsure:

Any guidance or suggestions would be greatly appreciated. :D

20 Feb 2012, 2:07 PM
#434
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Gift Certificates are no Always Free Shipping ...

Mark them as:

Product is Virtual: Yes, Skip Shipping Address

Always Free Shipping: No, Normal Shipping Rules

and make sure that the Product Model starts with:
GIFT

in caps ... and they will be treated as free shipping as they are a Virtual Product ...

On the 1 Category that is Free Shipping for the US 48 do you have a weight on them for the Rest of the World?

This can get complicated to reduce the weight for the US 48 only on the 1 category ...

Do these Products in the US 48 Free Shipping Category only have weight on the products_weight or do they have weight on the Attributes too?

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 Feb 2012, 3:09 AM
#435
angellionel avatar

angellionel

New Zenner

Join Date:
Jan 2012
Posts:
11
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

Gift Certificates are no Always Free Shipping ...

Mark them as:

and make sure that the Product Model starts with:
GIFT

in caps ... and they will be treated as free shipping as they are a Virtual Product ...

On the 1 Category that is Free Shipping for the US 48 do you have a weight on them for the Rest of the World?

This can get complicated to reduce the weight for the US 48 only on the 1 category ...

Do these Products in the US 48 Free Shipping Category only have weight on the products_weight or do they have weight on the Attributes too?

Thank you for the reply! :D

I misspoke on the gift certificates. :blush: I just checked and I do have them as you suggest, and GIFT is also in all caps. Thanks! :smile:

What I have in the 1 category I cited is weight on the products but not on the attributes (Attributes Controller). :yes:

As to 'weight on them for the Rest of the World' I only entered the weight for each item under the Categories/Products listing.

Using the code you posted on the first page of this thread works for what I was attempting to do, except that anyone not from the lower 48 states is not presented with any shipping options, just the statement that the product is not available to them. :yes:

21 Feb 2012, 4:53 AM
#436
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

See if this works in the file:
/includes/classes/shipping.php

by adding the code in RED:

  function calculate_boxes_weight_and_tare() {
    global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

// bof: allow 1 zone only for free shipping for 1 zone
    global $db, $order, $cart;
        $valid_zone_id = 21;
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $valid_zone_id . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = false;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }
// eof: allow 1 zone only for free shipping for 1 zone

      if ($check_flag == true) {
// bof: reduce weight if Products are from master_categories_id 10 are in the cart
        global $order, $cart;
        $products = $_SESSION['cart']->get_products();
        $reduce_weight = 0;
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          if ($products[$i]['category'] == 10) {
            $reduce_weight += $products[$i]['weight'];
          }
        }

//echo 'reduce the weight! from: ' . $total_weight . '<br>';
        $total_weight = $total_weight - $reduce_weight;
//echo 'reduce the weight! to: ' . $total_weight . '<br>';
// eof: reduce weight if Products are from master_categories_id 10 are in the cart
      }

    if (is_array($this->modules)) {

Set the Zone id for your US 48 for the:
$valid_zone_id = 21;

and set the 10 to the master_categories_id for the Products that are Free to the US 48 ...

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 Feb 2012, 5:28 AM
#437
angellionel avatar

angellionel

New Zenner

Join Date:
Jan 2012
Posts:
11
Plugin Contributions:
0

Re: Different shipping methods for different categories

Thank you Ajeh!

I made the suggested changes except for the "Set the Zone id for your US 48 for the:
$valid_zone_id = 21;" line. I'm still trying to figure out which ID number was assigned to that specific zone. :dontgetit Only the name I used to create the zone (US48) is displayed when looking in the admin panel, not the corresponding ID#. I'll try the code once I figure it out. :smile:

21 Feb 2012, 5:50 AM
#438
angellionel avatar

angellionel

New Zenner

Join Date:
Jan 2012
Posts:
11
Plugin Contributions:
0

Re: Different shipping methods for different categories

Okay, I was able to obtain US48 zone's id # via the database. I made the change to the shipping.php file, uploaded it, and tested adding items to the cart using a test US account and one from outside the US 48 zone.

The US account still shows the USPS shipping option along with the free shipping option, so no change. What I would like is to only show the free shipping option.

The outside the US 48 zone test account shows only the USPS shipping option, same as before, which is okay.

I'm likely missing something simple though. :blush:

21 Feb 2012, 1:53 PM
#439
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Could we perhaps peek at your site and could you give us some of the products_id that are Free Shipping for the US and not for the Rest of the World? :unsure:

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 Feb 2012, 9:12 PM
#440
angellionel avatar

angellionel

New Zenner

Join Date:
Jan 2012
Posts:
11
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ajeh:

Could we perhaps peek at your site and could you give us some of the products_id that are Free Shipping for the US and not for the Rest of the World? :unsure:

It's a new site actually, and still trying to get everything together before opening it up. :yes:

I currently have free shipping to the lower 48 states only for one category. I am considering using free shipping for the other categories as well, though not sure about that yet.

By the way, I removed/uninstalled the USPS module since the distributors I will be using do not use deliver via USPS (dropshipping). Instead, now I am trying out the other methods, like Flat Rate and Zone Rate, to see which one works best for my needs.

In any case, it does not look as if I will need to make any code changes to the modules. What I had been trying to do before was to not show the USPS rates when free shipping was displayed for anyone in the lower 48 states, but that won't be an issue now. :smile:

Thank you for all your help Ajeh! I have to say that you are a very friendly and very helpful person. I'm sure everyone here appreciates that! :D