Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cannot checkout with CC Module


Bill Langlais

Recommended Posts

Posted

I have two payment modules CC & COD. They are set up so that COD is the only payment method if the total is 0 and CC if the total is > 0. This is done by adding the following to the payment module:

 

// Turn on this module if the order amount is $0.00

if ( ($this ->enabled == true) && ( $order->info['total' ] > 0) ) {

if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;

}

$this ->enabled = false;

}

 

Where the condition "( $order->info['total' ] > 0:" is == 0 for the other case.

 

This seems to work and on the payment page I get only one module with the message above saying this is the only module available. The problem is if I have a total and the CC module shows up, when I try to go to the next step after filling in CC info I get the following error:

 

"Please select a payment method for your order"

 

I cannot see a way to select a payment method.

 

If the amount is 0 and I get the COD module I can proceed to the next step fine.

 

Anyone know what I am doing wrong?

Posted
I have two payment modules CC & COD. They are set up so that COD is the only payment method if the total is 0 and CC if the total is > 0. This is done by adding the following to the payment module:

 

// Turn on this module if the order amount is $0.00

if ( ($this ->enabled == true) && ( $order->info['total' ] > 0) ) {

if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;

}

$this ->enabled = false;

}

 

Where the condition "( $order->info['total' ] > 0:" is == 0 for the other case.

 

This seems to work and on the payment page I get only one module with the message above saying this is the only module available. The problem is if I have a total and the CC module shows up, when I try to go to the next step after filling in CC info I get the following error:

 

"Please select a payment method for your order"

 

I cannot see a way to select a payment method.

 

If the amount is 0 and I get the COD module I can proceed to the next step fine.

 

Anyone know what I am doing wrong?

 

why bother with this loop to return false ? only go inside the loop if it's true :

	  // Turn on this module if the order amount is $0.00
  if ( ($this ->enabled == true) && ( $order->info['total' ] > 0) ) {
	 if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
	   $this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;
	 }
  }

Posted
I have two payment modules CC & COD. They are set up so that COD is the only payment method if the total is 0 and CC if the total is > 0. This is done by adding the following to the payment module:

 

// Turn on this module if the order amount is $0.00

if ( ($this ->enabled == true) && ( $order->info['total' ] > 0) ) {

if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;

}

$this ->enabled = false;

}

 

Where the condition "( $order->info['total' ] > 0:" is == 0 for the other case.

 

This seems to work and on the payment page I get only one module with the message above saying this is the only module available. The problem is if I have a total and the CC module shows up, when I try to go to the next step after filling in CC info I get the following error:

 

"Please select a payment method for your order"

 

I cannot see a way to select a payment method.

 

If the amount is 0 and I get the COD module I can proceed to the next step fine.

 

Anyone know what I am doing wrong?

 

 

I found the problem. The constructor for the cc module was being called during the payment confirmation and the $order object was not valid. The fix was to change the logic to:

 

if ((int)MODULE_PAYMENT_CC_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_CC_ORDER_STATUS_ID;

}

 

// Turn off this module if the order amount is $0.00

if ( (is_object($order)) && ( $order->info['total' ] == 0) ) {

$this->enabled = false;

}

 

To things of note. The first if needs to be outside the check since it was not being set when enabled was true, this was a bug but I did not see what problem it caused.

 

Also I removed the check for enabled in the second if since it was not really needed since if it was false setting to false was not a issue.

 

I hope this is usful to somone :) .

Archived

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

×
×
  • Create New...