Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Mixed category shipping calculation

Mixed category shipping calculation

Views: 3,952

Results 1 to 20 of 31
27 Oct 2014, 7:20 PM
#1
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Mixed category shipping calculation

My shipping cart with mixed category products won't calculate.
For my shipping cost calculations I cloned the zones module and have separate product category id's for each. In the shopping cart, shipping will currently calculate for anything in the same category group, but will not calculate for mixed products. I get "Sorry we are not shipping to your region at this time."
I came across this information regarding adding a function to calculate a mixed cart but have no idea where this would go. I guessing you copy from the the shipping class and add it somewhere else. Is this necessary in order for the shopping cart to calculate for products of different categories? Where does this code go?
I would appreciate any help as I've been struggling with this for 3 weeks and have not been able to find an answer that has worked.

thx

Attachment 14633

28 Oct 2014, 1:04 AM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

You have 3 posts about shipping but you have me confused on what exactly you are trying to do ...

I cannot tell if you really want to calculate the Item count per category based on the master_categories_id or if you are trying to obtain some piece of data from the Products using the in_cart_check or what ...

Then, because of your first post on shipping, it sounds like you are trying to make 3 separate Zone Rate totals depending on the group of categories_id and combine them together but do this on a per Zone basis ...

This is kind of like trying to calculate too much in too many ways where it is almost like a Zone Rate at a Product level based on the individual shipping Zones based on each separate Product ...

Could you slowly spell out your idea of shipping cost and the break down that you are trying to achieve and just use this one thread? Thanks!

28 Oct 2014, 5:21 AM
#3
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Hi, thanks,

I have 3 types of products which require different shipping cost calculations due to size and weight:
A)large books
B)postcards
c)Prints

I would like to be able to ship to 3 zones:
1)Canada
2)U.S.
3)World

I had decided to use the zones shipping module so I cloned it so I could have separate shipping calculations for each product type based on zones - zonesbooks, zonespostcards, and zonesprints.
This way if some one from the U.S. orders a book it's calculated differently than if someone in Canada orders one. So far this works fine if someone orders one type of product, books for example, or if they only order postcards. If, however someone orders books and postcards the shipping won't calculate and I get the "Sorry we are not shipping to your region at this time".

Hope this makes sense.

28 Oct 2014, 6:00 AM
#4
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Forgot to add I used the master category id's to define which products for which zones module with the following code:

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

/added to allow zonespostcards for shipping postcards id 22,23,24,25,26,12/

if (!IS_ADMIN_FLAG) {
global $cart;
$chk_categories = 0;
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','12');
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','22');
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','23');
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','24');
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','25');
$chk_categories += $_SESSION['cart']->in_cart_check('master_categories_id','26');
if ($_SESSION['cart']->count_contents() != $chk_categories) {
$this->enabled = false;
}
}

28 Oct 2014, 1:56 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

You have:

I have 3 types of products which require different shipping cost calculations due to size and weight:
A)large books
B)postcards
c)Prints

I would like to be able to ship to 3 zones:
1)Canada
2)U.S.
3)World

Can you give an example of what you are trying to charge for the large books, postcards and prints?

29 Oct 2014, 2:51 AM
#6
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

You have:

Can you give an example of what you are trying to charge for the large books, postcards and prints?

The books are large but light.
The books Zone 1 are:
1 = 17.50
2 = 17.50 + .75
3 = 17.50 + 1.50
4 = 17.50 + 2.25
etc.
The books Zone 2 are:
1 = 20.00
2 = 20.00 + 3.05
3 = 20.00 + 6.10
4 = 20.00 + 9.15
etc.

Postcards Zone 1 are:
1 - 10 = 2.75
11 - 20 = 3.40
21 - 30 = 4.05
etc.
postcards Zone 2 are:
1 - 10 = 4.60
11 - 20 = 5.84
21 - 30 = 7.57
etc

I' haven't done the world calculations yet, or the print pricing which may be similar to books depending on how I package them. Currently I'm looking to start with the books and postcards then expand from there.

2 Nov 2014, 2:14 AM
#7
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

lot49:

The books are large but light.
The books Zone 1 are:
1 = 17.50
2 = 17.50 + .75
3 = 17.50 + 1.50
4 = 17.50 + 2.25
etc.
The books Zone 2 are:
1 = 20.00
2 = 20.00 + 3.05
3 = 20.00 + 6.10
4 = 20.00 + 9.15
etc.

Postcards Zone 1 are:
1 - 10 = 2.75
11 - 20 = 3.40
21 - 30 = 4.05
etc.
postcards Zone 2 are:
1 - 10 = 4.60
11 - 20 = 5.84
21 - 30 = 7.57
etc

I' haven't done the world calculations yet, or the print pricing which may be similar to books depending on how I package them. Currently I'm looking to start with the books and postcards then expand from there.

Does this make sense? Is there a better way to be calculating the shipping? Can you make a cart of mixed zones shipping calculate together?

4 Nov 2014, 4:04 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

The only thing I can think to do is write a completely custom shipping module for your shipping then clone it for your 3 Zones ...

14 Nov 2014, 6:01 AM
#9
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

The only thing I can think to do is write a completely custom shipping module for your shipping then clone it for your 3 Zones ...

Thanks Ajeh.
I don't know much coding. What would it cost to have someone write a custom shipping module?

I was wondering if I could maybe clone the item module for each product group requiring a specific calculation, and then use the master id's to specify which item module to use. Would that work for combining shipping cost totals?

14 Nov 2014, 3:21 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

Let's break this into steps ...

First, let's identify the 3 Product groups:
Books
Postcards
Prints

