Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Checkout_shipping does not jump to payment page


electric

Recommended Posts

Posted

Hello

 

I made a modification to a shipping module in order to fix the overweight problem. After that I tried it and it correctly worked with different orders of different weight, but when pressing continue button it reloads same checkout_shipping.php page instead of jumping to payment!

 

I installed and uninstalled other shipping modules, and even this modified module, all of them jump to checkout payment page except this one.

 

Next is modified quote function from shipping mdule:

 

	
function quote($method = '') {
 global $order, $cart, $shipping_weight, $shipping_num_boxes;
 $order_total = $shipping_weight;
 if ($shipping_weight > MODULE_SHIPPING_CORREOS_NACIONAL_MAX_WEIGHT) { 
 $this->quotes = array(
		'id' 	=> $this->code,
		'module' 	=> MODULE_SHIPPING_CORREOS_NACIONAL_TEXT_TITLE,
		'methods'	=> array(array('title' => $this->quotes['error'])));
 $this->quotes['error'] = $shipping_weight . ' ' . 
		MODULE_SHIPPING_CORREOS_NACIONAL_TEXT_UNITS . ' ' . 
		MODULE_SHIPPING_CORREOS_NACIONAL_EXCEEDED_WEIGHT . ' ' . 
		MODULE_SHIPPING_CORREOS_NACIONAL_MAX_WEIGHT . ' ' . 
		MODULE_SHIPPING_CORREOS_NACIONAL_TEXT_UNITS;
 return $this->quotes;
 }
 $table_cost = split("[:,]" , MODULE_SHIPPING_CORREOS_NACIONAL_COST);
 $size = sizeof($table_cost);
 for ($i=0, $n=$size; $i<$n; $i+=2) {
 if ($order_total <= $table_cost[$i]) {
	 $shipping1 = $table_cost[$i+1];
	 break;
 }
 }
 $shipping['Normal'] = $shipping1 * $shipping_num_boxes;

 $this->quotes = array(
  	'id'		 => $this->code,
			'module' => MODULE_SHIPPING_CORREOS_NACIONAL_TEXT_TITLE . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' paquetes de ' : ' paquete de ') . $shipping_weight . ' grs.)');
 if ($method) {
  $this->quotes['methods'][] = array(
'id'	=> $method,
'title' => $this->types[$method],
'cost' => $shipping[$method] + MODULE_SHIPPING_CORREOS_NACIONAL_HANDLING);
  } else {
	 foreach($this->types as $type=>$txtType) {
$this->quotes['methods'][] = array(
	'id'	 => $type,
	'title'  => $txtType,
	'cost' => $shipping[$type] + MODULE_SHIPPING_CORREOS_NACIONAL_HANDLING);
	  }
  }
  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);
  }
  return $this->quotes;
}

 

Any suggestion is wellcome. I can not go on without this problem solved. Many thanks!!

Posted

I found the error.

 

The problem was not the code itself...

I called this modified shipping module with a filename like xxx_yyy.php.

The problem is that in checkout_shipping.php there is a code like

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

list($module, $method) = explode('_', $shipping);

 

some conditions

...

} else {

tep_session_unregister('shipping');

}

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

so the underscore is forbidden in this context for filenames. This was forcing to maintain

same shipping page instead to jump to payment.

 

I did not know this limitation.

Hope this is useful to somebody.

Archived

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

×
×
  • Create New...