Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ship In Cart


Guest

Recommended Posts

 Uploaded:

Ship In Cart BS reloaded 4.1

 
Changes Vers. 4.1:
  - added support for store setting "Display Prices with Tax". Prices and order subtotal will be updated for guests depending on selected shipping country and zone.
    thanks to @inra311 for the suggestion

 

Link to comment
Share on other sites

  • 3 months later...

@raiwa I hope this is the correct place for this, and this is just an FYI anyway.

For modular checkout, with ship in cart installed it seems that  the USPS module does not always show ship in cart  options. 

However, upon emptying my text purchase from the cart and trying again, ship in cart shows USPS the second time.  Hmmm.

I am guessing but this may be because of some PHP issues in the USPS module add on.  Just doing a test, then looking in the log I see the errors being logged.

All just FYI in case someone else asks

Thx

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

29 minutes ago, altoid said:

For modular checkout, with ship in cart installed it seems that  the USPS module does not always show ship in cart  options. 

However, upon emptying my text purchase from the cart and trying again, ship in cart shows USPS the second time.  Hmmm.

Did you fill in a default zip code in the module? If USPS uses zip code for the shipping calculation you may need it to retrieve quotes for guests.

Link to comment
Share on other sites

15 minutes ago, raiwa said:

Did you fill in a default zip code in the module? If USPS uses zip code for the shipping calculation you may need it to retrieve quotes for guests.

That solved it.  Sorry...I missed setting that earlier.   All's good now.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

  • 2 months later...

Update uploaded:

Ship In Cart BS reloaded 4.3.

Changes Version. 4.3:
  - Added support for shipping module icons
  - Moved script and inline styles to correct place to avoid header already sent error
  - Cleaned up code and fixed undefined errors

 

Link to comment
Share on other sites

  • 3 weeks later...

Hi, thank you for this addon.

