Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

check out problem, stuck on check out shipping


Juto

Recommended Posts


Hi, hopefully someone can help me. I have tried to fix this for last 4-5 days, search forums and googled.

 

I have added zones like "domestic", european economic area, rest of euorope and so on.

At the admin side it looks ok, as far as I can see.

I have also added new shipping methods like "priority mail delivery", "economy mail delivery" simply duplicating the table method. As payment module I have set flat rate.

 

It simply doesn't work out:

 

1) Shipping methods do show up, with radio buttons

 

2) But, nothing happens when I click on continue, I am stuck at checkout shipping.

 

I added a debug snippet which output is:

 

debug checkout_shipping.php:post:
Array (
[formid] => 7d3989e7224b3edefd11df7344cc340c
[action] => process [shipping] => inrikesbrev_economy_inrikesbrev_economy
[message] => [icon_continue] => submit
)
debug checkout_shipping.php:session:
Array (
[sessiontoken] => 7d3989e7224b3edefd11df7344cc340c
[cart] => shoppingCart Object ( [contents] => Array ( [81] => Array ( [qty] => 1 ) ) [total] => 1 [weight] => 1 [cartID] => 14494 [content_type] => physical )
[language] => svenska [languages_id] => 4 [currency] => SEK
[navigation] => navigationHistory Object ( [path] => Array ( [0] => Array ( 

 => logoff.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( 

 => index.php [mode] => NONSSL [get] => Array ( [cPath] => 52 [sort] => 2a [action] => buy_now [products_id] => 81 ) [post] => Array ( ) ) [2] => Array ( 

 => shopping_cart.php [mode] => NONSSL [get] => Array ( [sort] => 2a ) [post] => Array ( ) ) [3] => Array ( 

 => checkout_shipping.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( [formid] => 7d3989e7224b3edefd11df7344cc340c [action] => process [shipping] => inrikesbrev_economy_inrikesbrev_economy [message] => [icon_continue] => submit ) ) ) [snapshot] => Array ( ) )
[customer_id] => 6
[customer_default_address_id] => 6
[customer_first_name] => Sara [customer_last_name] =>
[customer_country_id] => 203
[customer_zone_id] => 202
[sendto] => 6
[cartID] => 14494
[comments] =>
)

 

Noting:

1)

Last name missing

2)

And:

[customer_country_id] => 203

[customer_zone_id] => 202

 

What does this mean?

 

Checkout shipping is this:

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2008 osCommerce
 Released under the GNU General Public License
*/
 require('includes/application_top.php');
//Moved from line 114
 include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
 require('includes/classes/http_client.php');
//Begin checkout-instead-of-home-page
// if the customer is not logged on, redirect them to the login page
/*  if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }
*/
// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
//End checkout-instead-of-home-page
// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('sendto')) {
   tep_session_register('sendto');
   $sendto = $customer_default_address_id;
 } else {
// verify the selected shipping address
   if ( (is_array($sendto) && empty($sendto)) || is_numeric($sendto) ) {
  $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
  $check_address = tep_db_fetch_array($check_address_query);
  if ($check_address['total'] != '1') {
    $sendto = $customer_default_address_id;
    if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
  }
   }
 }
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;
// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
//Bugfix Ref: https://github.com/osCommerce/oscommerce2/commit/f4bafd9a17978546ce076f8108cb722a6bd8e14a
//Replace
//  if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
//  $cartID = $cart->cartID;
//With
 if (!tep_session_is_registered('cartID')) {
   tep_session_register('cartID');
 } elseif (($cartID != $cart->cartID) && tep_session_is_registered('shipping')) {
   tep_session_unregister('shipping');
 }
 $cartID = $cart->cartID = $cart->generate_cart_id();
//End Replace
// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
 if ($order->content_type == 'virtual') {
   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
   $shipping = false;
   $sendto = false;
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }
 $total_weight = $cart->show_weight();
 $total_count = $cart->count_contents();
