Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Hi

    I want to offer free shipping for different zones which depends on specified order-totals for each zone.
    I need at least 3 zones. (now only national or international is possible )

    Is there a module that can handle this?

    grmx

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

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Could you make a Zone Definition for the Free Shipping and use the shipping module Free Options freeoptions which would give the customer the choice for Free Shipping and the other regular shipping methods?
    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
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    I think so, but I don't think this is a elegant solution

    why showing other shipping methods when shipping is already free? >> the less the better

    grmx

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

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Amazon does that ... it offers the Free Shipping and in addition gives the customer the choice to pay more for other shipping methods ...

    I often pick a different shipping method that is not free over the ones that are free ...

    If you want to have only Free Shipping on specific order totals based on different Zones you can always do all of the custom coding for this ...

    Is it the same amount for the Order Total and just a few places can have Free Shipping? Or, is it different amounts for the Order Total depending on the Zone?
    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!

  5. #5
    Join Date
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Different amounts for the Order Total depending on the Zone.
    As I said earlier, I need at least 3 different zones.

    by the way, we offer our customers only 1 shipment method. again >>> the lesser the better

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

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    To use the Free Shipping Options freeoptions for 3 Zones with different Order Totals you would need to make 3 Zone Definitions and then clone the Free Shipping Options freeoptions and add 1 Zone to each shipping method and set the Total >= XX.XX and it will show this shipping module with your regular shipping method when the Order Total is the correct amount for that Zone Definition ...

    Then the customer can pick either the Free Shipping Option or your regular shipping method ...

    To manage this where the Free Shipping is the only shipping method then you would need to do a lot more customization for figure out the customer's Zone and the Order Total and then have the code decide what shipping method to use ...

    I would do the coning of the Free Shipping Options freeoptions for the 3 Zones and give them a choice ... it is a lot less work doing that ...

    You would be cloning the files:
    /includes/modules/shipping/freeoptions.php
    /includes/languages/english/modules/shipping/freeoptions.php

    to something like:
    /includes/modules/shipping/freeoptionszone2.php
    /includes/languages/english/modules/shipping/freeoptionszone2.php

    /includes/modules/shipping/freeoptionszone3.php
    /includes/languages/english/modules/shipping/freeoptionszone3.php

    where for the first set of code:
    /includes/modules/shipping/freeoptionszone2.php
    /includes/languages/english/modules/shipping/freeoptionszone2.php

    change all the text:
    freeoptions

    to be:
    freeoptions2

    and change all the text:
    FREEOPTIONS

    to be:
    FREEOPTIONS2

    then do the same to Zone 3 using:
    /includes/modules/shipping/freeoptionszone3.php
    /includes/languages/english/modules/shipping/freeoptionszone3.php

    change all the text:
    freeoptions

    to be:
    freeoptions3

    and change all the text:
    FREEOPTIONS

    to be:
    FREEOPTIONS3

    and just add your Zone Definitions to each one and configure the Total >= XX.XX for each ...
    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!

  7. #7
    Join Date
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Thanks!

    I'm thinking.. modifying ot_shipping.php instead, would that be a good choice?

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

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Not really ...

    You can try it, but it can be pretty confusing if you are not really proficient with customizing code and fooling with Zones ...
    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
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    I'll give it a try... if I fail, I can refer to your solution.

  10. #10
    Join Date
    Aug 2006
    Posts
    74
    Plugin Contributions
    0

    Default Re: ZC 1.5: Free shipping for orders over 'variable' for different zones?

    Okay, I have managed something. I've modified some code.

    Now it's possible to define free shipping for 4 country zones with 4 different amounts which depends on the order total. (see pic )
    Countries that are not defined are excluded from free shipping.

    I'm not a coder, so it would be really nice if someone will check my modifications.

    see for modifications line comments 'modding':

    includes/modules/order_total/ot_shipping.php
    includes/modules/pages/checkout_shipping/header_php.php

    PHP Code:
    <?php
    /**
     * ot_shipping order-total module
     *
     * @package orderTotal
     * @copyright Copyright 2003-2011 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: ot_shipping.php 19002 2011-07-03 10:06:10Z wilt $
     */

      
    class ot_shipping {
        var 
    $title$output$num_zones// modding  $num_zones added

        
    function ot_shipping() {
          global 
    $order$currencies;
          
    $this->code 'ot_shipping';
          
    $this->title MODULE_ORDER_TOTAL_SHIPPING_TITLE;
          
    $this->description MODULE_ORDER_TOTAL_SHIPPING_DESCRIPTION;
          
    $this->sort_order MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER;
          unset(
    $_SESSION['shipping_tax_description']);
          
    $this->output = array();
          if (
    MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
          
    /* bof modding 1 */ 
     
            
    $this->num_zones 4;
            
    $dest_country $order->delivery['country']['iso_code_2']; 
            for (
    $i=1$i<=$this->num_zones$i++) {
            
    $countries_table constant('MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES' $i);
            
    $countries_table strtoupper(str_replace(' '''$countries_table));
            
    $country_zones preg_split("/[,]/"$countries_table);
            if (
    in_array($dest_country$country_zones)) {
             
    $dest_zone $i;
             
    $amount_limit constant('MODULE_ORDER_TOTAL_SHIPPING_AMOUNT' $i);
             
    $pass=true;
              break;
            }
            
          }
    /* eof modding 1 */
              
             
    if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= $amount_limit) ) {
              
    $order->info['shipping_method'] = $this->title;
              
    $order->info['total'] -= $order->info['shipping_cost'];
              
    $order->info['shipping_cost'] = 0;
            }
        
          }
          
          
    $module substr($_SESSION['shipping']['id'], 0strpos($_SESSION['shipping']['id'], '_'));
          if (
    zen_not_null($order->info['shipping_method'])) {
            if (
    $GLOBALS[$module]->tax_class 0) {
              if (!isset(
    $GLOBALS[$module]->tax_basis)) {
                
    $shipping_tax_basis STORE_SHIPPING_TAX_BASIS;
              } else {
                
    $shipping_tax_basis $GLOBALS[$module]->tax_basis;
              }

              if (
    $shipping_tax_basis == 'Billing') {
                
    $shipping_tax zen_get_tax_rate($GLOBALS[$module]->tax_class$order->billing['country']['id'], $order->billing['zone_id']);
                
    $shipping_tax_description zen_get_tax_description($GLOBALS[$module]->tax_class$order->billing['country']['id'], $order->billing['zone_id']);
              } elseif (
    $shipping_tax_basis == 'Shipping') {
                
    $shipping_tax zen_get_tax_rate($GLOBALS[$module]->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);
                
    $shipping_tax_description zen_get_tax_description($GLOBALS[$module]->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);
              } else {
                if (
    STORE_ZONE == $order->billing['zone_id']) {
                  
    $shipping_tax zen_get_tax_rate($GLOBALS[$module]->tax_class$order->billing['country']['id'], $order->billing['zone_id']);
                  
    $shipping_tax_description zen_get_tax_description($GLOBALS[$module]->tax_class$order->billing['country']['id'], $order->billing['zone_id']);
                } elseif (
    STORE_ZONE == $order->delivery['zone_id']) {
                  
    $shipping_tax zen_get_tax_rate($GLOBALS[$module]->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);
                  
    $shipping_tax_description zen_get_tax_description($GLOBALS[$module]->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);
                } else {
                  
    $shipping_tax 0;
                }
              }
              
    $shipping_tax_amount zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
              
    $order->info['shipping_tax'] += $shipping_tax_amount;
              
    $order->info['tax'] += $shipping_tax_amount;
              
    $order->info['tax_groups']["$shipping_tax_description"] += zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
              
    $order->info['total'] += zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
              
    $_SESSION['shipping_tax_description'] =  $shipping_tax_description;
              
    $_SESSION['shipping_tax_amount'] =  $shipping_tax_amount;
              if (
    DISPLAY_PRICE_WITH_TAX == 'true'$order->info['shipping_cost'] += zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
            }

            if (
    $_SESSION['shipping'] == 'free_free') {
              
    $order->info['shipping_method'] = FREE_SHIPPING_TITLE_REPLACEMENT;
              
    $order->info['shipping_cost'] = 0;
            }

          }
        }

        function 
    process() {
          global 
    $order$currencies;

            
    $this->output[] = array('title' => $order->info['shipping_method'] . ':',
                                    
    'text' => $currencies->format($order->info['shipping_cost'], true$order->info['currency'], $order->info['currency_value']),
                                    
    'value' => $order->info['shipping_cost']);
        }

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

          return 
    $this->_check;
        }
    /* bof  modding 2 */

        
    function keys() {
          return array(
    'MODULE_ORDER_TOTAL_SHIPPING_STATUS''MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER''MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING''MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES1''MODULE_ORDER_TOTAL_SHIPPING_AMOUNT1','MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES2''MODULE_ORDER_TOTAL_SHIPPING_AMOUNT2','MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES3''MODULE_ORDER_TOTAL_SHIPPING_AMOUNT3','MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES4''MODULE_ORDER_TOTAL_SHIPPING_AMOUNT4');
        }

        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 ('This module is installed', 'MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'true', '', '6', '1','zen_cfg_select_option(array(\'true\'), ', 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_ORDER_TOTAL_SHIPPING_SORT_ORDER', '200', 'Sort order of display.', '6', '2', 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 ('Allow Free Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'false', 'Do you want to allow free shipping?', '6', '3', '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 ('Free shipping for orders over:', 'MODULE_ORDER_TOTAL_SHIPPING_AMOUNT1', '100', 'Amount', '6', '4', 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 ('Included countries', 'MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES1', '', 'Use a comma separated list of the two character ISO country codes', '6', '5', 'zen_cfg_textarea(', now())");
          
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Free shipping for orders over:', 'MODULE_ORDER_TOTAL_SHIPPING_AMOUNT2', '200', 'Amount', '6', '6', 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 ('Included countries', 'MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES2', '', 'Use a comma separated list of the two character ISO country codes', '6', '7', 'zen_cfg_textarea(', now())");
          
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Free shipping for orders over:', 'MODULE_ORDER_TOTAL_SHIPPING_AMOUNT3', '300', 'Amount', '6', '8', 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 ('Included countries', 'MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES3', '', 'Use a comma separated list of the two character ISO country codes', '6', '9', 'zen_cfg_textarea(', now())");
          
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Free shipping for orders over:', 'MODULE_ORDER_TOTAL_SHIPPING_AMOUNT4', '400', 'Amount', '6', '10', 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 ('Included countries', 'MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES4', '', 'Use a comma separated list of the two character ISO country codes', '6', '11', 'zen_cfg_textarea(', now())");
           
        }
    /* eof modding 2 */

        
    function remove() {
          global 
    $db;
          
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
        }
      }

      
    ?>
    PHP Code:
    <?php
    /**
     * Checkout Shipping Page
     *
     * @package page
     * @copyright Copyright 2003-2011 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: header_php.php 18697 2011-05-04 14:35:20Z wilt $
     */
    // This should be first line of the script:
      
    $zco_notifier->notify('NOTIFY_HEADER_START_CHECKOUT_SHIPPING');

      require_once(
    DIR_WS_CLASSES 'http_client.php');

    // if there is nothing in the customers cart, redirect them to the shopping cart page
      
    if ($_SESSION['cart']->count_contents() <= 0) {
        
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
      }

    // if the customer is not logged on, redirect them to the login page
      
    if (!isset($_SESSION['customer_id']) || !$_SESSION['customer_id']) {
        
    $_SESSION['navigation']->set_snapshot();
        
    zen_redirect(zen_href_link(FILENAME_LOGIN'''SSL'));
      } else {
        
    // validate customer
        
    if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
          
    $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL''page' => FILENAME_CHECKOUT_SHIPPING));
          
    zen_redirect(zen_href_link(FILENAME_LOGIN'''SSL'));
        }
      }

    // Validate Cart for checkout
      
    $_SESSION['valid_to_checkout'] = true;
      
    $_SESSION['cart']->get_products(true);
      if (
    $_SESSION['valid_to_checkout'] == false) {
        
    $messageStack->add('header'ERROR_CART_UPDATE'error');
        
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
      }

    // Stock Check
      
    if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
        
    $products $_SESSION['cart']->get_products();
        for (
    $i=0$n=sizeof($products); $i<$n$i++) {
          if (
    zen_check_stock($products[$i]['id'], $products[$i]['quantity'])) {
            
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
            break;
          }
        }
      }
    // if no shipping destination address was selected, use the customers own address as default
      
    if (!$_SESSION['sendto']) {
        
    $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
      } else {
    // verify the selected shipping address
        
    $check_address_query "SELECT count(*) AS total
                                FROM   " 
    TABLE_ADDRESS_BOOK "
                                WHERE  customers_id = :customersID
                                AND    address_book_id = :addressBookID"
    ;

        
    $check_address_query $db->bindVars($check_address_query':customersID'$_SESSION['customer_id'], 'integer');
        
    $check_address_query $db->bindVars($check_address_query':addressBookID'$_SESSION['sendto'], 'integer');
        
    $check_address $db->Execute($check_address_query);

        if (
    $check_address->fields['total'] != '1') {
          
    $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
          
    $_SESSION['shipping'] = '';
        }
      }

      require(
    DIR_WS_CLASSES 'order.php');
      
    $order = new order;

    // register a random ID in the session to check throughout the checkout procedure
    // against alterations in the shopping cart contents
    if (isset($_SESSION['cart']->cartID)) {
      if (!isset(
    $_SESSION['cartID']) || $_SESSION['cart']->cartID != $_SESSION['cartID']) {
        
    $_SESSION['cartID'] = $_SESSION['cart']->cartID;
      }
    } else {
      
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
    }

    // if the order contains only virtual products, forward the customer to the billing page as
    // a shipping address is not needed
      
    if ($order->content_type == 'virtual') {
        
    $_SESSION['shipping'] = 'free_free';
        
    $_SESSION['shipping']['title'] = 'free_free';
        
    $_SESSION['sendto'] = false;
        
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT'''SSL'));
      }

      
    $total_weight $_SESSION['cart']->show_weight();
      
    $total_count $_SESSION['cart']->count_contents();

    // load all enabled shipping modules
      
    require(DIR_WS_CLASSES 'shipping.php');
      
    $shipping_modules = new shipping;

      
    $pass true;
      if ( 
    defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
        
    $pass false;

    /* bof modding */
     
    $num_zones 4;
            
    $dest_country $order->delivery['country']['iso_code_2']; 
            
             for (
    $i=1$i<=$num_zones$i++) {
            
    $countries_table constant('MODULE_ORDER_TOTAL_SHIPPING_COUNTRIES' $i);
            
    $countries_table strtoupper(str_replace(' '''$countries_table));
            
    $country_zones preg_split("/[,]/"$countries_table);
            if (
    in_array($dest_country$country_zones)) {
             
    $dest_zone $i;
             
    $amount_limit constant('MODULE_ORDER_TOTAL_SHIPPING_AMOUNT' $i);
             
    $pass=true;
              break;
            }
            
          }
          
      
    /* eof modding */    

        
    $free_shipping false;
        
    /*if ( ($pass == true) && ($_SESSION['cart']->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {*/
         
    if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= $amount_limit) ) {
          
    $free_shipping true;
        }
      } else {
        
    $free_shipping false;
      }

      require(
    DIR_WS_MODULES zen_get_module_directory('require_languages.php'));

      if (isset(
    $_SESSION['comments'])) {
        
    $comments $_SESSION['comments'];
      }


    // process the selected shipping method
      
    if ( isset($_POST['action']) && ($_POST['action'] == 'process') ) {
        if (
    zen_not_null($_POST['comments'])) {
          
    $_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
        }
        
    $comments $_SESSION['comments'];
        
    $quote = array();

        if ( (
    zen_count_shipping_modules() > 0) || ($free_shipping == true) ) {
          if ( (isset(
    $_POST['shipping'])) && (strpos($_POST['shipping'], '_')) ) {
            
    /**
             * check to be sure submitted data hasn't been tampered with
             */
            
    if ($_POST['shipping'] == 'free_free' && ($order->content_type != 'virtual' && !$pass)) {
              
    $quote['error'] = 'Invalid input. Please make another selection.';
            } else {
              
    $_SESSION['shipping'] = $_POST['shipping'];
            }

            list(
    $module$method) = explode('_'$_SESSION['shipping']);
            if ( 
    is_object($$module) || ($_SESSION['shipping'] == 'free_free') ) {
              if (
    $_SESSION['shipping'] == 'free_free') {
                
    $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
                
    $quote[0]['methods'][0]['cost'] = '0';
              } else {
                
    $quote $shipping_modules->quote($method$module);
              }
              if (isset(
    $quote['error'])) {
                
    $_SESSION['shipping'] = '';
              } else {
                if ( (isset(
    $quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
                  
    $_SESSION['shipping'] = array('id' => $_SESSION['shipping'],
                                    
    'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' $quote[0]['methods'][0]['title'] . ')'),
                                    
    'cost' => $quote[0]['methods'][0]['cost']);

                  
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT'''SSL'));
                }
              }
            } else {
              
    $_SESSION['shipping'] = false;
            }
          }
        } else {
          
    $_SESSION['shipping'] = false;

          
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT'''SSL'));
        }
      }

    // get all available shipping quotes
      
    $quotes $shipping_modules->quote();

      
    // check that the currently selected shipping method is still valid (in case a zone restriction has disabled it, etc)
      
    if (isset($_SESSION['shipping']) && $_SESSION['shipping'] != FALSE && $_SESSION['shipping'] != '') {
        
    $checklist = array();
        foreach (
    $quotes as $key=>$val) {
          foreach(
    $val['methods'] as $key2=>$method) {
            
    $checklist[] = $val['id'] . '_' $method['id'];
          }
        }
        
    $checkval = (is_array($_SESSION['shipping']) ? $_SESSION['shipping']['id'] : $_SESSION['shipping']);
        if (!
    in_array($checkval$checklist)) {
          
    $messageStack->add('checkout_shipping'ERROR_PLEASE_RESELECT_SHIPPING_METHOD'error');
        }
      }

    // if no shipping method has been selected, automatically select the cheapest method.
    // if the modules status was changed when none were available, to save on implementing
    // a javascript force-selection method, also automatically select the cheapest shipping
    // method if more than one module is now enabled
      
    if ( !$_SESSION['shipping'] || ( $_SESSION['shipping'] && ($_SESSION['shipping'] == false) && (zen_count_shipping_modules() > 1) ) ) $_SESSION['shipping'] = $shipping_modules->cheapest();


      
    // Should address-edit button be offered?
      
    $displayAddressEdit = (MAX_ADDRESS_BOOK_ENTRIES >= 2);

      
    // if shipping-edit button should be overridden, do so
      
    $editShippingButtonLink zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS'''SSL');
      if (isset(
    $_SESSION['payment']) && method_exists($$_SESSION['payment'], 'alterShippingEditButton')) {
        
    $theLink = $$_SESSION['payment']->alterShippingEditButton();
        if (
    $theLink) {
          
    $editShippingButtonLink $theLink;
          
    $displayAddressEdit true;
        }
      }

      
    $breadcrumb->add(NAVBAR_TITLE_1zen_href_link(FILENAME_CHECKOUT_SHIPPING'''SSL'));
      
    $breadcrumb->add(NAVBAR_TITLE_2);

    // This should be last line of the script:
      
    $zco_notifier->notify('NOTIFY_HEADER_END_CHECKOUT_SHIPPING');

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Want to offer free shipping for orders over $ except for Express
    By xandros2000 in forum Customization from the Admin
    Replies: 5
    Last Post: 5 Aug 2009, 05:21 PM
  2. Free Shipping over different amounts in different zones
    By madelharri in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 11 Jun 2009, 02:11 PM
  3. Free shipping for Different sales total for different zones
    By francesca_ph in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 30 Dec 2008, 05:43 PM
  4. Free shipping for orders over $XX
    By earmsby in forum General Questions
    Replies: 5
    Last Post: 5 Dec 2008, 09:41 PM
  5. free shipping for orders over x$
    By gsdcypher in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 2 Mar 2008, 08:03 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