I use MultiGeoZone MultiTable Shipping(MZMT) (https://apps.oscommerce.com/osvz6&multigeozone-multitable-shipping&c=shipping)

There is 2 table (i.e. 2 methods) under MZMT. I am having a problem.

Scenario1: With cm_sc_shipping.php installed, and MZMT is the only shipping module

the cheapest method is selected by default.

When i tried to select the other method, the page is redirected, but sill the cheapest method is the selected method. 

I checked the $thisquoteid should be correct  which is mzmt_table1 and mzmt_table2 respectively, hence 

onclick="return shipincart_submit(\''.$thisquoteid.'\');" (line392/397 of cm_sc_shipping.php) should be correct.

 

Scenario2: With cm_sc_shipping.php installed, and MZMT plus any shipping method (discount etc)

The selection works fine (i.e. correct module is selected after redirect)

Other shipping methods (discount, table etc) work fine too.

To sum it: If MZMT is the only shipping module available, the selection does not work.

MZMT is the only shipping method that I used that has 2 methods.

Any idea where i should look to solve this problem. Attached MZMT module.

<?php
/*
  $Id: mzmt.php, v2.1a 20140125 Kymation Exp $
  $Portions From: mzmt.php,v 1.000 2004-10-29 Josh Dechant Exp $

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

  Copyright (c) 2014 osCommerce
  Protions Copyright (c) 2004 Josh Dechant

  Released under the GNU General Public License
*/

  class mzmt {
    var $version = '2.1a';
    var $code = '';
    var $title = '';
    var $description = '';
    var $icon = '';
    var $enabled = false;
    var $num_tables = 0;
    var $num_geozones = 0;
    var $delivery_geozone = 0;
    var $geozone_mode = 'weight';
    var $order_total = 0;
    var $languages_array = array();
    var $quotes = array();
    
    
    ////
    // Set up all of the default values available at this time
    function mzmt() {
      global $order;
      
      $this->code = 'mzmt';
      $this->sort_order = @MODULE_SHIPPING_MZMT_SORT_ORDER;
      $this->tax_class = @MODULE_SHIPPING_MZMT_TAX_CLASS;
      $this->enabled = ( ( @MODULE_SHIPPING_MZMT_STATUS == 'True' ) ? true : false );
      
      // When the language file has been included
      if( defined( 'MODULE_SHIPPING_MZMT_TEXT_TITLE' ) ) {
        $this->title = MODULE_SHIPPING_MZMT_TEXT_TITLE;
        $this->description = MODULE_SHIPPING_MZMT_TEXT_DESCRIPTION;
      }
      
      // Second pass and later, when the number of geo zones and tables have been set
      if( defined( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES' ) ) {
        $this->num_geozones = MODULE_SHIPPING_MZMT_NUMBER_GEOZONES;
        $this->num_tables = MODULE_SHIPPING_MZMT_NUMBER_TABLES;
      
        if ($this->enabled == true) {
          $this->enabled = false;
          for($n = 1; $n <= $this->num_geozones; $n ++) {
            if ((( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) > 0) && (( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) == $this->getGeoZoneID ( $order->delivery ['country'] ['id'], $order->delivery ['zone_id'] ))) {
              $this->enabled = true;
              $this->delivery_geozone = $n;
              break;
            } elseif ((( int ) constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID' ) == 0) && ($n == ( int ) $this->num_geozones)) {
              $this->enabled = true;
              $this->delivery_geozone = $n;
              break;
            }
          }
        }
      }
      
      // Set the languages_array to the current store languages
      $this->get_languages();
    }
    
    
    ////
    // Get a quote or all quotes for a geo zone
    function quote( $method = '' ) {
      global $order, $shipping_weight, $shipping_num_boxes, $language;
      
      $combined_quote_weight = $shipping_num_boxes * $shipping_weight;
      $weight_string = '';
      if( tep_not_null( MODULE_SHIPPING_MZMT_WEIGHT_UNITS ) ) {
        $weight_string = ' (' . $combined_quote_weight . ' ' . MODULE_SHIPPING_MZMT_WEIGHT_UNITS . ')';
      }
      $this->quotes = array (
          'id' => $this->code,
          'module' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TEXT_TITLE_' . strtoupper( $language ) ) . $weight_string,
          'methods' => array () 
      );

      $this->determineTableMethod ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_MODE' ) );
      
      if ( $method != '' ) { // Single quote
        $table_number = substr ( $method, 5 );
        
        $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) );
        
        $this->quotes ['methods'] [] = array (
            'id' => 'table' . $table_number,
            'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ),
            'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) 
        );
        
      } else { // All applicable quotes
        for( $table_number = 1; $table_number <= $this->num_tables; $table_number ++ ) {
          if (! tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ))
            continue;
          $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) );
          $this->quotes ['methods'] [] = array (
              'id' => 'table' . $table_number,
			  'module' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ),
              'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ),
              'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) 
          );
        }
      }
      
      // If shipping is set as taxable, add the appropriate tax
      if ($this->tax_class > 0) {
        $this->quotes ['tax'] = tep_get_tax_rate ( $this->tax_class, $order->delivery ['country'] ['id'], $order->delivery ['zone_id'] );
      }
      
      // Add the icon if there is one
      if (tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ) ))
        $this->quotes ['icon'] = tep_image ( DIR_WS_ICONS . constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ), $this->title );
      
      return $this->quotes;
    } // function quote
    
    
    ////
    // Return the module status
    function check() {
      if (! isset ( $this->_check ) ) {
        $check_query = tep_db_query ( "select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_MZMT_STATUS'" );
        $this->_check = tep_db_num_rows ( $check_query );
      }
      return $this->_check;
    }


    ////
    // Second pass of the initial edit, or the Update box has been checked.
    // This method is executed by modified code in admin/modules.php
    // It adds the Configuration table entries for the number of
    //   Zones and Tables set in the first pass, and modifies
    //   existing entries to allow for later updates.
    function update( $vars_array ) {
      // Check that we are actually in the second stage install process or later
      if( ( is_array( $vars_array ) &&
          array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', $vars_array ) &&
          $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'] > 0 &&
          ( array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', $vars_array ) &&
          $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES'] > 0 ) ) ) {
        
        $this->num_geozones = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'];
        $this->num_tables = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES'];
        
        // Add, remove, or modify the database entries for the selected number of Zones/Tables
        $this->zones_tables( $vars_array );
        
        // This part is only done on the second pass of the initial install
        if( $vars_array['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] != 'True' ) {
          // Modify these two entries to add an update warning message
          // Update must be run if the first two are changed as they make changes to the number of geo zones/tables
          $sql_data_array[] = array(
              'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES',
              'configuration_array' => array(
                  'configuration_description' => 'The number of shipping geo zones you want to use. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING
              )
          );
          $sql_data_array[] = array(
              'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_TABLES',
              'configuration_array' => array(
                  'configuration_description' => 'The number of shipping tables per geo zone. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING
              )
          );
        
          // Remove the second install message and replace it with the update checkbox
          $sql_data_array[] = array(
              'configuration_key' => 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES',
              'configuration_array' => array(
                  'configuration_title' => 'Update',
                  'configuration_description' => 'Check if you want to change the number of geo zones or tables. <span style="color:red;"><b>WARNING:</b> This will remove all of the settings below.</span>',
                  'configuration_value' => '',
                  'set_function' => 'tep_cfg_mzmt_update( ',
                  'use_function' => ''
              )
          );
                
          // Use the above arrays to update the configuration table with the tables etc.
          foreach( $sql_data_array as $configuration_data ) {
            tep_db_perform( TABLE_CONFIGURATION, $configuration_data['configuration_array'], 'update', "configuration_key = '" . $configuration_data['configuration_key'] . "'");
          }
        } // if( $vars_array
      } // if( array_key_exists
    } // function update
      
    
    ////
    // Update existing, add new, and/or remove unwanted zones/tables
    function zones_tables( $vars_array ) {
      // Check whether an update has been requested
      // This is always the case for the first pass
      if( ! array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) || 
          ( array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) && 
          $vars_array ['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] == 'True' ) ) {
        // loop an arbitrary number of times, breaking out when we are done
        for( $zone = 1; $zone < 999; $zone ++ ) {
          switch (true) {
            case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) :
              // If the Zone does not exist, and we have less than the selected number of zones, we add the Zone
              tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('<hr />Geo Zone " . $zone . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ID', '', 'Enable this method for the following geo zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_geozones(', 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 ('Geo Zone " . $zone . " Table Mode', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_MODE', 'weight', 'The shipping cost is based on the total weight, total price, or total count of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\', \'count\'), ', now())" );
              tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Icon', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ICON', '', 'The icon of the shipping method. Leave blank if none.', '6', '0', now())" );
              tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Handling Fee', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_HANDLING', '0', 'Handling Fee for this geo zone.', '6', '0', now())" );
            
              foreach ( $this->languages_array as $language ) {
                $lang = '_' . strtoupper ( $language );
                $language_name = ucfirst ( $language );
                tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Title in " . $language_name . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TEXT_TITLE" . $lang . "', '', 'The title of the shipping method in " . $language_name . ".', '6', '0', now())" );
              }
            
              // Update the tables for this zone
              $this->update_tables ( $vars_array, $zone );
              break;
          
            case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) :
              // The Zone data exists, and we are still within the selected number of zones,
              // so we just need to fix the Tables (if required)
              $this->update_tables ( $vars_array, $zone );
              break;
          
            case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) :
              // The zone data exists and we no longer want it, so remove the entries
              tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "%'" );
              $this->update_tables ( $vars_array, $zone );
              break;
          
            default :
            case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) :
              // The zone does not already exist and we do not need it. We're done here.
              // Break out of the loop and return.
              break 2;
          }
        }
      }
    } // function zones_tables


    ////
    // Update existing, add new, and/or remove unwanted tables
    // Done here so that we don't have to repeat this code multiple times in the zones_tables() method
    function update_tables( $vars_array, $zone ) {
      // loop an arbitrary number of times, breaking out when we are done
      for( $tables = 1; $tables < 999; $tables ++ ) {
        switch( true ) {
          case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) :
            // The table does not already exist and we need to create it
            tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "', '', 'Shipping table " . $tables . " for this geo zone', '6', '0', now())" );
    
            foreach( $this->languages_array as $language ) {
              $lang = '_' . strtoupper( $language );
              $language_name = ucfirst( $language );
              tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . " Name', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "_TEXT_WAY" . $lang . "', '', 'Shipping table " . $tables . " name for this geo zone in " . $language_name . "', '6', '0', now())" );
            }
            break;
    
          case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) :
            // The table already exists and we only need to update it
            // The normal update process handles this, so nothering to do here
            break;
    
          case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) :
            // The table already exists and we no longer want it, so remove the entries
            tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "%'" );
            break;
            	   
          default :
          case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) :
            // The table does not already exist and we do not need it. We're done here.
            // Break out of the loop and quit.
            break 2;
        } // switch( true )
      } // for( $tables = 1
    } // function update_tables
    
    
    ////
    // Initial install
    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 ( 'Module Version', 'MODULE_SHIPPING_MZMT_VERSION', '" . $this->version . "', 'The version of this module that you are running', '6', '0', 'tep_cfg_disabled(', now() ) ");
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST', '6', '0', 'tep_cfg_mzmt_language_file_check', 'tep_cfg_do_nothing(' ) ");
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST', '6', '0', 'tep_cfg_mzmt_modules_mod_test', 'tep_cfg_do_nothing(' ) ");
      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 ('Enable Multi-Geo Zone Multi-Table Shipping', 'MODULE_SHIPPING_MZMT_STATUS', 'True', 'Do you want to offer multi-region multi-table rate shipping?', '6', '0', '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, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_MZMT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())" );
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Prefix', 'MODULE_SHIPPING_MZMT_PREFIX', 'shp', 'Use only geo zones that start with this string. Leave blank to show all geo zones, including tax zones.', '6', '0', now())" );
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Weight Units', 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS', 'lbs.', 'Show these units after the weight. If blank, no weight will be shown.', '6', '0', 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_SHIPPING_MZMT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())" );
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Number of Geo Zones', 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', '0', 'The number of shipping geo zones you want to use.', '6', '0', now())" );
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Number of Tables/Geo Zone', 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', '0', 'The number of shipping tables per geo zone.', '6', '0', now())" );
      tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', 'True', '6', '0', 'tep_cfg_mzmt_warning_second_install', 'tep_cfg_do_nothing(' ) ");
      // The remaining configuration values will be added by the Update function once the numbers of geo zones and tables are known.
    }    
    
    ////
    // Uninstall
    function remove() {
      tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode ( "', '", $this->keys () ) . "')" );
    }
    
    
    ////
    // Keys match the database configuration table's configuration_key field
    function keys() {
      $keys = array ();

      $keys [] = 'MODULE_SHIPPING_MZMT_VERSION';
      $keys [] = 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST';
      $keys [] = 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST';
      $keys [] = 'MODULE_SHIPPING_MZMT_STATUS';
      $keys [] = 'MODULE_SHIPPING_MZMT_TAX_CLASS';
      $keys [] = 'MODULE_SHIPPING_MZMT_PREFIX';
      $keys [] = 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS';
      $keys [] = 'MODULE_SHIPPING_MZMT_SORT_ORDER' ;
      $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES';
      $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_TABLES';
      $keys [] = 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES';
      
      for( $zone = 1; $zone <= $this->num_geozones; $zone ++ ) {
        $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID';
        $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_MODE';
        $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ICON';
        
        foreach( $this->languages_array as $language ) {
          $lang = strtoupper( $language );
          $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TEXT_TITLE_' . $lang;
        }
        $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_HANDLING';
        
        for( $tables = 1; $tables <= $this->num_tables; $tables ++ ) {
          $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables;
          
          foreach( $this->languages_array as $language ) {
            $lang = strtoupper( $language );
            $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables . '_TEXT_WAY_' . $lang;
          }
        }
      }
      
      return $keys;
    }

    
    ////
    // Get an array of installed languages
    function get_languages() {
      if( !class_exists( 'language' ) ) {
        include_once DIR_WS_CLASSES . 'language.php';
      }
      $language_class = new language;
      $languages = $language_class->catalog_languages;
      
      foreach( $languages as $this_language ) {
        $this->languages_array[$this_language['id']] = $this_language['directory'];
      }
    }
    
    
    ////
    // Set the correct order total value for the selected shipping basis
    function determineTableMethod($geozone_mode) {
      global $total_count, $shipping_weight;
      
      $this->geozone_mode = $geozone_mode;
      
      if ($this->geozone_mode == 'price') {
        $this->order_total = $_SESSION['cart']->show_total ();
      } elseif ($this->geozone_mode == 'count') {
        $this->order_total = $total_count;
      } else {
        $this->order_total = $shipping_weight;
      }
      
      return true;
    }
    
    
    ////
    // Return the shipping cost based on the table
    function determineShipping( $table_cost ) {
      global $shipping_num_boxes;
      
      for($i = 0, $n = sizeof ( $table_cost ); $i < $n; $i += 2) {
        if ($this->order_total >= $table_cost [$i]) {
          $shipping_factor = $table_cost [$i + 1];
        }
      }
      
      if (substr_count ( $shipping_factor, '%' ) > 0) {
        $shipping = ((($this->order_total * 10) / 10) * ((str_replace ( '%', '', $shipping_factor )) / 100));
      } else {
        $shipping = str_replace ( '$', '', $shipping_factor );
      }
      
      if ($this->geozone_mode == 'weight') {
        $shipping = $shipping * $shipping_num_boxes;
      }
      
      return $shipping;
    }
    
    
    ////
    // Check if the current zone matches one of the geo zones we have set up here
    function getGeoZoneID( $country_id, $zone_id ) {
      // Set the SQL for thegeo zone prefix if any.
      $prefix_sql = '';
      if( MODULE_SHIPPING_MZMT_PREFIX != '' ) {
        $prefix_sql = " and LOWER(gz.geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%'";
      }
      
      // Check for a Geo Zone that explicity includes the country & specific zone (useful for splitting countries with zones up)
      $zone_query = tep_db_query ( "select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . ( int ) $country_id . "' and ztgz.zone_id = '" . ( int ) $zone_id . "'" . $prefix_sql );
      
      if (tep_db_num_rows ( $zone_query )) {
        $zone = tep_db_fetch_array ( $zone_query );
        return $zone ['geo_zone_id'];
      } else {
        // No luck… Now check for a Geo Zone for the country and "All Zones" of the country.
        $zone_query = tep_db_query ( "select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . ( int ) $country_id . "' and (ztgz.zone_id = '0' or ztgz.zone_id is NULL)" . $prefix_sql );
        
        if (tep_db_num_rows ( $zone_query )) {
          $zone = tep_db_fetch_array ( $zone_query );
          return $zone ['geo_zone_id'];
        } else {
          return false;
        }
      }
    }
  } // class
  
  
  ///
  // Function (not a method!) generates a pulldown menu filled with the available Geo Zones
  if( ! function_exists( 'tep_cfg_pull_down_geozones' ) ) {
    function tep_cfg_pull_down_geozones( $zone_class_id, $key = '' ) {
      $name = ( ( $key ) ? 'configuration[' . $key . ']' : 'configuration_value' );
      
      $zone_class_array = array (
        array (
          'id' => '0',
          'text' => 'Rest of the World' 
        ) 
      );
      
      $zone_class_query_raw = "
        select 
          geo_zone_id, geo_zone_name 
        from 
          " . TABLE_GEO_ZONES . " 
        where 
          LOWER(geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%'
        order by 
          geo_zone_name
      ";
      $zone_class_query = tep_db_query( $zone_class_query_raw );
      
      while( $zone_class = tep_db_fetch_array ( $zone_class_query ) ) {
        $zone_class_array [] = array (
          'id' => $zone_class ['geo_zone_id'],
          'text' => $zone_class ['geo_zone_name'] 
        );
      }
      
      return tep_draw_pull_down_menu( $name, $zone_class_array, $zone_class_id );
    }
  }


  ////
  // Check whether admin/modules.php has been modified/replaced
  if( !function_exists( 'tep_cfg_mzmt_modules_mod_test' ) ) {
    function tep_cfg_mzmt_modules_mod_test() {
      $filename = DIR_FS_ADMIN . 'modules.php';
      if( file_exists( $filename ) ) {
        // Read the file into an array, one line per element
        $file_array = file( $filename );
  
        // Step through the file and check for a match with the selected code
        foreach ($file_array as $line) {
          // Check if the line matches one of the lines that should be removed
          if( trim( $line ) == '$module->update( $HTTP_POST_VARS[\'configuration\'] );' ) {
            // The critical line exists, so return success and quit
            return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_MODULES . '</span></div>';
            break;
          }
        }
  
      } else {
        // The file was not found, so return an error
        return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_MISSING . '</span></div>';
  
      } // if( file_exists
  
      // The lines were not found in the file, so return an error message
      return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_NOT_MODIFIED . '</span></div>';
    } // function tep_cfg_mzmt_modules_mod_test
  } // if( !function_exists
  
  
  ////
  // Check whether the language file for this module exists
  // We should only need to check the Admin language, so that is taken from $language
  if (!function_exists('tep_cfg_mzmt_language_file_check')) {
    function tep_cfg_mzmt_language_file_check() {
      global $language;
  
      $language_file = DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/modules/shipping/mzmt.php';
  
      if (file_exists($language_file) && is_file($language_file)) {
        return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_FOUND . '</span></div>';
        break;
      } // if( file_exists
  
      // The language file was not found, so return an error message
      return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_MISSING . '</span></div>';
    } // function tep_cfg_mzmt_language_file_check
  } // if( !function_exists
  
  
  ////
  // Show a warning message about second install step
  // This function is used only in the initial install,
  //   it is removed the first time the module is edited.
  if (!function_exists('tep_cfg_mzmt_warning_second_install')) {
    function tep_cfg_mzmt_warning_second_install() {
      return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_IMAGES . 'ms_info.png', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_TEXT_EXPLAIN_SECOND_STEP . '</span></div>';
    }
  }


  ////
  // Selector for the Update function
  // Can be set to True, but is reset to False once Update runs
  if( !function_exists( 'tep_cfg_mzmt_update' ) ) {
    function tep_cfg_mzmt_update( $key_value, $key ) {
      $string = '';
      $select_array = array(
          0 => 'True',
          1 => 'False'
      );
  
      for ($i=0, $n=sizeof($select_array); $i<$n; $i++) {
        $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value');
  
        if( $select_array[$i] != 'False' ) {
          $string .= '<input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '" /> ';
          $string .= $select_array[$i];
        }
      }
  
      return $string;
    }
  }


  ////
  // Function to show a disabled entry
  if( !function_exists( 'tep_cfg_disabled' ) ) {
    function tep_cfg_disabled( $value ) {
      return tep_draw_input_field( 'configuration_value', $value, ' disabled' );
    }
  }
  
  
  ////
  // Prevent input boxes showing for the output-only test functions
  if (!function_exists('tep_cfg_do_nothing')) {
    function tep_cfg_do_nothing() {
      return '';
    }
  }
   
?>

 

Edited by kanhsu
Link to comment
Share on other sites

Hello @kanhsu,

I found the problem:

Please find in cm_sc_shipping.php line 205:

        	if ( tep_not_null($module) && sizeof($quotes) > 1 && tep_not_null($shipping_modules->quote($method, $module)) ) {

and change to:

        	if ( tep_not_null($module) && tep_not_null($shipping_modules->quote($method, $module)) ) {

Please try and let me know. I'll then upload the update with the fix.

Edited by raiwa
Link to comment
Share on other sites

Hi @raiwa,

Work like a charm, thanks for the help.

 

For anyone who want to change the look of the 'ugly' radio button to a responsive button, here is my code and css. You can adapt it to probably any radio field if you are technical.

a<?php
/*
  $Id: cm_sc_shipping.php
  $Loc: catalog/includes/modules/content/shopping_cart/

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

  Shipping Estimator 4.3 BS
  by @raiwa 
  [email protected]
  www.oscaddons.com

  Original version: Edwin Bekaert ([email protected])
  Justin Baldwin
  Linda McGrath ([email protected])

  Copyright (c) 2016 osCommerce

  Released under the GNU General Public License
*/


  class cm_sc_shipping {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_SC_SHIPPING_TITLE;
      $this->description = MODULE_CONTENT_SC_SHIPPING_DESCRIPTION;
      $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>';

      if ( defined('MODULE_CONTENT_SC_SHIPPING_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_SC_SHIPPING_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_SC_SHIPPING_STATUS == 'True');
      }
    }

    function execute() {
      global $oscTemplate, $currencies, $currency, $request_type, $cart, $order, $total_count, $quotes, $method, $module, $shipping, $navigation, $cart_sid, $cart_country_id, $cart_zone, $cart_zip_code, $cart_address_id, $total_weight, $language, $customer_id, $sendto, $billto;

      $content_width = (int)MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH;

      if (($cart->count_contents() > 0)) {

      	$selected_shipping = null;
      
      	// include the order class (uses the sendto !)
      	if (!class_exists('order')) {
      		require('includes/classes/order.php');
      	}
      	$order = new order;

      	if (tep_session_is_registered('customer_id')) {
      		// user is logged in
      		if (isset($_POST['address_id'])){
      			// user changed address
      			$order->delivery = array();
      			$sendto = $_POST['address_id'];
      			$addresses_query = tep_db_query("select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from address_book where customers_id = '" . $customer_id . "' and address_book_id = '" . $sendto . "'");
      			$addresses_array_changed = tep_db_fetch_array($addresses_query);
      			$country_info = tep_get_countries($addresses_array_changed['country_id'],true);
      			$order->delivery = array('name' => $addresses_array_changed['firstname'] . ' ' . $addresses_array_changed['lastname'], 
	        	    					        'company' => $addresses_array_changed['entry_company'],
	        	    					 'street_address' => $addresses_array_changed['street_address'],
	            								   'postcode' => $addresses_array_changed['postcode'],
	            						  		   'suburb' => $addresses_array_changed['suburb'],
		          										   'city' => $addresses_array_changed['city'],
		          										'country' => array('id' => $addresses_array_changed['country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
		          								 'country_id' => $addresses_array_changed['country_id'],
  		                              'state' => $addresses_array_changed['state'],
		                              'zone_id' => $addresses_array_changed['zone_id'],
		          								 	'format_id' => tep_get_address_format_id($addresses_array_changed['country_id']));

		        
		      } elseif ( !tep_session_is_registered('sendto') ) {
		      	if ( tep_session_is_registered('cart_address_id') ) {
		      	// user once changed address
		      	$sendto = (isset($_POST['cart_address_id'])? $_POST['cart_address_id'] : null);
		      	} else {
		      	// first timer
		      	$sendto = (isset($_POST['customer_default_address_id'])? $_POST['customer_default_address_id'] : null);
		      	}
		      }
		      // set session now
		      $cart_address_id = $sendto;
		      tep_session_register('sendto');
		      
		      tep_session_register('cart_address_id');
		      // set shipping to null ! multipickup changes address to store address...
		      $shipping='';
		    } else {
		    	// user not logged in !
		    	if ( isset($_POST['country_id']) ) {
		    		// country is selected
		    		$country_info = tep_get_countries($_POST['country_id'],true);
		    		$cache_state_prov_values = tep_db_fetch_array(tep_db_query("select zone_code from zones where zone_country_id = '" . $_POST['country_id'] . "' and zone_id = '" . $_POST['zone_id'] . "'"));
		    		$cache_state_prov_code = $cache_state_prov_values['zone_code'];
		    		$order->delivery = array();
		    		$order->delivery = array('postcode' => (isset($_POST['zip_code'])? $_POST['zip_code'] : null),
			                                  'state' => $cache_state_prov_code,
			                                'country' => array('id' => $_POST['country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
			                             'country_id' => $_POST['country_id'],
			      //add state zone_id
		                                  'zone_id' => $_POST['zone_id'],
		                                'format_id' => tep_get_address_format_id($_POST['country_id']));
		        $cart_country_id = $_POST['country_id'];
		        tep_session_register('cart_country_id');
		        //add state zone_id
		        $cart_zone = isset($_POST['zone_id'])? $_POST['zone_id'] : null;
		        tep_session_register('cart_zone');
		        $cart_zip_code = (isset($_POST['zip_code'])? $_POST['zip_code'] : null);
		        tep_session_register('cart_zip_code');
		      } elseif ( tep_session_is_registered('cart_country_id') ) {
		      	// session is available
		      	$country_info = tep_get_countries($cart_country_id,true);
		      	$order->delivery = array();
		      	$order->delivery = array('postcode' => $cart_zip_code,
		                                  'country' => array('id' => $cart_country_id, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
		                               'country_id' => $cart_country_id,
		                                'format_id' => tep_get_address_format_id($cart_country_id),
		                                  'zone_id' => $cart_zone);
		      } else {
		      	// first timer
		      	$cart_country_id = STORE_COUNTRY;
		        $cart_zone = STORE_ZONE;
		        $cart_zip_code = MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP;
		      	tep_session_register('cart_country_id');
		      	tep_session_register('cart_zone');
		      	tep_session_register('cart_zip_code');
		      	$country_info = tep_get_countries(STORE_COUNTRY,true);
		      	$order->delivery = array();
		      	$order->delivery = array('postcode' => MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP,
		                                  'country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                   'country_id' => STORE_COUNTRY,
		                                'format_id' => tep_get_address_format_id($cart_country_id),
		                                  'zone_id' => STORE_ZONE);
		      }
		      // set the cost to be able to calculate free shipping
		      $order->info = array('total' => $cart->show_total(), // TAX ????
                            'currency' => $currency,
                       'currency_value'=> $currencies->currencies[$currency]['value']);

        }

        // weight and count needed for shipping
        $total_weight = $cart->show_weight();
        $total_count = $cart->count_contents();
        require('includes/classes/shipping.php');
        $shipping_modules = new shipping;
        $quotes = $shipping_modules->quote();
        $order->info['subtotal'] = $cart->total;

        // set selections for displaying
        $selected_country = $order->delivery['country']['id'];
        $selected_address = $sendto;
        
        // eo shipping cost
        // check free shipping based on order total
        if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
        	switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
        	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;
        	}
        	$free_shipping = false;
        	if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
        		$free_shipping = true;
        		include('includes/languages/' . $language . '/modules/order_total/ot_shipping.php');
        	}
        } else {
        	$free_shipping = false;
        }
        // begin shipping cost
        if( !$free_shipping && $cart->get_content_type() !== 'virtual' ) {
        	if (isset($_POST['sid']) && tep_not_null($_POST['sid'])){
        		list($module, $method) = explode('_', $_POST['sid']);
        		$cart_sid = $_POST['sid'];
        		tep_session_register('cart_sid');
        	} elseif ( tep_session_is_registered('cart_sid') ) {
        		list($module, $method) = explode('_', $cart_sid);
        	} else {
        		$module = null;
        		$method = null;
        	}
        	
        	if ( tep_not_null($module) && tep_not_null($shipping_modules->quote($method, $module)) ) {
        		$selected_quote = $shipping_modules->quote($method, $module);
        		if( isset($selected_quote[0]['error'])) {
        			$selected_shipping = $shipping_modules->cheapest();
        			$order->info['shipping_method'] = $selected_shipping['title'];
        			$order->info['shipping_cost'] = $selected_shipping['cost'];
        			$order->info['total']+= $selected_shipping['cost'];
        		} else {
        			$order->info['shipping_method'] = $selected_quote[0]['module'] . (tep_not_null($selected_quote[0]['methods'][0]['title'])? ' (' . $selected_quote[0]['methods'][0]['title'] . ')': '' );
        			$order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost'];
        			$order->info['total']+= $selected_quote[0]['methods'][0]['cost'];
        			$selected_shipping['title'] = $order->info['shipping_method'];
        			$selected_shipping['cost'] = $order->info['shipping_cost'];
        			$selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id'];
        		}
        	} else {
        		$selected_shipping = $shipping_modules->cheapest();
        		$order->info['shipping_method'] = $selected_shipping['title'];
        		$order->info['shipping_cost'] = $selected_shipping['cost'];
        		$order->info['total']+= $selected_shipping['cost'];
        	}
        }
        // virtual products use free shipping
        if ( $cart->get_content_type() == 'virtual' ) {
        	$order->info['shipping_method'] = MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_FREE_TEXT . ' ' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_ALL_DOWNLOADS;
        	$order->info['shipping_cost'] = 0;
        }
        if ( $free_shipping ) {
        	$order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
        	$order->info['shipping_cost'] = 0;
        }
        $shipping = $selected_shipping;
        if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
        // end of shipping cost
        // end free shipping based on order total
   
        $sc_order_shipping = '<div class="panel panel-default">';
        $sc_order_shipping .= '	<div class="panel-heading">';
        $sc_order_shipping .= '		<h3 class="panel-title">' . MODULE_CONTENT_SC_SHIPPING_MODULE_TITLE . '</h3>'; // BS panel heading
        $sc_order_shipping .= '	</div>';
        $sc_order_shipping .= '	<div class="panel-body">';
  
        $sc_order_shipping .= tep_draw_form('estimator', tep_href_link('shopping_cart.php', '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"'
        $sc_order_shipping .= tep_draw_hidden_field('sid', $selected_shipping['id']);
        $sc_order_shipping .= '	<div class="row">';

        if ( tep_session_is_registered('customer_id') ) {
        	// logged in
        	if ( MODULE_CONTENT_SC_SHIPPING_SHOWWT == 'True' ) {
        		$showweight = '&nbsp;(' . $total_weight . '&nbsp;' . MODULE_CONTENT_SC_SHIPPING_WTUNIT . ')';
        	}

        	if ( MODULE_CONTENT_SC_SHIPPING_SHOWIC == 'True' ) {
        		$sc_order_shipping .= '<div class="col-sm-12">' . ($total_count == 1 ? ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>' : ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>') . '&nbsp;' . $total_count . ((isset($showweight))? $showweight : '')  . '</div>';
        	}
        		
        	if ( $cart->get_content_type() != 'virtual' ) {
            $addresses_query = tep_db_query("select distinct address_book_id, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from address_book where customers_id = '" . $customer_id . "'");
            // only display addresses if more than 1
            if ( tep_db_num_rows($addresses_query) > 1 ) {
              while ( $addresses = tep_db_fetch_array($addresses_query) ) {
                $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' '));
              }
  
              $sc_order_shipping .= '<div class="col-sm-2 estimator-padding">' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_ADDRESS . '</div><div class="col-sm-10 estimator-padding">'. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"') . '</div>';
            }
            $sc_order_shipping .= '<div class="clearfix"></div>';
            $sc_order_shipping .= '<div class="col-sm-2 estimator-padding"><strong>' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_TO .'</strong>' . '</div><div class="col-sm-6 estimator-padding">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</div><div class="col-sm-4 estimator-padding text-right">'. tep_draw_button(IMAGE_BUTTON_ADD_ADDRESS, 'fa fa-envelope', tep_href_link('checkout_shipping_address.php', '', 'SSL'), NULL, NULL, 'btn btn-info btn-xs' ) . '</div>';
          }

        } else {
        	// not logged in
        	$navigation->set_snapshot();
        	$sc_order_shipping .= '<div class="col-sm-12">' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_OPTIONS_LOGIN . tep_draw_button(MODULE_CONTENT_SC_SHIPPING_BUTTON_LOGIN, 'glyphicon glyphicon-log-in', tep_href_link('login.php'), 'btn-success btn-sm') . '</div>';

        	if( MODULE_CONTENT_SC_SHIPPING_SHOWIC == 'True' ) {
        		$sc_order_shipping .= '<div class="col-sm-12 estimator-padding">' . ($total_count == 1 ? ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>' : ' <strong>' . MODULE_CONTENT_SC_SHIPPING_ITEM . '</strong>') . '&nbsp;' . $total_count . ((isset($showweight))? $showweight : '')  . '</div>';
        	}

        	if ( $cart->get_content_type() != 'virtual' ) {

        	  if ( MODULE_CONTENT_SC_SHIPPING_SHOWCDD == 'True' ) {
        	    $sc_order_shipping.= '<div class="form-group has-feedback">';
        	    if ( MODULE_CONTENT_SC_SHIPPING_SHOWSDD == 'True' || MODULE_CONTENT_SC_SHIPPING_SHOWZDD == 'True' ) {
        	      $sc_order_shipping.= '<label for="inputCountry" class="control-label col-sm-4">' .  ENTRY_COUNTRY . '</label>';
        	    } else {
        	      $sc_order_shipping.= '<label for="inputCountry" class="control-label col-sm-4">' .  ENTRY_COUNTRY . '</label>';
        	    }
        	    $sc_order_shipping.= '<div class="col-sm-8">' . tep_get_country_list('country_id', $selected_country, 'id="inputCountry"') . '</div>';
        	    $sc_order_shipping.= '</div>';
        		} else {
        			$sc_order_shipping.= tep_draw_hidden_field('country_id', STORE_COUNTRY);
        		}
        
        		//add state zone_id
        		$state_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
        		$state_query = tep_db_query("select zone_name, zone_id from zones where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name");
        		while ( $state_values = tep_db_fetch_array($state_query) ) {
        			$state_array[] = array('id' => $state_values['zone_id'],
	                                 'text' => $state_values['zone_name']);
	          }

	          if ( MODULE_CONTENT_SC_SHIPPING_SHOWSDD == 'True' && count($state_array) > 1) {
	            $sc_order_shipping.= '<div class="form-group has-feedback">';
	            $sc_order_shipping.= '<label for="inputState" class="control-label col-sm-4">' .  ENTRY_STATE . '</label>';
	            $sc_order_shipping.= '<div class="col-sm-8">' . tep_draw_pull_down_menu('zone_id', $state_array, (isset($_POST['zone_id'])? $_POST['zone_id'] : STORE_ZONE), 'id="inputState"') . '</div>';
	            $sc_order_shipping.= '</div>';
        		} else {
        			$sc_order_shipping.= tep_draw_hidden_field('zone_id', STORE_ZONE);
        		}

	          if ( MODULE_CONTENT_SC_SHIPPING_SHOWZDD == 'True' ) {
	            $sc_order_shipping.= '<div class="form-group has-feedback">';
	            $sc_order_shipping.= '<label for="inputZip" class="control-label col-sm-4">' .  ENTRY_POST_CODE . '</label>';
	            $sc_order_shipping.= '<div class="col-sm-4">' . tep_draw_input_field('zip_code', (isset($_POST['zip_code'])? $_POST['zip_code'] : MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP), 'id="inputZip"', 'text', true, 'class="form-control" style="width: 125px;"') . '</div>';
	            $sc_order_shipping.= '</div>';
	            if ( MODULE_CONTENT_SC_SHIPPING_SHOWUB == 'True' ) {
	            	$sc_order_shipping.='<div class="col-sm-4 text-right"><a class="btn btn-default" role="button" href="_" onclick="return shipincart_submit(\'\');"><i class="glyphicon glyphicon-refresh"></i>&nbsp;'. IMAGE_BUTTON_UPDATE . ' </a></div>';
	            }
	          } else {
	            if ( MODULE_CONTENT_SC_SHIPPING_SHOWUB == 'True' ) {
	            	$sc_order_shipping.='<div class="col-sm-12 text-right"><a class="btn btn-default" role="button" href="_" onclick="return shipincart_submit(\'\');"><i class="glyphicon glyphicon-refresh"></i>&nbsp;'. IMAGE_BUTTON_UPDATE . ' </a></div>';
	            }
	          }
        	}
        }
    
        $sc_order_shipping .= '			</div><br>';
		$sc_order_shipping .= '			<div class="shippingradio">';
        $sc_order_shipping .= '			<table class="table table-condensed table-hover"';
          
        $at_least_one_quote_printed = false;

        if ( $cart->get_content_type() == 'virtual' ) {
        	// virtual product-download
        	$sc_order_shipping .= '<tr><td><i>' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_FREE_TEXT . ' ' . MODULE_CONTENT_SC_SHIPPING_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>';
		      $at_least_one_quote_printed = true;
        } elseif ( $free_shipping==1 ) {
        	// order $total is free
        	$sc_order_shipping.='<tr><td><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td></tr>';
        } else {
        	// shipping display
        	if ( empty($quotes[0]['error']) || (!empty($quotes[1])&&empty($quotes[1]['error'])) ) {
        		
        
        		// added to Display Message when No Shipping Options are Available
        		$at_least_one_quote_printed = false;
        	} else {
        		$sc_order_shipping .= '<tr><td>&nbsp;</td></tr>';
        	}
      
        	$sc_order_shipping .= '				<tbody>';
        		
        	if ( sizeof($quotes) ) {
        		for ( $i=0, $n=sizeof($quotes); $i<$n; $i++ ) {
        			if ( isset($quotes[$i]['methods']) &&  sizeof($quotes[$i]['methods'])==1 ) {
        				// simple shipping method
        				$thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][0]['id'];
        				$sc_order_shipping .= '';
          
        				if ( !empty($quotes[$i]['error']) ) {
        					$sc_order_shipping .= '<tr><td>' . $quotes[$i]['module'] . '&nbsp;(' . $quotes[$i]['error'] . ')</td></tr>';
        				} else {
        			if ( $selected_shipping['id'] == $thisquoteid) {
                    $sc_order_shipping.='<tr class="success col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">';
					$sc_order_shipping.='<label class="RadioContainer">' . tep_draw_radio_field('', true, true) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD .'">&nbsp;<strong>' . $quotes[$i]['module'] . '</strong></a>';
                    $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : '';
                    $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][0]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][0]['title'] . '<hr></div>': '' );
                    $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>';
                  } else {
                    $sc_order_shipping.= '<tr class="col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">' ;
					$sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', false, false) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD . '">&nbsp;' . $quotes[$i]['module'] . '</a>';
                    $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : '';
                    $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][0]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][0]['title'] . '<hr></div>': '' );
                    $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>';
        					}
        				}
        				// added to Display Message when No Shipping Options are Available
        				$at_least_one_quote_printed = true;
		          	} elseif ( isset($quotes[$i]['methods']) && sizeof($quotes[$i]['methods'])>1 ) {
		          		// shipping method with sub methods (multipickup)
		          		for ( $j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++ ) {
		          			$thisquoteid = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'];
		          			$sc_order_shipping .= '';
		          			if ( isset($quotes[$i]['error']) && $quotes[$i]['error'] == true ) {
		          				$sc_order_shipping .= '<tr><td>' . $quotes[$i]['module'] . '&nbsp;(' . $quotes[$i]['error'] . ')</td></tr>';
		          			} else {
						
		          		if ( $selected_shipping['id'] == $thisquoteid ) {
                        $sc_order_shipping.= '<tr class="success col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">' ;
						$sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', true, true) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD .'"><strong>' . $quotes[$i]['module'] . '</strong></a>';
                        $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : '';
                        $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][$j]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][$j]['title'] . '<hr></div>': '' );
                        $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>';
                      } else {
                        $sc_order_shipping.= '<tr class="col-sm-6"><td class="col-sm-6" style="background-color:#fff;border-width: 2px" onclick="return shipincart_submit(\''.$thisquoteid.'\');">';
						$sc_order_shipping.= '<label class="RadioContainer">'. tep_draw_radio_field('', false, false) . '<a href="_" title="' . MODULE_CONTENT_SC_SHIPPING_SELECT_THIS_METHOD . '">' . $quotes[$i]['module'] . '</a>';
                        $sc_order_shipping.= (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon']))? $quotes[$i]['icon'] : '';
                        $sc_order_shipping.= (tep_not_null($quotes[$i]['methods'][$j]['title'])? '<div class="shippingcontent help-block"><hr>' . $quotes[$i]['methods'][$j]['title'] . '<hr></div>': '' );
                        $sc_order_shipping.= '<div class="shippingamount"><span>' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], ((!empty($quotes[$i]['tax']))? $quotes[$i]['tax'] : null ))) . '</span></div><span class="RadioCheckmark"></span></label></td></tr>';
		          				}
		          			}
		          		}
		          		// added to Display Message when No Shipping Options are Available
		          		$at_least_one_quote_printed = true;
		          	}
		          }
		        } // end if size of quotes
		      } // end if not virtual
		      // added to Display Message when No Shipping Options are Available
		      if ( !$at_least_one_quote_printed ) {
		        $sc_order_shipping .= '<tr><td class="text-center">' . MODULE_CONTENT_SC_SHIPPING_NO_OPTIONS_MESSAGE . '</td></tr>';
		      }

		      $sc_order_shipping .= '				</tbody>';
		      $sc_order_shipping .= '			</table>';
  			  $sc_order_shipping .= '			</div>';
		      $sc_order_shipping .= '  </form>';
		      $sc_order_shipping .= '	</div>'; // end body
		      $sc_order_shipping .= '</div>'; //end panel

		      tep_session_register('shipping');


		      ob_start();
	    		include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
		      $template = ob_get_clean();

		      $oscTemplate->addContent($template, $this->group);
		      
