Results 1 to 10 of 15

Hybrid View

  1. #1
    Join Date
    Nov 2006
    Posts
    69
    Plugin Contributions
    0

    Default Re: Always Free Shipping

    I too was confronted by this very same issue, so put my coding hat on and heres what i came up with. My example applies to Australia but seems to work for any country it will make products marked free shipping only available to the country the store is in and use any of the other shipping mods if being shipped out of the country of origin.

    Step 1
    if you haven't already created a zone for you country do it now
    eg create zone australia with all states included.

    Step 2
    in admin goto modules>shipping>freeshipper and set the zone to the zone you have just created.

    now if you place an order to an overseas address with all freeshipping items in cart you should get a message that you are current not shipping to this region and locally freeshipping should show (this is good this shows you have zones set correctly.

    Step 3
    the file editing
    edit /includes/classes/shopping_cart.php

    find on around line 591
    Code:
    function calculate() { 
        global $db;
    add $order to the globals eg
    Code:
    function calculate() { 
        global $db, $order;
    around line 619 find
    Code:
    // adjusted count for free shipping 
            if ($product->fields['product_is_always_free_shipping'] != 1 and $product->fields['products_virtual'] != 1) { 
              $products_weight = $product->fields['products_weight']; 
            }else{
        $product_weight=0;
        }
    directly after this add
    Code:
    if ($product->fields['product_is_always_free_shipping'] = 1 && $order->delivery['country']['id']!= STORE_COUNTRY) { 
             $products_weight = $product->fields['products_weight'];
    }
    around line 658 find
    Code:
    // shipping adjustments 
            if (($product->fields['product_is_always_free_shipping'] == 1) or ($product->fields['products_virtual'] == 1) or (ereg('^GIFT', addslashes($product->fields['products_model'])))) {
    replace it with
    Code:
    if (($product->fields['product_is_always_free_shipping'] == 1 && $order->delivery['country']['id']== STORE_COUNTRY) or ($product->fields['products_virtual'] == 1) or (ereg('^GIFT', addslashes($product->fields['products_model'])))) {
    on line 1031 find
    Code:
     if ($product->fields['product_is_always_free_shipping'] != 1) { 
              $new_attributes_weight = $attribute_weight_info->fields['products_attributes_weight']; 
            } else { 
              $new_attributes_weight = 0; 
            }
    directly after it add
    Code:
    if ($product->fields['product_is_always_free_shipping'] = 1 && $order->delivery['country']['id']!= STORE_COUNTRY) { 
             $new_attributes_weight = $attribute_weight_info->fields['products_attributes_weight'];
    }
    save file

    now edit /includes/functions/functions_general.php
    find around line 1203
    Code:
    // Always free shipping only true - disable everyone 
          case (($check_cart_free == $check_cart_cnt) and $shipping_module != 'freeshipper'): 
            return false; 
            break;
    replace it with
    Code:
    // Always free shipping only true - disable everyone 
          case (($check_cart_free == $check_cart_cnt && $order->delivery['country']['id']== STORE_COUNTRY)  and $shipping_module != 'freeshipper'):
        return false; 
            break;
    save file and it sould work.
    the last but not least thing to change is the free shipping icon
    /includes/templates/template_default/images/always-free-shipping.gif make a new one to reflect where you are offering free shipping eg free shipping australia only.
    As always no guarantees test test test then retest in your own enviroment. if anyone has anything to add or finds bugs in the system please let me know

  2. #2
    Join Date
    Apr 2009
    Posts
    3
    Plugin Contributions
    0

    Default Re: Always Free Shipping

    Quote Originally Posted by Mickyelta View Post
    I too was confronted by this very same issue, so put my coding hat on and heres what i came up with.
    Thanks for this

    I've just implemented what you've done for a site and so far all seems to be working very nicely.

  3. #3
    Join Date
    Apr 2007
    Location
    Vancouver, Canada
    Posts
    1,569
    Plugin Contributions
    74

    Default Re: Always Free Shipping

    A simpler way to have shipping modules display with freeshipper is to change the following lines in functions_general.php:

    Find:
    PHP Code:
    case (ORDER_WEIGHT_ZERO_STATUS == '1' and ($check_cart_weight == and $shipping_module != 'freeshipper')):
            return 
    false
    Replace with:
    PHP Code:
    case (ORDER_WEIGHT_ZERO_STATUS == '1' and ($check_cart_weight == and $shipping_module != 'freeshipper')):
            return 
    true
    Find:
    PHP Code:
    case (($_SESSION['cart']->free_shipping_items() == $check_cart_cnt) and $shipping_module != 'freeshipper'):
            return 
    false
    Replace with:
    PHP Code:
    case (($_SESSION['cart']->free_shipping_items() == $check_cart_cnt) and $shipping_module != 'freeshipper'):
            return 
    true
    Find:
    PHP Code:
    case (($check_cart_free == $check_cart_cnt) and $shipping_module != 'freeshipper'):
            return 
    false
    Replace with:
    PHP Code:
    case (($check_cart_free == $check_cart_cnt) and $shipping_module != 'freeshipper'):
            return 
    true

 

 

Similar Threads

  1. v139h Free shipping to just 1 country using free shipper and Yes, Always Free Shipping
    By boomy in forum Built-in Shipping and Payment Modules
    Replies: 9
    Last Post: 20 Oct 2014, 01:43 AM
  2. Always Free Shipping: Yes, Always Free Shipping
    By Stuff4Toys in forum General Questions
    Replies: 15
    Last Post: 29 Apr 2011, 10:36 PM
  3. "Always free shipping " option is change all item free shipping?
    By als88 in forum Built-in Shipping and Payment Modules
    Replies: 12
    Last Post: 23 Oct 2009, 04:32 AM
  4. Always Free Shipping / Always Virtual Product -- How?
    By pseudonym in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 14 Mar 2009, 08:21 PM
  5. Always free shipping by product but only free in the US?
    By KingBono in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 4 Oct 2008, 10:51 PM

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