Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28
  1. #21
    Join Date
    Dec 2010
    Posts
    142
    Plugin Contributions
    0

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Quote Originally Posted by Ajeh View Post
    Have you a link to that add on? I am not following how a clone of Flat Rate flat is calculating shipping regarding weight ...
    http://www.zen-cart.com/downloads.php?do=file&id=1224

    It doesn't actually calculate shipping... that's the point of the add-on... I calculate the shipping manually, email the customer the shipping quote, then they enter what I tell them themselves in the text entry box that this add-on creates.

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

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    What version of Zen Cart are you using?

    What is the Zone Definition for the USA set to on the id?
    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!

  3. #23
    Join Date
    Dec 2010
    Posts
    142
    Plugin Contributions
    0

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Quote Originally Posted by Ajeh View Post
    What version of Zen Cart are you using?

    What is the Zone Definition for the USA set to on the id?
    1.39h....

    I'm not quite sure what you are asking for regarding the zone definition..... When I click Admin > Locations/Taxes > Zone Definitions > USA >

    It says: Country: United States Zone: All Zones

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

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    If you look at the URL ... what is the zID for that Zone Definition that you see in the URL?
    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. #25
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Once you know the Zone Definition id number, you can replace the 21 that I use with your value ...

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

    and add the code in RED:
    Code:
      function calculate_boxes_weight_and_tare() {
        global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
    
    // Always Free Shipping added back except for US 48 plus DC zone_id = 21
    // bof: allow 1 zone only for Always Free Shipping
        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;
            }
    // eof: allow 1 zone only for Always Free Shipping
    // Always Free Shipping added back except for US 48 plus DC zone_id = 21
    
        if (is_array($this->modules)) {
    Then customize your Flat Rate flat clone ...

    I am using the Flat Rate flat module so just adapt the code to your Flat Rate clone with the code in RED:
    Code:
          // disable only when entire cart is free shipping
    //      if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
    //      }
    Code:
    // class methods
        function quote($method = '') {
          global $order;
    
    global $shipping_weight;
    //echo 'Flat $shipping_weight: ' . $shipping_weight . ' $total_weight: ' . $total_weight . '<br>';
    if ($shipping_weight > 0) {
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                                'methods' => array(array('id' => $this->code,
                                                         'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                         'cost' => MODULE_SHIPPING_FLAT_COST + $chk_weight_charge)));
    }
    
          if ($this->tax_class > 0) {
    On the FREE SHIPPING! freeshipper add your Zone for the US to that module ...

    See if this makes it work for you ...
    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!

  6. #26
    Join Date
    Dec 2010
    Posts
    142
    Plugin Contributions
    0

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Quote Originally Posted by Ajeh View Post
    Once you know the Zone Definition id number, you can replace the 21 that I use with your value ...

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

    and add the code in RED:
    Code:
      function calculate_boxes_weight_and_tare() {
        global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
    
    // Always Free Shipping added back except for US 48 plus DC zone_id = 21
    // bof: allow 1 zone only for Always Free Shipping
        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;
            }
    // eof: allow 1 zone only for Always Free Shipping
    // Always Free Shipping added back except for US 48 plus DC zone_id = 21
    
        if (is_array($this->modules)) {
    Then customize your Flat Rate flat clone ...

    I am using the Flat Rate flat module so just adapt the code to your Flat Rate clone with the code in RED:
    Code:
          // disable only when entire cart is free shipping
    //      if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
    //      }
    Code:
    // class methods
        function quote($method = '') {
          global $order;
    
    global $shipping_weight;
    //echo 'Flat $shipping_weight: ' . $shipping_weight . ' $total_weight: ' . $total_weight . '<br>';
    if ($shipping_weight > 0) {
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                                'methods' => array(array('id' => $this->code,
                                                         'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                         'cost' => MODULE_SHIPPING_FLAT_COST + $chk_weight_charge)));
    }
    
          if ($this->tax_class > 0) {
    On the FREE SHIPPING! freeshipper add your Zone for the US to that module ...

    See if this makes it work for you ...
    Linda,

    Thanks so much for your help and time. I got it working perfectly now so that ALWAYS FREE SHIPPING products do not offer the free shipping option for zones outside the USA. This solution worked for me. THANK YOU!

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

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Thanks for the update that this is working for you to offer Always Free Shipping to just one zone ...
    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!

  8. #28
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Calculated shipping doesn't show up when an item is free shipping.

    Here's an Observer class that can be added to a v1.5.5 site to skip the need to edit the shipping.php file as shown in post #25 above:

    Install it as /includes/classes/observers/auto.free_shipping_override_for_international.php
    Code:
    <?php
    /**
     * @package plugins
     * @copyright Copyright 2003-2017 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: Designed for v1.5.5+  $
     */
    
    
    class zcObserverFreeShippingOverrideForInternational extends base {
    
    
      function __construct() {
        $this->attach($this, array('NOTIFY_SHIPPING_MODULE_PRE_CALCULATE_BOXES_AND_TARE'));
      }
    
    
    // For items that are marked as always_free_shipping, check the shipping zone, and if not in the zone-limits for FreeShipper, reset the free-shipping to 0
      function updateNotifyShippingModulePreCalculateBoxesAndTare(&$class, $eventID, $null, $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes)
      {
        global $db, $order;
        if (isset($order) && isset($order->delivery)) {
          $check_flag = false;
          $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREESHIPPER_ZONE . "' 
                                  and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
          while (!$check->EOF) {
            if ($check->fields['zone_id'] < 1) {
              // 0 = all zones match; therefore restriction is imposed
              $check_flag = true;
              break;
            } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
              // zone matches; therefore restriction is imposed
              $check_flag = true;
              break;
            }
            $check->MoveNext();
          }
          if ($check_flag == false) {
            // no matches for free-shipping zones, so treat as chargeable instead of free shipping
            $total_weight += $_SESSION['cart']->free_shipping_weight;
          }
        }
      }
    
    
    
    
    }
    Then configure the FreeShipper shipping module to have a "Shipping Zone" for the country/states that you wish to allow free shipping.

    The observer will use that zone to determine when to restore the shipping weight back for quoting for addresses outside that zone.


    Then comment out the zen_get_shipping_enabled() line as shown in post #25 for whichever shipping module you want to provide quotes for these always-free-shipping items when outside the zone defined in the FreeShipper module.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. v139h When I add a FREE SHIPPING item to cart, it changes shipping of other items
    By rshelton in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 25 Nov 2012, 01:24 AM
  2. Show Item is FREE shipping in the CART.
    By gloerick in forum General Questions
    Replies: 42
    Last Post: 14 Mar 2011, 02:25 PM
  3. Replies: 2
    Last Post: 12 Mar 2011, 02:40 PM
  4. Per Weight Shipping not Calculated when Tax is Calculated
    By CascianoLtd in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 28 Sep 2009, 04:29 AM
  5. Free shipping item weight calculated wrongly for non valid free shipping zone
    By firehorse in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 28 Oct 2006, 05:39 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