$script = <<<EOL
<script>
  function shipincart_submit(sid){
    if(sid){
      document.estimator.sid.value=sid;
    }
    document.estimator.submit();
    return false;
  }
</script>
EOL;
        $oscTemplate->addBlock($script, 'footer_scripts');

		   } // Use only when cart_contents > 0
    }

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_CONTENT_SC_SHIPPING_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shipping Estimator Module', 'MODULE_CONTENT_SC_SHIPPING_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_SC_SHIPPING_SORT_ORDER', '400', 'Sort order of display. Lowest is displayed first.', '6', '3', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display item count', 'MODULE_CONTENT_SC_SHIPPING_SHOWIC', 'True', 'Display item count?', '6', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display shipping weight', 'MODULE_CONTENT_SC_SHIPPING_SHOWWT', 'True', 'Display shipping weight?', '6', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping weight unit', 'MODULE_CONTENT_SC_SHIPPING_WTUNIT', 'lbs', 'Shipping weight unit.', '6', '6', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Country drop-down menu', 'MODULE_CONTENT_SC_SHIPPING_SHOWCDD', 'True', 'Display Country drop-down menu?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display State drop-down menu', 'MODULE_CONTENT_SC_SHIPPING_SHOWSDD', 'False', 'Display State drop-down menu?', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Zip Code Input Field', 'MODULE_CONTENT_SC_SHIPPING_SHOWZDD', 'False', 'Display Zip Code drop-down menu?', '6', '9', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Default ZIP', 'MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP', '', 'The dafault Zip Code to show for first time load if \"Display Zip Code\" is enabled.', '6', '10', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Update button', 'MODULE_CONTENT_SC_SHIPPING_SHOWUB', 'True', 'Display Update button?', '6', '11', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
   }

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

    function keys() {
      return array('MODULE_CONTENT_SC_SHIPPING_STATUS', 'MODULE_CONTENT_SC_SHIPPING_CONTENT_WIDTH', 'MODULE_CONTENT_SC_SHIPPING_SORT_ORDER', 'MODULE_CONTENT_SC_SHIPPING_SHOWIC', 'MODULE_CONTENT_SC_SHIPPING_SHOWWT', 'MODULE_CONTENT_SC_SHIPPING_WTUNIT', 'MODULE_CONTENT_SC_SHIPPING_SHOWCDD', 'MODULE_CONTENT_SC_SHIPPING_SHOWSDD', 'MODULE_CONTENT_SC_SHIPPING_SHOWZDD', 'MODULE_CONTENT_SC_SHIPPING_DEFAULT_ZIP', 'MODULE_CONTENT_SC_SHIPPING_SHOWUB');
    }
  }