// load all enabled shipping modules
 require(DIR_WS_CLASSES . 'shipping.php');
 $shipping_modules = new shipping;
 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
   $pass = false;
   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;
   }
   $free_shipping = false;
//Bugfix Ref: http://www.oscommerce.com/forums/topic/365714-free-shipping/
// and http://www.oscommerce.com/forums/topic/270956-free-shipping-option-bug/
//The fix
//   if ( ($pass == true) && ($cart->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
//Instead of:
//    if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
  if ( ($pass == true) && ($cart->show_total() >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
  $free_shipping = true;
//Moved to line 15 after inclusion of application_top
//	  include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
   }
 } else {
   $free_shipping = false;
 }
// process the selected shipping method
//RC2a final: (C) (SEC) Add Customer Session Token to Forms
  if ( isset($_POST['action']) && ($_POST['action'] == 'process') && isset($_POST['formid']) && ($_POST['formid'] == $sessiontoken) ) {
//BOC DEBUG:
/*
tep_debug_var('checkout_shipping.php:post', $_POST);
echo '<br>';
tep_debug_var('checkout_shipping.php:session', $_SESSION);
exit;
OUTPUT:
debug checkout_shipping.php:post:
Array (
[formid] => 7d3989e7224b3edefd11df7344cc340c
[action] => process [shipping] => inrikesbrev_economy_inrikesbrev_economy
[message] => [icon_continue] => submit
)
debug checkout_shipping.php:session:
Array (
[sessiontoken] => 7d3989e7224b3edefd11df7344cc340c
[cart] => shoppingCart Object ( [contents] => Array ( [81] => Array ( [qty] => 1 ) ) [total] => 1 [weight] => 1 [cartID] => 14494 [content_type] => physical )
[language] => svenska [languages_id] => 4 [currency] => SEK
[navigation] => navigationHistory Object ( [path] => Array ( [0] => Array ( 

 => logoff.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( 

 => index.php [mode] => NONSSL [get] => Array ( [cPath] => 52 [sort] => 2a [action] => buy_now [products_id] => 81 ) [post] => Array ( ) ) [2] => Array ( 

 => shopping_cart.php [mode] => NONSSL [get] => Array ( [sort] => 2a ) [post] => Array ( ) ) [3] => Array ( 

 => checkout_shipping.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( [formid] => 7d3989e7224b3edefd11df7344cc340c [action] => process [shipping] => inrikesbrev_economy_inrikesbrev_economy [message] => [icon_continue] => submit ) ) ) [snapshot] => Array ( ) )
[customer_id] => 6
[customer_default_address_id] => 6
[customer_first_name] => Sara [customer_last_name] =>
[customer_country_id] => 203
[customer_zone_id] => 202
[sendto] => 6
[cartID] => 14494
[comments] =>
)
Noting:
1)
Last name missing
2)
What does this mean?
[customer_country_id] => 203
[customer_zone_id] => 202
*/
//EOC DEBUG
//This Comments field is missplaced. The right one is in checkout_payment
/*
//From checkout_payment:
 if (!tep_session_is_registered('comments')) tep_session_register('comments');
 if (isset($_POST['comments']) && tep_not_null($_POST['comments'])) {
   $comments = tep_db_prepare_input($_POST['comments']);
 }
Hence a Bugfix for Undefined index: comments
*/
   if (!tep_session_is_registered('comments')) tep_session_register('comments');
//    if (tep_not_null($_POST['comments'])) {
   if (isset($_POST['comments']) && tep_not_null($_POST['comments'])) {
  $comments = tep_db_prepare_input($_POST['comments']);
   }
   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
   if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {
  if ( (isset($_POST['shipping'])) && (strpos($_POST['shipping'], '_')) ) {
    $shipping = $_POST['shipping'];
    $free=array();//Bugfix, Added to avoid Error Type: [E_NOTICE] Undefined variable: free
    list($module, $method) = explode('_', $shipping);
    if ( is_object($$module) || ($shipping == 'free_free') ) {
	  if ($shipping == 'free_free') {
	    $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
	    $quote[0]['methods'][0]['cost'] = '0';
	  } else {
	    $quote = $shipping_modules->quote($method, $module);
	  }
	  if (isset($quote['error'])) {
	    tep_session_unregister('shipping');
	  } else {
	    if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
		  $shipping = array('id' => $shipping,
//Bugfix Avoid parenthesis in shipping text:
//							    'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
						    'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' ' . $quote[0]['methods'][0]['title']),
						    'cost' => $quote[0]['methods'][0]['cost']);
		  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
	    }
	  }
    } else {
	  tep_session_unregister('shipping');
    }
  }
   } else {
  $shipping = false;
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
   }
 }
