Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Tare Weight Calculations

Tare Weight Calculations

Locked

Views: 8,258

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
2 Mar 2008, 2:11 AM
#1
mauryg avatar

mauryg

Zen Follower

Join Date:
Jul 2006
Posts:
213
Plugin Contributions:
0

Tare Weight Calculations

I am a bit confused and I hope someone can clarify this.
According to the ZenCart Wiki, the Admin settings for shipping include:

Enter the Maximum Package Weight you will ship
(Admin - Catalog)
Most carriers have a maximum weight limit for a single package. This is a common one for all.
Default: 50 (assuming pounds)

Package Tare Small to Medium - added percentage:weight
(Admin - Catalog)
Here you define a % of product weight as packaging. This is expressed as two numbers separated by a colon. First number is a % of the weight of that will be your small package weight. Second is your small package weight maximum or upper limit.
Default: 0:3

Larger packages - added packaging percentage:weight
(Admin - Catalog)
Here you define a % of product weight as packaging. This is expressed as two numbers separated by a colon. First number is a % of the weight of that will be your large package weight. Second is your large package weight average or maximum or upper limit.
Default: 10:0
This would imply that the second number is the weight of the package WITH contents, NOT the tare weight of the EMPTY box.
But the calculations of shipping weight given in includes/classes/shipping.php are:

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

    if (is_array($this->modules)) {
      $shipping_quoted = '';
      $shipping_num_boxes = 1;
      $shipping_weight = $total_weight;

      $za_tare_array = split("[:,]" , SHIPPING_BOX_WEIGHT);
      $zc_tare_percent= $za_tare_array[0];
      $zc_tare_weight= $za_tare_array[1];

      $za_large_array = split("[:,]" , SHIPPING_BOX_PADDING);
      $zc_large_percent= $za_large_array[0];
      $zc_large_weight= $za_large_array[1];

      // SHIPPING_BOX_WEIGHT = tare
      // SHIPPING_BOX_PADDING = Large Box % increase
      // SHIPPING_MAX_WEIGHT = Largest package

      /*
      if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {
        $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
      } else {
        $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
      }
      */

      switch (true) {
        // large box add padding
        case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
          $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
          break;
        default:
        // add tare weight < large
          $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
          break;

This code implies that the $zc_tare_weight and $zc_large_weight are the weights of the EMPTY boxes as I would expect if I were calculating the TOTAL weight of the box plus contents plus packing material. And the instructions in the Admin>Configuration>Shipping section say that the numbers are:
(% weight as packaging) : (weight of packaging) which implies that I can state the % weight as packing material and the weight of the empty box as the absolute value. i.e.5% packing material PLUS 0.5 lbs for the box.
If I assume:

  1. the 2nd explanation is true, and
  2. the "maximum package weight" is the maximum allowed by the shipper, e.g. 70 lbs for USPS, and
  3. the tare weights for small and large boxes are different, then
    how does the calculation know when to use the small box and when to use the large box values? :frusty:
2 Mar 2008, 7:53 AM
#2
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Tare Weight Calculations

withdrawn

2 Mar 2008, 8:33 AM
#3
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Tare Weight Calculations

You have it right with the second version. It works just like described on the admin-> configuration-> shipping/packaging page.

  • number before the colon sets tare as a percentage of the sum product weights.
  • number after the colon sets tare as an absolute weight
    You can interprete whether the percentage should be packing material, the box or something else.

You can set tare as strictly a set amount (like 0:1), or as a percentage of sum product weight (2:0) or a combination of both (2:1).

I believe the Wiki is in error. I find in practice these calculations work as stated on the configuration screen:

i.e.:
Package Tare Small to Medium - added percentage:weight

What is the weight of typical packaging of small to medium packages?
Example: 10% + 1lb 10:1
10% + 0lbs 10:0
0% + 5lbs 0:5
0% + 0lbs 0:0

Ron

2 Mar 2008, 9:00 AM
#4
ronlee67 avatar

ronlee67

Totally Zenned

Join Date:
Sep 2006
Location:
Colorado Springs CO USA
Posts:
519
Plugin Contributions:
0

Re: Tare Weight Calculations

mauryg:

how does the calculation know when to use the small box and when to use the large box values? :frusty:

http://www.zen-cart.com/forum/showpost.php?p=483734&postcount=4

Ron