.shippingradio table {
	border-collapse: separate;
	border-spacing: 0px 5px;
}
.shippingradio td{
	border: solid 2px #ddd;
	border-radius: 10px;
	padding: 5px 10px 5px 10px;
}
.shippingradio td:hover {
	border: solid 2px #999;
	transition: border 0.5s ease-in;
}

.shippingradio tr.success > td{
  border: solid 2px #F00;
  transition: border 0.5s ease-in;
}

.shippingamount span{
	color:#333;
}
.shippingradio tr.success>td>label>div.shippingamount>span{
	color:#F00;
}

.shippingcollapsible {
  color: #333;
  cursor: pointer;
  padding-right: 10px;
  border: none;
  outline: none;
}

.shippingcontent {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-out;
}

.shippingradio tr.success>td>label>div.shippingcontent {
	max-height:100%;
	transition: max-height 0.5s ease-out;
}

 

Link to comment
Share on other sites

24 minutes ago, kanhsu said:

For anyone who want to change the look of the 'ugly' radio button to a responsive button, here is my code and css.

Thanks. I'll try and maybe include it also in the next update

Link to comment
Share on other sites

Update uploaded:

Ship In Cart BS reloaded 4.4.

Changes Vers. 4.4:
  - Fixed shipping method selection if only one module with several methods installed. Thanks to @kanhsu

 