// get all available shipping quotes
 $quotes = $shipping_modules->quote();
// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
/*
http://www.oscommerce.com/forums/topic/38177-shipping-options-lowest-value-default/
:lol: talking to myself here... but ive found a fix for this, and
i figure other people might need to do this also, at some point, so..
$shipping = $shipping_modules->cheapest();
edit to : $shipping = 'table_table';
which forces a pre selection for the table rate option.
the radio buttons have like double names of the relevant shipping modules..
so you could have 'ukpost_ukpost' or 'usafed_usafed' etc.. etc.
if you pre-select a specific mod, but its not an option for some zone..
no problem.. the pre-select just doesnt happen, and it forces a manual select.  :)
*/
 if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) { $shipping = $shipping_modules->cheapest(); }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);
 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
//BOF www.u2commerce.com css header menu-->
 $thisPage="Check Out";
//EOF www.u2commerce.com css header menu-->
//www.u2commerce.com Set unique tags for the current page
 $local_header_tags = '
 <META NAME="googlebot" content="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">
 <META NAME="robots" content="noindex,nofollow,nosnippet,noodp,noarchive,noimageindex">' . "\n";
//  This is for v2.3.1
//  $oscTemplate->addBlock($local_header_tags, 'header_tags' );
//  This for the upgraded version of RC2a
 $oscTemplate->addHeaderTag($local_header_tags);
//  If you prefer to use kiss_mt, remember to comment out the title tag in template_top
//  include_once DIR_WS_MODULES . 'kiss_meta_tags/kiss_meta_tags.php';
 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<script type="text/javascript">
var selected;
function selectRowEffect(object, buttonselect) {
 if (!selected) {
   if (document.getElementById) {
  selected = document.getElementById('defaultSelected');
   } else {
  selected = document.all['defaultSelected'];
   }
 }
 if (selected) selected.className = 'moduleRow';
 object.className = 'moduleRowSelected';
 selected = object;
// one button is not an array
 if (document.checkout_address.shipping[0]) {
   document.checkout_address.shipping[buttonselect].checked=true;
 } else {
   document.checkout_address.shipping.checked=true;
 }
}
function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}
function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
</script>
<!-- body_text //-->
<!--//RC2a final: (C) (SEC) Add Customer Session Token to Forms//-->
<?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'post', 'accept-charset="'.CHARSET.'"', true) . tep_draw_hidden_field('action', 'process'); ?>
 <table summary="" border="0" width="100%" cellspacing="0" cellpadding="0">
   <tr>
  <td>
    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="0" class="mid_column">
	  <tr>
	    <td>
		  <div class="page_heading">
		    <div class="page_heading_text"><?php echo HEADING_TITLE; ?></div>
		  </div>
	    </td>
	  </tr>
    </table>
  </td>
   </tr>
   <tr><!-- Replaced tep_draw_separator -->
  <td><div class="spacer_large"> </div></td>
   </tr>
   <tr>
  <td>
    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
	    <td class="main"><strong><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></strong></td>
	  </tr>
    </table>
  </td>
   </tr>
   <tr>
  <td>
