Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2011
    Posts
    21
    Plugin Contributions
    0

    Default Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    I have read all the threads on this issue and have tried everything, so i require some help from the knowledgeable

    I have on some of my products - Yes, Always Free Shipping using free shipper, but this always is free to all countries when i need it to be only 1 country,

    What i require is if a customer in another country purchases then the free shipper doesnt show and my other shipping to that country shows

    I am using v1.3.9h

    Would greatly appreciate any help please

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

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    What other shipping modules are you using for everything else?
    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. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    If, for example, you were trying to do this with USPS you could edit the shipping class:
    /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;
    
    // bof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE
        global $db, $order, $cart;
            $valid_zone_id = (int)MODULE_SHIPPING_FREESHIPPER_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 ($check_flag == false) {
              $total_weight += $_SESSION['cart']->free_shipping_weight;
            }
    // bof: allow 1 zone only for Always Free Shipping
    
    Then edit the USPS shipping module:
    /includes/modules/shipping/usps.php

    and add the code in RED:
    Code:
      function update_status() {
        global $order, $db;
        if (IS_ADMIN_FLAG == TRUE) return;
    
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code) == FALSE) $this->enabled = FALSE;
    
    // bof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE
    $this->enabled = TRUE;
    // eof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE
    
        if ($this->enabled == true) {
    Code:
    // bof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE
    //echo 'I see quantity: ' . ($_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) . '<br>';
    
            $valid_zone_id = (int)MODULE_SHIPPING_FREESHIPPER_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 ($check_flag == true) {
              if ($_SESSION['cart']->count_contents() == $_SESSION['cart']->in_cart_check('product_is_always_free_shipping', 1)) {
                $this->enabled = false;
              } else {
                $this->enabled = true;
              }
            } else {
              $this->enabled = true;
            }
    // eof: allow 1 zone only for Always Free Shipping (int)MODULE_SHIPPING_FREESHIPPER_ZONE
    
          global $template, $current_page_base;
          // CUSTOMIZED CONDITIONS GO HERE
    then, on the Products for Always Free Shipping, mark them as such and add the weight that the shipping modules should use when the Product is not being sent to a Zone for Free Shipping ...

    Now, in the shipping module for FREE SHIPPING! freeshipper, set your Zone that is allowed the Always Free Shipping on these Products ...
    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!

  4. #4
    Join Date
    Feb 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    Thank you Ajeh,

    I was just about to quote that code above, i have tried that and adapted it for use on item shipping module, only problem im having now is its not counting each product for outside my free zone



    Im using shipping item module

    So yes always free - working no problem in my free zone

    Shipping outside free zone using per item module but it only counts and charges once for shipping and not per item... if i have 2 or 3 items still only charges one

    Any ideas on that one?

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

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    You need to adjust the number of items to include the free shipping items in the items.php shipping module ...
    Code:
          // adjusted count for free shipping
          $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
    Currently, it reduces the count based on:
    $_SESSION['cart']->free_shipping_items()

    You will need to not subtract the $_SESSION['cart']->free_shipping_items() when not in the right Zone being (int)MODULE_SHIPPING_FREESHIPPER_ZONE ...

    See if you are able to adapt the code, otherwise I will try to work out the calculation for you tomorrow ...
    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. #6
    Join Date
    Feb 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    Im not sure what to do there Ajeh, im not that good at coding, do i have to add anything or ?

  7. #7
    Join Date
    Feb 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    This is currently my item.php

    <?php
    /**
    * @package shippingMethod
    * @copyright Copyright 2003-2009 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: item.php 14498 2009-10-01 20:16:16Z ajeh $
    */


    class item {
    var $code, $title, $description, $icon, $enabled;

    // class constructor
    function item() {
    global $order, $db;

    $this->code = 'item';
    $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_ITEM_TAX_BASIS;

    // disable only when entire cart is free shipping
    // if (zen_get_shipping_enabled($this->code)) {
    $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
    // }

    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' 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) {
    $this->enabled = false;
    }
    }
    }

    // class methods
    function quote($method = '') {
    global $order, $total_count;

    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_ITEM_TEXT_TITLE,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
    'cost' => MODULE_SHIPPING_ITEM_COST + $chk_weight_charge)));
    }
    if ($this->tax_class > 0) {
    $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    }

    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

    return $this->quotes;
    }

    function check() {
    global $db;
    if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEM_STATUS'");
    $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
    }

    function install() {
    global $db;
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_ITEM_STATUS', 'True', 'Do you want to offer per item rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_ITEM_COST', '2.50', 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.', '6', '0', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_ITEM_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ITEM_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_ITEM_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ITEM_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

    function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_ITEM\_%'");
    }

    function keys() {
    return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
    }
    }
    ?>

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

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    I have added a new item.php file for you ...
    Attached Files Attached Files
    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!

  9. #9
    Join Date
    Feb 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    Thank you thank you and thank you

    It is working now perfectly, i think i may have to make a donation

    Much appreciate the help!

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

    Default Re: Free shipping to just 1 country using free shipper and Yes, Always Free Shipping

    Thanks for the update that this is working for you ...

    Donations are always appreciated!
    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!

 

 

Similar Threads

  1. Always Free Shipping: Yes, Always Free Shipping
    By Stuff4Toys in forum General Questions
    Replies: 15
    Last Post: 29 Apr 2011, 10:36 PM
  2. I want: Always Free Shipping to USA Only & No Shipping to Any Other Country
    By jane in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 11 Dec 2010, 01:46 AM
  3. Yes, Always Free Shipping
    By dr_james_leo in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 1 Apr 2010, 10:23 PM
  4. "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
  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

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