Link to comment
Share on other sites

  • 6 months later...

Phoenix update uploaded:

Ship In Cart CE reloaded

Changes Vers. 5.0:
  - Update for Phoenix 1.0.x.x
  - html code moved to template

 

Link to comment
Share on other sites

  • 3 weeks later...

@raiwa

*** Never mind ... I found it *** <face-palm>

 

I had used Ship in Cart BS v3.7 on an older shop, as well as the USPS Rate v4 module. Together, there used to be a provision for the customer to enter their Postal Code to get their shipping costs.

I'm now working on a new shop using Phoenix v1.0.1.4. I've loaded the USPS Rate v4 module, and your new Ship in Cart v5 module. It is retrieving the proper costs when a customer is logged in.

However, if the customer is NOT logged in, there is no provision for the customer to enter a postal code. They can select a country other than the United States, and it returns a proper postage rate. But, if they select the United States, it returns:

I'm sorry, there are no shipping options to your address.
Please contact us for special shipping arrangements. 

Am I overlooking something?

TIA

Malcolm

Edited by ArtcoInc
<face-palm>
Link to comment
Share on other sites

Hello Malcolm @ArtcoInc,

The usps shipping module is zip code based. Please activate the zip field in the ship in cart module and fill in a default zip, usually the store’s zip.

