Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 60
  1. #11
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,168
    Plugin Contributions
    6

    Default Re: Shipping Module Programming Question

    Good news ... it can be done ...

    Bad News ... you get to start over ...

    When you want US ONLY Free Shipping *and* Regular Shipping for UPS and USPS ...

    Products are Marked as Always Free Shipping YES *and* Product Weight is set ...

    Edit the shipping class and add the new code 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 US ONLY
    // add back in the Always Free Shipping Weight for everyone
        global $db, $order, $cart;
              $total_weight += $_SESSION['cart']->free_shipping_weight;
    // bof: allow 1 zone only for Always Free Shipping US ONLY
    
        if (is_array($this->modules)) {
    Edit the USPS shipping module:
    /includes/modules/shipping/usps.php

    and comment out the test for Free Shipping:
    Code:
        // disable only when entire cart is free shipping
    //    if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
    //    }
    Edit the USPS shipping module:
    /includes/modules/shipping/ups.php

    and comment out the test for Free Shipping:
    Code:
        // disable only when entire cart is free shipping
    //    if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
    //    }
    First, edit the Free Shipping Options freeoptions shipping module:
    /includes/modules/shipping/freeoptions.php

    and comment out the test for Free Shipping and then test if the whole order would have been Free Shipping based on the Always Free Shipping setting and if so, then turn this on, otherwise turn this off:

    Code:
          // disable only when entire cart is free shipping
    //      if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
    //      }
    
    // bof: allow 1 zone only for Always Free Shipping when US ONLY
    // Only allow Free Shipping when whole cart is Always Free Shipping
      if (!IS_ADMIN_FLAG) {
        global $cart;
        $chk_weight = round($_SESSION['cart']->show_weight(),9);
        if ($chk_weight == 0) {
          $this->enabled = true;
        } else {
          $this->enabled = false;
        }
      }
    // bof: allow 1 zone only for Always Free Shipping when US ONLY
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    Next, add the Zone Definition that you created for the United States to the Free Shipping Options freeoptions shipping module, so it is only available to the United States ... providing the whole cart is marked as Always Free Shipping ...

    Nifty eh?
    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.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  2. #12
    Join Date
    Apr 2011
    Posts
    78
    Plugin Contributions
    0

    Default Re: Shipping Module Programming Question

    So far here is what I'm seeing. I've double checked everything and all appears to be in place. What have I missed?

    For USA customers:
    - add Free Shipping item to cart - Free Shipping and Free Shipping options both are displayed along with UPS and USPS. Additional Free Shipping items increase shipping charges for selections and Free Shipping remains an option. OK.

    - add additional non-Free Shipping item to cart - Free Shipping disappears but the shipping charge displayed reflects the charge for the total cart including the Free Shipping weight for UPS and USPS. The displayed weight shown on screen is correct in that it shows only the non-Free Shipping item weight but not reflected in the calculation.

    For Non-USA customers:
    - add USA Free Shipping item to cart - shipping options and cost display correctly. Adding additional USA Free Shipping items to cart reflect properly adjusted charges. OK.

    - add additional non-Free USA Shipping item to cart - shipping calculation breaks with no shipping options displayed.

    Non Free Shipping items work correctly in all scenarios.

    Thanks for the help. Any ideas?

  3. #13
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,168
    Plugin Contributions
    6

    Default Re: Shipping Module Programming Question

    Make sure that you added the code to Free Shipping Options freeoptions and the Zone to Free Shipping Options freeoptions for the US and set the Total to >= 0 ...
    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.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  4. #14
    Join Date
    Apr 2011
    Posts
    78
    Plugin Contributions
    0

    Default Re: Shipping Module Programming Question

    I double checked the code additions and everything is where it's suppose to be, seemingly. Free Shipping Options freeoptions is set with the USA zone the same as regular free shipping and the freeoptions Total is >= 0 with all of the other boxes blank? I am obviously missing something important. Is there a variable that I could check to see what's happening at some point? This seems really close to perfect.

  5. #15
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,168
    Plugin Contributions
    6

    Default Re: Shipping Module Programming Question

    NOTE: you do not need the shipping module FREE SHIPPING! freeshipper ...

    The Free Shipping Option freeoptions is customized with this code to manage orders that are Free Shipping ...

    Compare the code in:
    /includes/classes/shipping.php

    to a clean copy of:
    /includes/classes/shipping.php

    and make sure you only have the small piece of code in post #11 ...
    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.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  6. #16
    Join Date
    Apr 2011
    Posts
    78
    Plugin Contributions
    0

    Default Re: Shipping Module Programming Question

    I am very sorry but I can't seem to isolate my problem. I went back and unzipped a fresh copy from v1.3.9h and verified with Beyond Compare the shipping.php to only have the small piece of code as in #11. I also did the same for the freeoptions.php file and the UPS.php file and they also only contained the additional code. I was unable to compare the USPS.php files since I am running a later release of the module. I run a pretty generic store.

    I have also removed the Free Shipping freeshipper option and that option no longer displays but am still seeing the same results. As soon as I add a non-Free Shipping item, the weight get added back to the calculation. Thank you so much for your guidance.

  7. #17
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,168
    Plugin Contributions
    6

    Default Re: Shipping Module Programming Question

    Okay let's do this step by step and note I cleaned up a pinch of code in the shipping class and freeoptions ... with all changes in RED:

    The only shipping modules installed are:
    UPS
    USPS
    Free Shipping Options freeoptions

    Free Shipping Options freeoptions has the Zone set for the US only ...

    If using Sort Orders, you have used Sort Orders on all 3 of these modules ...

    All Products have Product Weight and/or Attribute Weight ...

    All Products to be shipped Free to the US are marked as:
    Always Free Shipping: Yes, Always Free Shipping

    Code changes from original code are:

    /includes/modules/shipping/ups.php
    Code:
        // disable only when entire cart is free shipping
    //    if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_UPS_STATUS == 'True') ? true : false);
    //    }
    /includes/modules/shipping/usps.php
    Code:
        // disable only when entire cart is free shipping
    //    if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
    //    }
    /includes/modules/shipping/freeoptions.php
    Code:
          // disable only when entire cart is free shipping
    //      if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
    //      }
    
    // bof: allow 1 zone only for Always Free Shipping when US ONLY
    // Only allow Free Shipping when whole cart is Always Free Shipping
      if (!IS_ADMIN_FLAG && $this->enabled) {
        global $cart;
        $chk_weight = round($_SESSION['cart']->show_weight(),9);
        if ($chk_weight == 0) {
          $this->enabled = true;
        } else {
          $this->enabled = false;
        }
      }
    // bof: allow 1 zone only for Always Free Shipping when US ONLY
    
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    /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 US ONLY
    // add back in the Always Free Shipping Weight for everyone
        global $cart;
              $total_weight += $_SESSION['cart']->free_shipping_weight;
    // bof: allow 1 zone only for Always Free Shipping US ONLY
    
    
        if (is_array($this->modules)) {
    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.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  8. #18
    Join Date
    Apr 2011
    Posts
    78
    Plugin Contributions
    0

    Default Re: Shipping Module Programming Question

    I meticulously followed each step and the results are the same. Once I add a non Free Shipping items the cost calculated goes up when increasing the Free Ship item quantity but the displayed weight remains the same.

    I did note however that the Free Shipping Options freeoptions module indicator is yellow whereas the UPS and USPS are green. Is this normal or am I not setting it up properly thus causing my problem?

  9. #19
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,168
    Plugin Contributions
    6

    Default Re: Shipping Module Programming Question

    It should be yellow as there is a Zone set on it ...

    Have you an URL to your site that I can see this?
    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.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  10. #20
    Join Date
    Apr 2011
    Posts
    78
    Plugin Contributions
    0

    Default Re: Shipping Module Programming Question

    The site is www.OliveBranchSkinCare.com. The Airbrush Tattoo Ink products are all free shipping and the stencils are not. If you need admin access just let me know.

 

 
Page 2 of 6 FirstFirst 1234 ... LastLast

Similar Threads

  1. Shipping Module; dependent on amount of shipping weight
    By midnightwalker in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 25 Mar 2010, 08:20 PM
  2. Free Shipping Button is present without Free Shipping Module enabled
    By ballinthejack in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 6 Feb 2009, 10:37 PM
  3. Display Handling Fee & Shipping Weight Even When Providing Free Shipping
    By Stenrique in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Jan 2009, 04:47 PM
  4. MZMT shipping module - Display Shipping Options based on Weight
    By DogTags in forum Addon Shipping Modules
    Replies: 2
    Last Post: 27 Feb 2007, 04:26 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
  •