<!-- bugfix replaced class="infoBox" with class="mid_column" -->
    <table summary="" border="0" width="100%" cellspacing="1" cellpadding="2" class="mid_column">
	  <tr class="infoBoxContents">
	    <td>
		  <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
		    <tr>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <td class="main" style="width:50%;" valign="top">
			    <?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br>'; ?>
<div class="u2buttonsBox" style="float:left;">
<div class="u2buttons">
				    <?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?>
				  </div>
			    </div>
			  </td>
			  <td align="right" style="width:50%;" valign="top">
			    <table summary="" border="0" cellspacing="0" cellpadding="2">
				  <tr>
<!--remove default image
			    <td class="main" align="center" valign="top"><?php // echo '<strong>' . TITLE_SHIPPING_ADDRESS . '</strong><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
//-->
				    <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    <td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
				    <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
			    </table>
			  </td>
		    </tr>
		  </table>
	    </td>
	  </tr>
    </table>
  </td>
   </tr>
   <tr><!-- Replaced tep_draw_separator -->
  <td><div class="spacer_large"> </div></td>
   </tr>
<?php
 if (tep_count_shipping_modules() > 0) {
?>
   <tr>
  <td>
    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
	    <td class="main"><strong><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></strong></td>
	  </tr>
    </table>
  </td>
   </tr>
   <tr>
  <td>
<!-- bugfix replaced class="infoBox" with class="mid_column" -->
    <table summary="" border="0" width="100%" cellspacing="1" cellpadding="2" class="mid_column">
	  <tr class="infoBoxContents">
	    <td>
		  <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
   if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {
?>
		    <tr>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <td class="main" style="width:50%;" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>
<!-- Removed arrow_east_south.gif -->
			  <td class="main" style="width:50%;" valign="top" align="right"><?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong><br>' //. tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		    </tr>
<?php
   } elseif ($free_shipping == false) {
?>
		    <tr>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <td class="main" style="width:100%;" colspan="2"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></td>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		    </tr>
<?php
   }
   if ($free_shipping == true) {
?>
		    <tr>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <td colspan="2" style="width:100%;">
			    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<!--Bugfix
				    <td class="main" colspan="3"><strong><?php //echo FREE_SHIPPING_TITLE; ?></strong> <?php //echo $quotes[$i]['icon']; ?></td>
-->
				    <td class="main" colspan="3"><?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?><strong> <?php echo FREE_SHIPPING_TITLE; ?></strong></td>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
				  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    <td class="main" style="width:100%;"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
			    </table>
			  </td>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		    </tr>
<?php
   } else {
  $radio_buttons = 0;
  for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
?>
		    <tr>
			  <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <td colspan="2">
			    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    <td class="main" colspan="3"><?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?><strong> <?php echo $quotes[$i]['module']; ?></strong></td>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
<?php
    if (isset($quotes[$i]['error'])) {
?>
				  <tr>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    <td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
<?php
    } else {
	  for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
	    $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);
	    if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
		  echo '  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
	    } else {
		  echo '  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
	    }
?>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				    <td class="main" style="width:75%;"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
<?php
	    if ( ($n > 1) || ($n2 > 1) ) {
?>
				    <td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td>
				    <td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td>
<?php
	    } else {
?>
<!--
Bugfix Ref: https://github.com/osCommerce/oscommerce2/commit/2d2145f845a5bbe47cb0ef292d229a8f0ef1c5dc
			    <td class="main" align="right" colspan="2"><?php //echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>
//-->
				    <td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>
<?php
	    }
?>
				    <td style="width:10px;"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  <!-- </tr> replaced with the echo below, just to clarify code -->
<?php
		  echo '  </tr>';
	    $radio_buttons++;
	  }
    }
?>
				  </table>
			    </td>
			    <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
  }
   }
?>
		  </table>
	    </td>
	  </tr>
    </table>
  </td>
   </tr>
   <tr><!-- Replaced tep_draw_separator -->
  <td><div class="spacer_large"> </div></td>
   </tr>