Link to comment
Share on other sites

  • 7 months later...
13 minutes ago, rupruprup said:

 

thank you Rainer, what do we have to change for Phoenix 1.0.5.5 ... etc ?

 

I had no time yet to check this for higher Phoenix versions, but it should work up to 1.0.5.0. For higher versions, please await for the update.
Probably it will be updated for Phoenix 1.0.6.0 release.

Link to comment
Share on other sites

  • 3 weeks later...

Has anybody been able to install this on Phoenix v1.0.58?

I'm getting the following error on the shopping cart after installing it and I'm at loss. Any clues?

Fatal error: Uncaught Error: Call to a member function fetch_to_address() on null in C:\xampp\htdocs\Phoenix1058\includes\system\versioned\1.0.5.3\order.php:170 Stack trace: #0 C:\xampp\htdocs\Phoenix1058\includes\system\versioned\1.0.5.3\order.php(27): order->cart() #1 C:\xampp\htdocs\Phoenix1058\includes\modules\content\shopping_cart\cm_sc_shipping.php(61): order->__construct() #2 C:\xampp\htdocs\Phoenix1058\includes\system\versioned\1.0.4.0\osc_template.php(147): cm_sc_shipping->execute() #3 C:\xampp\htdocs\Phoenix1058\shopping_cart.php(15): oscTemplate->getContent('shopping_cart') #4 {main} thrown in C:\xampp\htdocs\Phoenix1058\includes\system\versioned\1.0.5.3\order.php on line 170

