=============================================================================================

  shipincart_2.2.1_Mod: Display Message when No Shipping Options are Available v0.1
  Author: Todd Holforty - mtholforty (at) surfalot (dot) com

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

  Released under the GNU General Public License

==============================================================================================


Purpose: 

	I discovered that the Ship In Cart v2.2.1 (contrib:1781) did not take into 
	account the possibility that it may be planned to not have any shipping 
	results returned. Like maybe you only ship inside your own country.
	Or maybe you would like a special message to show if you have heavily 
	restricted shipping options. Or you just want to play it safe and display
	a contact us link if no shipping options are returned, maybe as a result
	of the shipping company's site is down.

	This is a modification to Ship In Cart v2.2.1 (contrib:1781), please 
	make sure that is installed first.
	
	Also, one change is referenced that fixes a specific situation 
	in which USPS Methods v2.8 (contrib:487) throws an error if you
	do not select any international shipping options and someone tries
	to use Ship In Cart v2.2.1 (contrib:1781) to get an estimate for a 
	foreign country.  I included it here since I ran into the problem
	as I was working on this mod for Ship In Cart v2.2.1.



BACK UP FIRST!!!


Add changes to the following files
===========================================================

Open File:

/catalog/includes/modules/shipping_estimator.php


Find:
        $ShipTxt.='<tr><td colspan="3" class="main">&nbsp;</td></tr><tr><td class="main"><b>' . CART_SHIPPING_CARRIER_TEXT . '</b></td><td class="main" align="left"><b>' . CART_SHIPPING_METHOD_TEXT . '</b></td><td class="main" align="right"><b>' . CART_SHIPPING_METHOD_RATES . '</b></td></tr>';

        $ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';


Add after it:

      // added to Display Message when No Shipping Options are Available
      $at_least_one_quote_printed = false;


--------------------------------


Search for "shipping method with sub methods (multipickup)" as shown in code below:

        } else {
          // shipping method with sub methods (multipickup)
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {


Change the "} else {" line to:

        } elseif(sizeof($quotes[$i]['methods'])>1) {


Then place this code imediately before the above line:

          // added to Display Message when No Shipping Options are Available
          $at_least_one_quote_printed = true;


The new code block should look like this:

          // added to Display Message when No Shipping Options are Available
          $at_least_one_quote_printed = true;
        } elseif(sizeof($quotes[$i]['methods'])>1) {
          // shipping method with sub methods (multipickup)
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {




--------------------------------


Find (yes, just a huge block of end function brackets):


              }
            }
          }
        }
      }
    }
  } 



change it to:

              }
            }
          }
          // added to Display Message when No Shipping Options are Available
          $at_least_one_quote_printed = true;
        }
      }
	  // added to Display Message when No Shipping Options are Available
      if (!$at_least_one_quote_printed) {
	    $ShipTxt.= '<tr><td colspan="4" class="main" align="center">'.SHIPPING_ESTIMATOR_NO_OPTIONS_MESSAGE.'</td></tr>';
	  }
    }
  } 




--------------------------------


Open File:

/catalog/includes/languages/english/modules/shipping_estimator.php


At the end, before the ?> tag, copy this in:


/* Added by shipincart mod to display a message when no shipping options are returned. */
define('SHIPPING_ESTIMATOR_NO_OPTIONS_MESSAGE', 'I\'m sorry, there are no shipping options to your address.<br />Please <a href="'.FILENAME_CONTACT_US.'">contact us</a> for special shipping arrangements.');


Add this to any other appropriate language file you have.



-----------------------------------------------------
IF YOU HAVE USPS Methods v2.8 (contrib:487) installed
-----------------------------------------------------
And lastly, one change in another file to avoid an  
error message if you do not choose any international 
shipping in USPS Methods v2.8 (contrib:487).


Open File:

/catalog/includes/modules/shipping/usps.php


Find:

          foreach( explode(", ", MODULE_SHIPPING_USPS_TYPES_INTL) as $value ) $allowed_types[$value] = $this->intl_types[$value];


Change to:

          if (defined(MODULE_SHIPPING_USPS_TYPES_INTL)&&MODULE_SHIPPING_USPS_TYPES_INTL!='') {
            foreach( explode(", ", MODULE_SHIPPING_USPS_TYPES_INTL) as $value ) $allowed_types[$value] = $this->intl_types[$value];
          }











