If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Built-in Shipping and Payment Modules / Free shipping on one category and one zone only

Free shipping on one category and one zone only

Started by pietpetoors on 3 Nov 2014, 3:44 PM · Views: 2,191

Results 1 to 20 of 20
3 Nov 2014, 3:44 PM
#1
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #1 by pietpetoors

I want to offer Free Shipping on certain products to only one zone.
At the Free shipping shipping module I selected the relevant zone.
But if I enable free shipping at those products it enables free shipping on all zones.

What am I doing wrong?

Only Dead Fish go with the flow

3 Nov 2014, 3:58 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

What version of Zen Cart are you using?

What Shipping Module(s) are you using?

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!

3 Nov 2014, 4:23 PM
#3
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #3 by pietpetoors

Version v1.5.1
I tried both the "freshipper" and "freeoptions" modules with the same results

Only Dead Fish go with the flow

3 Nov 2014, 4:34 PM
#4
ajeh avatar

ajeh

Oba-san

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

Post #4 by ajeh

Could you share with me the Shipping Module(s) you will be using for Normal Products, please?

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!

3 Nov 2014, 5:10 PM
#5
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #5 by pietpetoors

I use the table module for normal local products and for international parcels i use zones module

BUT I got the freeoptions to work now BUT there is still a problem. It now shows a value for local shipment (which is supposed to be free).
The amount it ads to local courier is far less than it would normally be.

At least now free shipment is not offered to International clients no more which is one step in the right direction.

Only Dead Fish go with the flow

3 Nov 2014, 5:16 PM
#6
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #6 by pietpetoors

Sorry, freeoptions is still not working, there was a product in the cart which is not marked "free shipping"

Only Dead Fish go with the flow

3 Nov 2014, 5:21 PM
#7
ajeh avatar

ajeh

Oba-san

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

Post #7 by ajeh

On your Table Rate and Zone Rate shipping modules, are they based on Weight?

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!

3 Nov 2014, 5:24 PM
#8
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #8 by pietpetoors

yes they are based on weight

Only Dead Fish go with the flow

3 Nov 2014, 5:33 PM
#9
ajeh avatar

ajeh

Oba-san

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

Post #9 by ajeh

It will be a bit before I have all of the custom code for this to allow Free Shipping based on Always Free Shipping only to the Zones that you want to allow this for, but I should have it soon ...

Have you already defined a Zone and added it to the FREE SHIPPING! freeshipper shipping module for those allowed to have Free Shipping?

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!

3 Nov 2014, 5:40 PM
#10
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #10 by pietpetoors

Yes, I added the relevant zone, but I now use freeoptions. I just read in the Zen Cart book that freeshipper will disable all other shipping options I have.

Only Dead Fish go with the flow

3 Nov 2014, 6:23 PM
#11
ajeh avatar

ajeh

Oba-san

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

Post #11 by ajeh

If you create a Zone Definition for who IS allowed to have Free Shipping for Products marked as Always Free Shipping, and add that Zone to the FREE SHIPPING! freeshipper shipping module ...

you can add the following code customizations in RED:
/includes/classes/shipping.php

  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
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
    global $db, $order, $cart;
        $valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;
        $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;
        }
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
// eof: allow 1 zone only for Always Free Shipping
[/B]
    $this->abort_legacy_calculations = FALSE;
    $this->notify('NOTIFY_SHIPPING_MODULE_PRE_CALCULATE_BOXES_AND_TARE');

/includes/modules/shipping/table.php

[B]// bof: allow 1 zone only for Always Free Shipping
//[/B]      if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
[B]//[/B]    }
[B]// eof: allow 1 zone only for Always Free Shipping
[/B]
    if ($this->enabled) {
      // check MODULE_SHIPPING_TABLE_HANDLING_METHOD is in
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLE_HANDLING_METHOD'");
      if ($check_query->EOF) {
        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_TABLE_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
      }
    }