<?php
 }
?>
<!--This Comments field is missplaced. The right one is in checkout_payment//-->
  <tr>
    <td><table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
	    <td class="main"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
	  </tr>
    </table></td>
  </tr>
  <tr>
    <td><table summary="" border="0" width="100%" cellspacing="1" cellpadding="2">
	  <tr class="infoBoxContents">
	    <td><table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
<!--//Bugfix invalid attribut 'soft' replaced wrap="' . tep_output_string($wrap) . '" with 'style="white-space:normal;"' in includes/funtions/html_output.php//-->
<!--//Continue removing comments field//-->
		   <td><?php echo tep_draw_textarea_field('message', 'normal', 60, 5); ?></td>
		  </tr>
	    </table></td>
	  </tr>
    </table></td>
  </tr>
<!--//end removed comments field   //-->
   <tr>
  <td>
    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="0" class="button_bar">
   <tr>
  <td><div class="spacer_medium"> </div></td>
   </tr>
	  <tr>
	    <td style="width:25%;">
		  <table summary="" border="0" width="100%" cellspacing="0" cellpadding="0">
		    <tr>
			  <td style="width:50%;" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'shopping-basket-arrow.png'); ?></td>
			  <td style="width:50%;"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		    </tr>
		  </table>
	    </td>
	    <td style="width:25%;"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
	    <td style="width:25%;"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
	    <td style="width:25%;">
		  <table summary="" border="0" width="100%" cellspacing="0" cellpadding="0">
		    <tr>
			  <td style="width:50%;"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
			  <td style="width:50%;"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
		    </tr>
		  </table>
	    </td>
	  </tr>
	  <tr>
	    <td align="center" style="width:25%;" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
	    <td align="center" style="width:25%;" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
	    <td align="center" style="width:25%;" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
	    <td align="center" style="width:25%;" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
	  </tr>
   <tr>
  <td colspan="4">
    <table summary="" border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
<!-- Bugfix
		    <td class="main"><?php // echo '<strong>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</strong><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>
//-->
	    <td align="center" style="width:25%;">
<div class="u2buttonsBox">
<div class="u2buttons">
		    <?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?>
		    </div>
		  </div>
	    </td>
	    <td align="center" style="width:75%;"> </td>
	  </tr>
    </table>
  </td>
   </tr>
    </table>
  </td>
   </tr>
 </table>
</form>
<!-- body_text_eof //-->
<?php
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

I simply do not know what breaks it all.

 

Please help me

Thanks for reading.

 

Sara

Link to comment
Share on other sites

@@Bob Terveuren

Hi Bob thanks for an informed answer! Yes, that was it. I looked at the order total module while naming the files.

 

I am sorry for my late answer, I had a cake in the owen and had to care of that little tasty. :)

 

Many thanks Bob,

Keep the good advices coming!

 

Sara

Link to comment
Share on other sites

  • 9 months later...

Hi,

 

I'm having similar problem.

 

I have 3 Table Rates enabled:

table 1 - US only shipping: $6 for under $100 orders and free over $100 orders

table 2 - Canada only shipping: $9 for under $100 orders and free over $100 orders

table 3 - International only shipping: $15 for under $100 orders and free over $100 orders

 

Customers in the US are able to checkout.

 

However, customers in Canada and International get to the checkout_shipping.php page and when they select "Continue" they are reloaded to the checkout_shipping.php page instead of proceeding to Checkout Confirmation.

 

Any ideas what I am doing wrong here?

 

Jon

Link to comment
Share on other sites

Hi,

 

I'm having similar problem.

 

I have 3 Table Rates enabled:

table 1 - US only shipping: $6 for under $100 orders and free over $100 orders

table 2 - Canada only shipping: $9 for under $100 orders and free over $100 orders

table 3 - International only shipping: $15 for under $100 orders and free over $100 orders

 

Customers in the US are able to checkout.

 