How on your site, can these be identified?

Perhaps an url to your site would be helpful to see if what you are explaining in the identity of these Product groups is what I am specifically asking for ...

16 Nov 2014, 3:40 AM
#11
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

Let's break this into steps ...

First, let's identify the 3 Product groups:
Books
Postcards
Prints

How on your site, can these be identified?

Perhaps an url to your site would be helpful to see if what you are explaining in the identity of these Product groups is what I am specifically asking for ...

Thanks, Ajeh.

Here's the link.
http://limeblackdesign.com/perspicuus/

17 Nov 2014, 4:55 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

On your Postcard shipping, you have a logical progression for:

Postcards Zone 1 are:
1 - 10 = 2.75
11 - 20 = 3.40
21 - 30 = 4.05
etc.

of adding $0.65 per 10 additional cards ...

But I am not finding anything logical about Zone 2:

postcards Zone 2 are:
1 - 10 = 4.60
11 - 20 = 5.84
21 - 30 = 7.57
etc

18 Nov 2014, 7:36 AM
#13
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

On your Postcard shipping, you have a logical progression for:

of adding $0.65 per 10 additional cards ...

But I am not finding anything logical about Zone 2:

That can be adjusted to a standard sequence. Would that be throwing off the cart calculations?
Any other observations/suggestions on how I might set-up the shipping?

18 Nov 2014, 1:46 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

Have a standard calculation makes this a lot easier to clone for each zone ...

What is the 3rd calculation for the Prints?

I have the other two worked out, but it would help to have the calculation for the Prints so that I can give you a complete shipping fix ...

1 Dec 2014, 7:10 AM
#15
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

Have a standard calculation makes this a lot easier to clone for each zone ...

What is the 3rd calculation for the Prints?

I have the other two worked out, but it would help to have the calculation for the Prints so that I can give you a complete shipping fix ...

Hi Ajeh,
sorry I couldn't get back sooner.
for the prints I'm figuring:

Canada (zone 1):
1-10: $15.00
11-20: $17.50

U.S.A. (zone 2):
1-5: $10.50
6-10: $13.20
11-15: $18.60

1 Dec 2014, 2:04 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

lot49:

Hi Ajeh,
sorry I couldn't get back sooner.
for the prints I'm figuring:

Canada (zone 1):
1-10: $15.00
11-20: $17.50

U.S.A. (zone 2):
1-5: $10.50
6-10: $13.20
11-15: $18.60

What happens after Canada on 21 prints and after USA on 16 prints?

For Canada are you trying to charge 13.50 + 2.50 for each group of 10?

For the USA, I am not seeing the pattern on the charges ...

9 Dec 2014, 7:42 AM
#17
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

What happens after Canada on 21 prints and after USA on 16 prints?

For Canada are you trying to charge 13.50 + 2.50 for each group of 10?

Yes, that's correct.

For the USA, I am not seeing the pattern on the charges ...

I've refigured the U.S. to make more sense:

1-5 - $8.03
6-10 - $10.69 (8.03 + 2.66)
11-15 - $13.35 (10.69 + 2.66)
16-20 - $16.01 (13.35 + 2.66)
etc.

10 Dec 2014, 8:17 AM
#18
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

As per the previous question: Yes, that is correct for Canada $13.50+2.50 for each additional 10.

11 Dec 2014, 6:01 PM
#19
ajeh avatar

ajeh

Oba-san

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

Re: Mixed category shipping calculation

See if this shipping module that I wrote for you works ...

You will want to edit the file:
/includes/modules/shipping/categoriesitem.php

and change the 3 Parent categories_id to match yours:

// bof: calculate books shipping cost
      $chk_cat = '73'; // parent categories_id for books
// bof: calculate postcard shipping cost
      $chk_cat = '66'; // parent categories_id for postcards
// bof: calculate prints shipping cost
      $chk_cat = '79'; // parent categories_id for prints

I believe all of the calculation methods used will match what you have defined so far.

This will make all Products that are in the subcategories for each main Category (Postcards, Books and Prints) be calculated correctly ...

Any Product not in the subdirectories within those 3 Categories will be charged based on the actual Item Rate of the module. This means if you had any other Top Category with Products or Top Category with subcategories with products that are not in those 3 main Categories, then they will obtain a charge of the Item Rate * Quantity.

16 Dec 2014, 4:06 AM
#20
lot49 avatar

lot49

New Zenner

Join Date:
Oct 2014
Location:
New Westminster, B.C. CANADA
Posts:
34
Plugin Contributions:
0

Re: Mixed category shipping calculation

Ajeh:

See if this shipping module that I wrote for you works ...

You will want to edit the file:
/includes/modules/shipping/categoriesitem.php

and change the 3 Parent categories_id to match yours:

// bof: calculate books shipping cost
$chk_cat = '73'; // parent categories_id for books

> 
> ```
// bof: calculate postcard shipping cost
      $chk_cat = '66'; // parent categories_id for postcards

// bof: calculate prints shipping cost
$chk_cat = '79'; // parent categories_id for prints

> 
> I believe all of the calculation methods used will match what you have defined so far.
> 
> This will make all Products that are in the subcategories for each main Category (Postcards, Books and Prints) be calculated correctly ...
> 
> Any Product not in the subdirectories within those 3 Categories will be charged based on the actual Item Rate of the module. This means if you had any other Top Category with Products or Top Category with subcategories with products that are not in those 3 main Categories, then they will obtain a charge of the Item Rate * Quantity.

Hi Ajeh,
Thank you. It works for the postcards, but not for books or prints - it doesn't give any cost for shipping.