[B]// bof: allow 1 zone only for Always Free Shipping
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
if (!IS_ADMIN_FLAG) {
    global $order, $db;
//echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';

        $valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;
        $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 == true) {
          if ($_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) {
            $this->enabled = false;
          } else {
            $this->enabled = true;
          }
        } else {
          $this->enabled = true;
        }
      }
// bof: allow 1 zone only for Always Free Shipping
[/B]
    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {

/includes/modules/shipping/zones.php

      // disable only when entire cart is free shipping
[B]// bof: allow 1 zone only for Always Free Shipping
//[/B]      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
[B]//[/B]      }
[B]// eof: allow 1 zone only for Always Free Shipping
[/B]
      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_zones = 3;

[B]// bof: allow 1 zone only for Always Free Shipping
// Always Free Shipping added back except for anyone in MODULE_SHIPPING_FREESHIPPER_ZONE
if (!IS_ADMIN_FLAG) {
    global $order, $db;
//echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';

        $valid_zone_id = MODULE_SHIPPING_FREESHIPPER_ZONE;
        $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 == true) {
          if ($_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) {
            $this->enabled = false;
          } else {
            $this->enabled = true;
          }
        } else {
          $this->enabled = true;
        }
      }
// bof: allow 1 zone only for Always Free Shipping
[/B]
      if (IS_ADMIN_FLAG === true) {
      // build in admin only additional zones if missing in the configuration table due to customization of default $this->num_zones = 3

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!

3 Nov 2014, 6:28 PM
#12
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #12 by pietpetoors

Thanx a million.
I will add it now and will let you know

Only Dead Fish go with the flow

3 Nov 2014, 6:40 PM
#13
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #13 by pietpetoors

WOW, Thanks, it is working.
Will do some more tests now to make sure it is working with all the products.

Attachment 14653Attachment 14653

Only Dead Fish go with the flow

3 Nov 2014, 6:41 PM
#14
ajeh avatar

ajeh

Oba-san

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

Post #14 by ajeh

You are most welcome ... thanks for the update that this is working for you ... :smile:

Remember the Zen Cart Team 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!

3 Nov 2014, 6:49 PM
#15
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #15 by pietpetoors

Ajeh, I have one more question. I use the zone module for my International courier.
If I want to add international airmail on the same basis but different rates, can I just copy and clone the zone module and create a zoneairmail module?

If I can, will the new zoneairmail module be influenced by the free shipping products like the other modules which we have just modified?

Only Dead Fish go with the flow

3 Nov 2014, 6:55 PM
#16
ajeh avatar

ajeh

Oba-san

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

Post #16 by ajeh

You should be able to clone it and use the same type of modifications ... just be careful when cloning to make all changes so that they are case sensitive ...

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!

3 Nov 2014, 7:03 PM
#17
pietpetoors avatar

pietpetoors

Zen Follower

Join Date:
Jun 2010
Location:
South Africa
Posts:
140
Plugin Contributions:
0

Post #17 by pietpetoors

Remember the Zen Cart Team when you are rich and famous!
I will :D

Only Dead Fish go with the flow

3 Nov 2014, 7:08 PM
#18
ajeh avatar

ajeh

Oba-san

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

Post #18 by ajeh

You might peek in the Plugins ... I have not looked at this in a long time, but I made a couple clones of Zone Rate zones:
http://www.zen-cart.com/downloads.php?do=file&id=977

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!

3 Nov 2014, 9:01 PM
#19
ajeh avatar

ajeh

Oba-san

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

Post #19 by ajeh

I made some minor code changes on my post that may or may not be needed for issues with REMOVE/INSTALL in the Admin ...

If you run into an issue, see if the changes help ...

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 Nov 2014, 7:25 PM
#20
ajeh avatar

ajeh

Oba-san

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

Post #20 by ajeh

See if this one helps you and let me know if you need it adapted for the USPS October 30, 2014 K6 version:
http://www.zen-cart.com/showthread.php?213235-Free-shipping-US-ONLY-products

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!