Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

missing some code on checkout_shipping?


mousewebdesign

Recommended Posts

Hi,

 

Does anyone know how to change this:

 

on checkout_shipping.php you have the abilitiy to choose a shipping method. If there's no shipping method selected, although the customer has to, there's no message displayed on the screen.

 

the page is just reloading and nothing else happens. I've tried the original checkout_shipping page as it comes through MS2.2, but still nothing happens.

 

Am I missing some code or is this just a bug?

 

marcus

Link to comment
Share on other sites

I think you are not missing anything. If no method is chosen, the page is reloading.

 

There is a line that chose the cheapest shipping method

if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

 

If you disable this, then nothing is chosen and if the customer doesn't choose, the page reload.

 

I suspect that this is happening somewhere in the different if/else's just before the html part with unregistering the shipping session if if if this and that (like nothing selected)

tep_session_unregister('shipping');

 

Would be good to put a message to the customer somewhere

Link to comment
Share on other sites

I think you are not missing anything. If no method is chosen, the page is reloading.

 

There is a line that chose the cheapest shipping method

if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

 

If you disable this, then nothing is chosen and if the customer doesn't choose, the page reload.

 

I suspect that this is happening somewhere in the different if/else's just before the html part with unregistering the shipping session if if if this and that (like nothing selected)

tep_session_unregister('shipping');

 

Would be good to put a message to the customer somewhere

 

Hi,

 

that's right. I've commented out the code to select the cheapest as default because half of all customers have this shipping method as it is, so we always have to sent an email to the customer that his/her package is more expensive due to higher shipping costs. So I left this out so the customer HAS to choose

 

you're saying that I can use the code tep_session_unregister('shipping'); to solve this problem? Or maybe something else to avoid this?

 

Kind regards,

 

Marcus

Link to comment
Share on other sites

This is the complete code in checkout_shipping.php (the relevant - as I suspect - part)

 

// process the selected shipping method
 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
  $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {
  if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {
	$shipping = $HTTP_POST_VARS['shipping'];

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

 

It says in all this if/else finally, that if a shipping method is chosen to proceed to checkout payment. All other options are to unregister.

 

Somewhere here you need to make the adjustements, maybe to make a message to display

Link to comment
Share on other sites

This is the complete code in checkout_shipping.php (the relevant - as I suspect - part)

 

// process the selected shipping method
 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
  $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {
  if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {
	$shipping = $HTTP_POST_VARS['shipping'];

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

 

It says in all this if/else finally, that if a shipping method is chosen to proceed to checkout payment. All other options are to unregister.

 

Somewhere here you need to make the adjustements, maybe to make a message to display

 

Ok, thanx.

 

I'll get in to it. You've helped me great so far !

 

kind regards,

 

marcus

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...