However, customers in Canada and International get to the checkout_shipping.php page and when they select "Continue" they are reloaded to the checkout_shipping.php page instead of proceeding to Checkout Confirmation.

 

Any ideas what I am doing wrong here?

 

Jon

 

Hoping someone can help me with this issue. I'm happy to pay someone, if needed.

 

Jon

Link to comment
Share on other sites

Hi Jon - does the page show a quote like 'Shipping to CA $9.99' or does it say 'No shipping available to selected country'?

 

If the latter then check that the zones are correctly setup in the shop and that there is no white space in the list of countries so

 

GB,FR,DE

not

GB, FR, DE

 

(Alternative is to edit the zones.php file to trim whitespace before looking at country as below)

 

function quote($method = '') {
 global $order, $shipping_weight, $shipping_num_boxes;
 $dest_country = $order->delivery['country']['iso_code_2'];
 $dest_zone = 0;
 $error = false;
 for ($i=1; $i<=$this->num_zones; $i++) {
 $countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
 $country_zones = preg_split("/[,]/", $countries_table);
$country_zones = array_map('trim',$country_zones);//<-------- new line of code here to trim space
 if (in_array($dest_country, $country_zones)) {
	 $dest_zone = $i;
	 break;
 }
 }

 

If a shipping quote is being shown then I'm flummoxed - can you give a url?

 

--edit-- I'm assuming that your using the standard zones.php?

Link to comment
Share on other sites

  • 5 months later...

Hello Bob (or anyone else)

 

any chance you can help me out with a similar problem,

 

I have been working on a modified state based shipping module to work with Australian postal zones... I am stuck in the shipping methods page as well...

 

Here is my code:

<?php
/*
  $Id: interstate_db.php
  Contributed by Anita L. Cross (aka skittles)
  (http://www.callofthewildphoto.com)

  Zone Shipping: By State Within A Country
  Developed For USA. Can be adapted to other countries.
  Based on Zones.php, distributed with osCommerce MS2.2 (051113)

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

  Released under the GNU General Public License
*/

  class interstate_db {
    var $code, $title, $description, $enabled, $num_zones;

// class constructor
    function interstate_db() {
      $this->code = 'interstate_db';
      $this->title = MODULE_SHIPPING_INTERSTATE_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_INTERSTATE_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_INTERSTATE_SORT_ORDER;
      $this->icon = '';
      $this->tax_class = MODULE_SHIPPING_INTERSTATE_TAX_CLASS;
      $this->enabled = ((MODULE_SHIPPING_INTERSTATE_STATUS == 'True') ? true : false);

      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_zones = 16;
    }
//MODULE_SHIPPING_
// class methods
    function quote($method = '') {
      global $order, $shipping_weight, $shipping_num_boxes;

      // if delivery is to other country, skip module in cart
      if ($order->delivery['country']['iso_code_2'] != 'AU') return;

      $dest_postcode = $order->delivery['postcode']; 
	  
	  $zone_query = tep_db_query("select * from " . TABLE_AUS_POSTCODES . " where postcode =  '" . $dest_postcode . "'");
	  $aquire_zone = tep_db_fetch_array($zone_query);
	  $aus_zone = $aquire_zone['zone'];
	  
      $dest_zone = 0;
      $error = false;

      for ($i=1; $i<=$this->num_zones; $i++) {
        $state_table = constant('MODULE_SHIPPING_INTERSTATE_STATES_' . $i);
        $state_zones = explode(',', $state_table);
        if (in_array($aus_zone, $state_zones)) {
          $dest_zone = $i;
          break;
        }
      }
      if ($dest_zone == 0) {
        $error = true;
      } else {
        $shipping = -1;
        $interstate_db_cost = constant('MODULE_SHIPPING_INTERSTATE_COST_' . $dest_zone);
        $interstate_db_table = preg_split('/[:,]/' , $interstate_db_cost);
		$interstate_db_table = array_map('trim',$interstate_db_table); // new code to trim white spaces off 
        $size = sizeof($interstate_db_table);
        for ($i=0; $i<$size; $i+=2) {
          if ($shipping_weight <= $interstate_db_table[$i]) {
            $shipping = $interstate_db_table[$i+1];
            $shipping_method = MODULE_SHIPPING_INTERSTATE_TEXT_WAY . ' ' 
                             . $dest_postcode . ' : ' 
							 . ' Zone '
							 . $aus_zone . ' : '
                             . $shipping_weight . ' ' 
                             . MODULE_SHIPPING_INTERSTATE_TEXT_UNITS;
            break;
          }
        }

        if ($shipping == -1) {
          $shipping_cost = 0;
          $shipping_method = MODULE_SHIPPING_INTERSTATE_UNDEFINED_RATE;
        } else {
          //edited by the thecodingmonkey


          if (strpos($shipping, "%") === false) {
	      $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
         } else {
         $shipcost = (str_replace("%","",$shipping) / 100);
         $shipping_cost = ($order_total * $shipcost) + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
          }



        //edited
        }
      }

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_INTERSTATE_TEXT_SECTION_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => $shipping_method,
                                                     'cost' => $shipping_cost)));

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

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

      if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_INTERSTATE_INVALID_ZONE;
	  if ($shipping == -1) $this->quotes['error'] = MODULE_SHIPPING_INTERSTATE_UNDEFINED_RATE;

