Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free Shipping - some items - some zones - need upgrades

    Start without those changes in post #10 as I do not believe they will calculate correctly ...
    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. #22
    Join Date
    Jan 2011
    Posts
    70
    Plugin Contributions
    0

    Default Re: Free Shipping - some items - some zones - need upgrades

    Hi, I wanted to give some more feedback to ajeh's code.

    Situation: Offer free shipping on select products, restrict to one zone. "Always Free Shipping" selected, weight '0' so mixed carts would not include free item weight.
    Problem: Orders outside the set zone would also benefit from the '0' weight.

    Before testing: weight added to Always Free Shipping product.

    The Shipping modules are the Royal Mail add-ons, so UPS/USPS edits were not included in tests.

    Test 1:
    Using 'freeshipper' (with zone set in module) and making the edits in post #19 to shipping class worked fine.

    Test 2:
    As you do not recommend freeshipping with zone restriction (I've never had any problems doing this though), installed freeoptions and made edits per post #8 to freeoptions file.
    This did work, however Free Shipping was always available even with a mixed cart (only for the allowed zone). djdavedawson's first piece of code in post #10 (the closing else) fixed this.

    Weight issues were fixed in both examples - the allowed zone ignores Always Free Shipping weight, outside the allowed zone the weight is included.

    NB: I've only tested this on the shopping cart/shipping estimator page, not all the way through checkout.

    Hope this is some help.
    Thanks

  3. #23
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    Default Re: Free Shipping - some items - some zones - need upgrades

    I had to comment out the original piece of code you gave first

    Code:
    // bof: add back Free Shipping
      //  global $cart;
      //  $total_weight += $_SESSION['cart']->free_shipping_weight;
    //
    After that, The code you have provided on #19 produces the following:

    International Works

    US works except that on a mixed cart where:

    Item A, Free Ground Shipping, 15lbs
    Item B, Regular Shipping Applies, 20lbs

    All the shipping options displayed are based on **20lbs** shipping.

    Where the shipping options should be:

    Next Day Air -> Rate on 35lbs
    2nd Day Air -> Rate on 35lbs
    3 Day -> Rate on 35lbs
    Ground -> Rate on 20lbs

    ------------------

    This is the same issue as before except the new code just reverses the issue, where not using code on #19 produces the following:

    International Works

    US works except that on a mixed cart where:

    Item A, Free Ground Shipping, 15lbs
    Item B, Regular Shipping Applies, 20lbs

    All the shipping options displayed are based on **35lbs** shipping.

    Where the shipping options should be:

    Next Day Air -> Rate on 35lbs
    2nd Day Air -> Rate on 35lbs
    3 Day -> Rate on 35lbs
    Ground -> Rate on 20lbs

    ---------------

    At this point is where I tried to introduce the code on #10, after reviewing what I originally posted on #10 I still have some issues with the calculation of the rates on the Ground Portion, because I was not sure how to go about it accurately.

    How can I either,

    Use the code on #19 and add the freeship weight to all options except ground on a mixed cart

    or

    Not use code on #19 and subtract the freeship weight from only ground on a mixed cart?

    Thanks

    ~D

  4. #24
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    Have a Drink Re: Free Shipping - some items - some zones - need upgrades

    Ok I think I got it.

    For a Store that offers free UPS GROUND shipping on only some items to only the Lower 48.

    Cart ->No Free Ship Items
    Display -> Regular UPS Shipping Rates
    ---
    Cart -> Free Ship Items Only
    Display -> Free Shipping Options
    Display -> UPS Upgraded Shipping Rates with no Ground Option
    ---
    Cart -> Mixed Cart
    Display -> UPS Ground Option based on the NON Free Ship Items
    Display -> UPS Upgraded Shipping Rates based on All Items

    Here is the First part based on Ajeh's Code on #8

    Make a Zone Definition defined for the US Only ...

    Install the Free Shipping Options freeoptions instead of the FREE SHIPPING! freeshipper ... and set the Total >= 0 and set the Zone to the new Zone Definition for the US Only ...
    Edit the code for:
    /includes/modules/shipping/freeoptions.php

    to include the code in RED:

    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: Always Free Shipping
          if (!IS_ADMIN_FLAG) {
            global $cart;
            if ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) {
              $this->enabled = true;
            } else {$this->enabled = false;} 
          }
    // eof: Always Free Shipping
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    Edit the code for the UPS shipping module 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_UPS_STATUS == 'True') ? true : false);
    //    }
    Edit the code for the shipping class with the code in RED:

    Code:
     function calculate_boxes_weight_and_tare() {
        global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
    
    // bof: add back Free Shipping
        global $cart;
        $total_weight += $_SESSION['cart']->free_shipping_weight;
    //
        if (is_array($this->modules)) {
    Now the Free Shipping Options freeoptions will only show for the US when the whole order is Always Free Shipping and the UPS will always show with the proper weight ...
    Here is the Next Part of my solution for the mixed cart:

    Around line 192 in the UPS shipping module, i changed this:

    PHP Code:
    $methods[] = array('id' => $type,         
                               
    'title' => $this->types[$type], 
                               
    'cost' => ($cost $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' MODULE_SHIPPING_UPS_HANDLING $shipping_num_boxes MODULE_SHIPPING_UPS_HANDLING) ); 
    to this:
    PHP Code:
     global $db$order$cart;
            
    $valid_zone_id = (int)MODULE_SHIPPING_FREEOPTIONS_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 (
    $type=='GND' && $_SESSION['cart']->free_shipping_weight !=&& $check_flag == true) { 
             
            if (
    $_SESSION['cart']->in_cart_check('product_is_always_free_shipping','1') == $_SESSION['cart']->count_contents()) { 
             
            } else {
                
              
    $adjusted_weight =     ($ups_shipping_weight $shipping_num_boxes) - ($_SESSION['cart']->free_shipping_weight);
              
              (
    SHIPPING_MAX_WEIGHT $adjusted_weight $adjusted_boxes 1$adjusted_boxes ceil($adjusted_weight SHIPPING_MAX_WEIGHT));
          
              
    $adjusted_package $adjusted_weight $adjusted_boxes;            
              
              
    $this->_upsAction(3);
              
    $this->_upsWeight($adjusted_package);
              
    $gndQuote $this->_upsGetQuote();            
              
    $gndcost $gndQuote[0]['GND'];   
               
              
    $methods[] = array('id' => $type,         
                                 
    'title' => $this->types[$type] . " (Free Shipping + " . ($adjusted_package $adjusted_boxes) ." lbs.)"
                                 
    'cost' => ($gndcost $adjusted_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' MODULE_SHIPPING_UPS_HANDLING $adjusted_boxes MODULE_SHIPPING_UPS_HANDLING) ); 
            } 
             
            } else { 
                 
            
    $methods[] = array('id' => $type,         
                               
    'title' => $this->types[$type], 
                               
    'cost' => ($cost $shipping_num_boxes ) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' MODULE_SHIPPING_UPS_HANDLING $shipping_num_boxes MODULE_SHIPPING_UPS_HANDLING) ); 
            } 
    I hope this helps someone too.

    ~D

  5. #25
    Join Date
    Jul 2005
    Location
    Orlando, Fl
    Posts
    324
    Plugin Contributions
    0

    Default Re: Free Shipping - some items - some zones - need upgrades

    Note: If you're using anything prior to 1.3.9a you will need to correct the class shopping_cart.php as follows around 654:

    // shipping adjustments
    if (($product->fields['product_is_always_free_shipping'] == 1) or ($product->fields['products_virtual'] == 1) or (preg_match('^GIFT', addslashes($product->fields['products_model'])))) {
    $this->free_shipping_item += $qty;
    $this->free_shipping_price += zen_add_tax($products_price, $products_tax) * $qty;
    //$this->free_shipping_weight += ($qty * $products_weight);
    $this->free_shipping_weight += ($qty * $product->fields['products_weight']);
    }

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Free shipping on order total, problems when some items already have free shipping
    By birdmag in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Nov 2010, 09:18 PM
  2. Free Shipping on Some items only in some states
    By aarosso in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 11 Nov 2009, 05:00 AM
  3. FREE shipping - not include some items
    By williamL in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 28 Aug 2009, 03:27 PM
  4. Shipping by category, item & zones! Oh, and some free!
    By Ryk in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 11 May 2008, 09:47 AM
  5. Need some items marked 'order received' some 'shipped'
    By bodini in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 11 Mar 2008, 07:09 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