Forums / Bug Reports / Shipping Weight on Free Shipping Items

Shipping Weight on Free Shipping Items

Views: 800

Results 1 to 4 of 4
4 Aug 2014, 3:48 AM
#1
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Shipping Weight on Free Shipping Items

I had a strange item yesterday. I noticed that when an item has free shipping to lets say the Lower 48 States (USA) but a customer is in Alaska, can get the item shipping rate to them calculates a zero weight. so that means that 40lbs can go to Alaska for around $6.00. Anyone else experience this?

I think it's caused from includes/classes/shopping_cart.php lines#665-670 below:

     // adjusted count for free shipping
        if ($product->fields['product_is_always_free_shipping'] != 1 and $product->fields['products_virtual'] != 1) {
          $products_weight = $product->fields['products_weight'];
        } else {
          $products_weight = 0;
        }

once I change it to:

     // adjusted count for free shipping
        if ($product->fields['product_is_always_free_shipping'] != 1 and $product->fields['products_virtual'] != 1) {
          $products_weight = $product->fields['products_weight'];
        } else {
          $products_weight = $product->fields['products_weight'];
        }

It worked perfectly, but I think there must be a reason for this.

4 Aug 2014, 12:58 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Shipping Weight on Free Shipping Items

A product marked as Always Free Shipping is for everyone, regardless of the Zone set on the FREE SHIPPING! freeshipper unless you add code to manage that ...

I just ran through setting up v1.5.3 to have this work for Always Free Shipping to work for 1 Zone and show the other shipping modules at the same time with the following code changes ...

Edit the file:
/includes/classes/shipping.php

and add the code in RED:

  function calculate_boxes_weight_and_tare() {
    global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
[B]
// bof: allow 1 zone only for Always Free Shipping
// add zone to FREE SHIPPING! freeshipper
    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 = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

        if ($check_flag == false) {
          $total_weight += $_SESSION['cart']->free_shipping_weight;
        }
// bof: allow 1 zone only for Always Free Shipping
[/B]
    $this->abort_legacy_calculations = FALSE;
    $this->notify('NOTIFY_SHIPPING_MODULE_PRE_CALCULATE_BOXES_AND_TARE');
    if ($this->abort_legacy_calculations) return;

For UPS shipping, edit the file:
/includes/modules/shipping/ups.php

and add the code in RED:

[B]    // disable only when entire cart is free shipping
// bof: disabled for Always Free Shipping 1 zone to always show additional methods
//[/B]    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
[B]//[/B]    }
[B]// eof: disabled for Always Free Shipping 1 zone to always show additional methods
[/B]

Make a Zone for the US 48 State and DC and add it to the FREE SHIPPING! freeshipper shipping module ...

Make sure that the code for:

[B]        $valid_zone_id = 21;
[/B]

matches the value of your Zone that you added ...

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!

4 Aug 2014, 1:27 PM
#3
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Shipping Weight on Free Shipping Items

Couldn't MODULE_SHIPPING_FREESHIPPER_ZONE be used and to then avoid the hard coding of $valid_zone_id = 21; ?
Am I over thinking this or maybe making this due something it shouldn't?

4 Aug 2014, 1:39 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Shipping Weight on Free Shipping Items

That would actually work quite well and just changing the code to:

$valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;

is all that would be needed for that ...

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!