/*  the above IF statement was added by C. Holmes chris@[member=airChris].com October 2007. 
It disables user selection of this zone shipping method if the rate is undefined. 
 */

      return $this->quotes;
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INTERSTATE_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }
      return $this->_check;
    }

    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 ( 'Enable Zones AUS Method', 'MODULE_SHIPPING_INTERSTATE_STATUS', 'True', 'Offer AUS specific zone rates by state?', '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_INTERSTATE_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 ( 'Sort Order', 'MODULE_SHIPPING_INTERSTATE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

      for ($i = 1; $i <= $this->num_zones; $i++) {
        $default_states = '';
        $default_rates = '';
        if ($i == 1) {
          $default_states = 'V1';
          $default_rates = '99:1.00';
        }
        if ($i == 2) {
          $default_states = 'V2';
          $default_rates = '99:2.00';
        }
        if ($i == 3) {
          $default_states = 'N1';
          $default_rates = '99:3.00';
        }
        if ($i == 4) {
          $default_states = 'N2';
          $default_rates = '99:4.00';
        }
        if ($i == 5) {
          $default_states = 'Q1';
          $default_rates = '99:5.00';
        }
        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Destination Zone', 'MODULE_SHIPPING_INTERSTATE_STATES_" . $i ."', '" . $default_states . "', 'Comma separated list of Australia Post Destination Zone as per their documentation " . $i . ".', '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 ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_INTERSTATE_COST_" . $i ."', '" . $default_rates . "', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '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 ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_INTERSTATE_HANDLING_" . $i."', '0.00', 'Handling Fee for this shipping zone', '6', '0', now())");
      }
    }

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

    function keys() {
      $keys = array('MODULE_SHIPPING_INTERSTATE_STATUS', 'MODULE_SHIPPING_INTERSTATE_TAX_CLASS', 'MODULE_SHIPPING_INTERSTATE_SORT_ORDER');
      for ($i=1; $i<=$this->num_zones; $i++) {
        $keys[] = 'MODULE_SHIPPING_INTERSTATE_STATES_' . $i;
        $keys[] = 'MODULE_SHIPPING_INTERSTATE_COST_' . $i;
        $keys[] = 'MODULE_SHIPPING_INTERSTATE_HANDLING_' . $i;
      }
      return $keys;
    }
  }
?>

Link to comment
Share on other sites

Ok, problem found....

 

It had nothing to do with my coding ... it was the filename....

 

it seems you cannot name a file with an underscore in the shipping modules... I had named it interstate_db.php - changed it to interstatedb.php and it worked !!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...