Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order Total module for 2.3 - free shipping on 'national' orders question


Supertex

Recommended Posts

When I look in Admin->Locations/Taxes-> Countries I see that Puerto Rico, for example, is independently listed from the U.S.  However, when I look at "zones," Puerto Rico is included with the United States, along with APO's, etc.  

 

So on my Order Total module - free shipping (set to national orders only), Will Puerto Rico be excluded? And if I only want to offer free shipping to the continental 48, how do I handle that? Do I need to edit the Admin->Locations/Taxes->Zones, and remove Hawaii and Alaska from the US zone?

Link to comment
Share on other sites

  • 2 weeks later...

So on my Order Total module - free shipping (set to national orders only), Will Puerto Rico be excluded?

The native free shipping that comes with the base osCommerce relies on country_id, not zone_id, so it should view Puerto Rico differently than other things that might be considered part of the US zone.

 

And if I only want to offer free shipping to the continental 48, how do I handle that? Do I need to edit the Admin->Locations/Taxes->Zones, and remove Hawaii and Alaska from the US zone?

No, you'd have to change things so that people stopped picking the US as the country for Hawaii and Alaska. As this is unreasonable, you may have to look for a different solution.

 

Sorry I can't be of a more positive help. Perhaps someone else knows of a way to do what you want. There may be a relevant contribution.

Always back up before making changes.

Link to comment
Share on other sites

Don't be sorry.  Every little bit helps on my learning curve, and I am grateful for the response =P.

 

I found it to be exactly as you describe, but in the process I began to wonder how hard it would be to replace the country_id check in favor of zone exclusions, like the shipping and payment modules use.  I -think- it will work, but will just take some trial and error on my part...glad I have a dev directory.

 

I'm going to have to really dig into the free shipping module anyway, as I really have to give the customer a way to opt-out.  I get asked "why in the hell would anyone opt out of free shipping?"  Well, what if they're in a pinch and need it overnight?  As it is now, they're locked into free shipping, so the extra cost would fall on me. Also, insurance-which there is a module to handle, but then things have to be added to exclude the insurance module from showing unless it meets the same criteria as the free shipping - seeing "Add insurance: $0.00" in the order total for those that didn't qualify for free shipping tends to make them thing they missed a step in the shipping process.

 

Onward!

Link to comment
Share on other sites

There are a couple of free shipping modules in the Addons section. Set up a zone for the Lower 48 and set your free shipping module to that zone. Your customer can choose the free shipping or any other option you have from another module for faster shipping.

 

I've set this up on several stores and the customers seem to have no problem with it.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I have extended the free shipping check with standard checks for national and international, to have a third option for belgium and netherlands as we are at the border and can use belgian or dutch postal services, pretty much same cost.

it is a fairly easy change in just a few places.

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

@@kymation

 

Heh...I'd never even considered another addon, once I saw functionality in the base order_total module.  I'll look through the addons.

 

@@bruyndoncx

 

I'd be interested to see your modifications, too.

 

Thank you both for the reply, and thank you for your contributions to the community.  You guys both are a -ton- of help on these forums, and my store in particular wouldn't be up and running without either of you.

Link to comment
Share on other sites

hi there ,

 

searched for BENL on my site and found I apparently only needed to change include/modules/order_total/ot_shipping.php

 

this is the complete file, I think I only changed the case statement, and the configuration key entry to make it a dropdown value

 

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2007 osCommerce

  Released under the GNU General Public License
*/

  class ot_shipping {
    var $title, $output;

    function ot_shipping() {
      $this->code = 'ot_shipping';
      $this->title = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
      $this->description = MODULE_ORDER_TOTAL_SHIPPING_DESCRIPTION;
      $this->enabled = ((MODULE_ORDER_TOTAL_SHIPPING_STATUS == 'true') ? true : false);
      $this->sort_order = MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER;

      $this->output = array();
    }

    function process() {
      global $order, $currencies;

      if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
        switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
          case 'BENL':
            if ( ($order->delivery['country_id'] == '21') or ($order->delivery['country_id'] == '150') )    $pass = true; break;
          case 'national':
            if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
          case 'international':
            if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
          case 'both':
            $pass = true; break;
          default:
            $pass = false; break;
        }

        if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
          $order->info['shipping_method'] = $this->title;
          $order->info['total'] -= $order->info['shipping_cost'];
          $order->info['shipping_cost'] = 0;
        }
      }

      $module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));

      if (tep_not_null($order->info['shipping_method'])) {
        if ($GLOBALS[$module]->tax_class > 0) {
          $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
          $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

          $order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
          $order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
          $order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

          if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);
        }

        $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() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SHIPPING_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }

      return $this->_check;
    }

    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_FREE_SHIPPING_OVER', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION');
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'true', 'Do you want to display the order shipping cost?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
      tep_db_query("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', '2', 'Sort order of display.', '6', '2', now())");
      tep_db_query("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', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Free Shipping For Orders Over', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', '50', 'Provide free shipping for orders over the set amount.', '6', '4', 'currencies->format', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Provide Free Shipping For Orders Made', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION', 'national', 'Provide free shipping for orders sent to the set destination.', '6', '5', 'tep_cfg_select_option(array(\'BENL\', \'national\',\'international\', \'both\'), ', now())");
    }

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

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...