Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping on one category and one zone only

    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

    Code:
      function calculate_boxes_weight_and_tare() {
        global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
    
    // 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
    
        $this->abort_legacy_calculations = FALSE;
        $this->notify('NOTIFY_SHIPPING_MODULE_PRE_CALCULATE_BOXES_AND_TARE');
    /includes/modules/shipping/table.php
    Code:
    // bof: allow 1 zone only for Always Free Shipping
    //      if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
    //    }
    // eof: allow 1 zone only for Always Free Shipping
    
        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())");
          }
        }
    
    // 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
    
        if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
    /includes/modules/shipping/zones.php
    Code:
          // disable only when entire cart is free shipping
    // bof: allow 1 zone only for Always Free Shipping
    //      if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
    //      }
    // eof: allow 1 zone only for Always Free Shipping
    
          // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
          $this->num_zones = 3;
    
    // 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
    
          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
    Last edited by Ajeh; 3 Nov 2014 at 09:59 PM. Reason: minor code changes
    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: v1.5.5]
    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!

  2. #12
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    140
    Plugin Contributions
    0

    Default Re: Free shipping on one category and one zone only

    Thanx a million.
    I will add it now and will let you know
    Only Dead Fish go with the flow

  3. #13
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    140
    Plugin Contributions
    0

    Default Re: Free shipping on one category and one zone only

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

    Name:  yahoo.gif
Views: 96
Size:  6.2 KBName:  yahoo.gif
Views: 96
Size:  6.2 KB
    Only Dead Fish go with the flow

  4. #14
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping on one category and one zone only

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

    Remember the Zen Cart Team when you are rich and famous!
    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: v1.5.5]
    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!

  5. #15
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    140
    Plugin Contributions
    0

    Default Re: Free shipping on one category and one zone only

    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

  6. #16
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping on one category and one zone only

    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: v1.5.5]
    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. #17
    Join Date
    Jun 2010
    Location
    South Africa
    Posts
    140
    Plugin Contributions
    0

    Default Re: Free shipping on one category and one zone only

    Remember the Zen Cart Team when you are rich and famous!
    I will
    Only Dead Fish go with the flow

  8. #18
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping on one category and one zone only

    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: v1.5.5]
    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!

  9. #19
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping on one category and one zone only

    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: v1.5.5]
    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!

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Free shipping for products from one category only
    By Lazar in forum General Questions
    Replies: 1
    Last Post: 26 Jan 2012, 08:46 PM
  2. Urgent - One type of shipping for only one category
    By beyre in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 16 Oct 2009, 05:01 PM
  3. free shippings for one zone only
    By poosk in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 1 Dec 2007, 07:54 PM
  4. HELP... Shipping to one country only and that too free
    By enigma777 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 29 Nov 2006, 01:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR