Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,194
    Plugin Contributions
    63

    Default [NOT A BUG] Possible free shipping bug

    Zen Cart 2.0.1
    PHP 8.3.9
    Bootstrap 3.7.1
    OPC 2.5.2

    We have a physical product marked Yes, Always Free Shipping in the product entry.
    The freeshipper module is set to a working custom zone. Someone outside of said zone with this product does not qualify for free shipping, but USPS is not coming up. No error, just blank... no shipping options.
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,303
    Plugin Contributions
    125

    Default Re: Possible free shipping bug

    Short term workaround for you would be to edit includes/modules/shipping/usps.php and update the update_status() function to remove this block:

    // disable only when entire cart is free shipping
    if (!zen_get_shipping_enabled($this->code)) {
    $this->enabled = false;
    }

    If that works, you can ask @lat9 to add a notifier so you can do this without modifying the USPS module.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,384
    Plugin Contributions
    94

    Default Re: Possible free shipping bug

    The product is set to indicate that it's always free shipping, which results in the call to zen_get_shipping_enabled to return (bool)false. What's needed for this site-specific requirement is the addition of a notifier in that function, not in a specific shipping method.

    Give this a try, along with your observer. If that does the trick, I'll be happy to submit a PR.
    Code:
    function zen_get_shipping_enabled(string $shipping_module): bool
    {
        global $PHP_SELF;
    
        // for admin always true
        if (IS_ADMIN_FLAG && strstr($PHP_SELF, FILENAME_MODULES)) {
            return true;
        }
    
        $check_cart_free = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', '1');
        $check_cart_cnt = $_SESSION['cart']->count_contents();
        $check_cart_weight = $_SESSION['cart']->show_weight();
    
        global $zco_notifier;
        $override_enabled = false;
        $zco_notifier->notify('ZEN_GET_SHIPPING_ENABLED_OVERRIDE', compact('check_cart_free', 'check_cart_cnt', 'check_cart_weight'), $override_enabled);
        if ($override_enabled === true) {
            return true;
        }
    
        // Free Shipping when 0 weight - enable freeshipper - ORDER_WEIGHT_ZERO_STATUS must be on
        if (ORDER_WEIGHT_ZERO_STATUS == '1' && ($check_cart_weight == 0 && $shipping_module == 'freeshipper')) {
            return true;
        }
    
        // Free Shipping when 0 weight - disable everyone - ORDER_WEIGHT_ZERO_STATUS must be on
        if (ORDER_WEIGHT_ZERO_STATUS == '1' && ($check_cart_weight == 0 && $shipping_module != 'freeshipper')) {
            return false;
        }
    
        if ($_SESSION['cart']->free_shipping_items() == $check_cart_cnt && $shipping_module == 'freeshipper') {
            return true;
        }
    
        if ($_SESSION['cart']->free_shipping_items() == $check_cart_cnt && $shipping_module != 'freeshipper') {
            return false;
        }
    
        // Always free shipping only true - enable freeshipper
        if ($check_cart_free == $check_cart_cnt && $shipping_module == 'freeshipper') {
            return true;
        }
    
        // Always free shipping only true - disable everyone
        if ($check_cart_free == $check_cart_cnt && $shipping_module != 'freeshipper') {
            return false;
        }
    
        // Always free shipping only is false - disable freeshipper
        if ($check_cart_free != $check_cart_cnt && $shipping_module == 'freeshipper') {
            return false;
        }
        return true;
    }

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,303
    Plugin Contributions
    125

    Default Re: Possible free shipping bug

    Nice - this way it covers all shipping methods.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,194
    Plugin Contributions
    63

    Default Re: Possible free shipping bug

    Quote Originally Posted by lat9 View Post
    The product is set to indicate that it's always free shipping, which results in the call to zen_get_shipping_enabled to return (bool)false. What's needed for this site-specific requirement is the addition of a notifier in that function, not in a specific shipping method.

    Give this a try, along with your observer. If that does the trick, I'll be happy to submit a PR.
    Code:
    function zen_get_shipping_enabled(string $shipping_module): bool
    {
        global $PHP_SELF;
    
        // for admin always true
        if (IS_ADMIN_FLAG && strstr($PHP_SELF, FILENAME_MODULES)) {
            return true;
        }
    
        $check_cart_free = $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', '1');
        $check_cart_cnt = $_SESSION['cart']->count_contents();
        $check_cart_weight = $_SESSION['cart']->show_weight();
    
        global $zco_notifier;
        $override_enabled = false;
        $zco_notifier->notify('ZEN_GET_SHIPPING_ENABLED_OVERRIDE', compact('check_cart_free', 'check_cart_cnt', 'check_cart_weight'), $override_enabled);
        if ($override_enabled === true) {
            return true;
        }
    
        // Free Shipping when 0 weight - enable freeshipper - ORDER_WEIGHT_ZERO_STATUS must be on
        if (ORDER_WEIGHT_ZERO_STATUS == '1' && ($check_cart_weight == 0 && $shipping_module == 'freeshipper')) {
            return true;
        }
    
        // Free Shipping when 0 weight - disable everyone - ORDER_WEIGHT_ZERO_STATUS must be on
        if (ORDER_WEIGHT_ZERO_STATUS == '1' && ($check_cart_weight == 0 && $shipping_module != 'freeshipper')) {
            return false;
        }
    
        if ($_SESSION['cart']->free_shipping_items() == $check_cart_cnt && $shipping_module == 'freeshipper') {
            return true;
        }
    
        if ($_SESSION['cart']->free_shipping_items() == $check_cart_cnt && $shipping_module != 'freeshipper') {
            return false;
        }
    
        // Always free shipping only true - enable freeshipper
        if ($check_cart_free == $check_cart_cnt && $shipping_module == 'freeshipper') {
            return true;
        }
    
        // Always free shipping only true - disable everyone
        if ($check_cart_free == $check_cart_cnt && $shipping_module != 'freeshipper') {
            return false;
        }
    
        // Always free shipping only is false - disable freeshipper
        if ($check_cart_free != $check_cart_cnt && $shipping_module == 'freeshipper') {
            return false;
        }
        return true;
    }
    This does not work. In 1.5.8 it wasn't an issue. I get the always free shipping gist, but the freeshipper module has a zone definition. I can see where it would need to be limited by zone... can't ship free to the UK for the same price as the US. I appreciate your help with this. Have it working with this temporarily.

    Code:
        global $zco_notifier;
        $override_enabled = true;
        $zco_notifier->notify('ZEN_GET_SHIPPING_ENABLED_OVERRIDE', compact('check_cart_free', 'check_cart_cnt', 'check_cart_weight'), $override_enabled);
        if ($override_enabled === true) {
            return true;
        }
    Thanks again =)
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,303
    Plugin Contributions
    125

    Default Re: Possible free shipping bug

    Your notifier needs to fire for USPS, not Free Shipping. It's USPS you want to turn on.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v155 Possible bug in USPS shipping
    By HeleneWallis in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 30 Mar 2018, 08:51 PM
  2. Replies: 102
    Last Post: 1 Jun 2017, 09:29 AM
  3. Google Checkout v1.4.7 - Possible Bug with Shipping
    By stonecoldinc in forum Addon Shipping Modules
    Replies: 1
    Last Post: 16 Oct 2011, 10:25 PM
  4. [Not a ZC bug] Shipping Estimator bug
    By TPHoare in forum Bug Reports
    Replies: 3
    Last Post: 7 Jan 2007, 06:22 PM
  5. Replies: 8
    Last Post: 3 Dec 2006, 08:23 AM

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