Edited by Patty

Patty

Link to comment
Share on other sites

15 minutes ago, Patty said:

Call to a member function fetch_to_address() on null

It looks like it needs to have the $customer object created. 

$customer = new customer($customer_id);

You may have to find a way to make it work with a fake customer ID when the customer is not logged in.  Possibly would require shipto and billto to be stored in the session (as arrays of information). 

Always back up before making changes.

Link to comment
Share on other sites

Well, I tried, but this is too complicated for me. I think this addon will have to be completely revamped for the latest Phoenix versions, for they are very different from the earlier ones.
I hope someone tackles it soon, for this is an important feature to have in the store. IMHO I think it should be part of the project.

Patty

Link to comment
Share on other sites

It works with Phoenix 1.0.5.0

On 4/10/2020 at 6:02 PM, raiwa said:

For higher versions, please await for the update.
Probably it will be updated for Phoenix 1.0.6.0 release.

 

Link to comment
Share on other sites

8 hours ago, Patty said:

Well, I tried, but this is too complicated for me. I think this addon will have to be completely revamped for the latest Phoenix versions, for they are very different from the earlier ones.
I hope someone tackles it soon, for this is an important feature to have in the store. IMHO I think it should be part of the project.

I am sure it will be updated, as @raiwa Rainer has said many times when the next fixed release is available. Until then people will have to be patient. its one problems that people have created for themselves in using code that should not really be used in a live environment.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

 

9 hours ago, Patty said:

I hope someone tackles it soon

That "someone" would be YOU.  If actual coding is too complicated for you, then you get it done by a competent coder and release it as an update.

Don't rely on someone else all the time - be proactive yourself.

 

Link to comment
Share on other sites

8 hours ago, 14steve14 said:

I am sure it will be updated, as @raiwa Rainer has said many times when the next fixed release is available. Until then people will have to be patient. its one problems that people have created for themselves in using code that should not really be used in a live environment.

It's not live, it's on testing environment.

Patty

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...