I know this thread was closed previously (http://www.zen-cart.com/showthread.p...ro-total-order), but I need to reopen.

I have tried both Dr. Byte's suggestion and Wilt's suggestion and I still get an error when customer uses gift certificate, coupons, store credit, reward points and any combination that results in a $0.00 amount.

I use PayPal to process payments and I need checkout to bypass going to PayPal when the order total is zero. PayPal gives this error:

"An error occurred when we tried to contact the payment processor. Please try again, select an alternate payment method, or contact the store owner for assistance. (10401) 10401 Transaction refused because of an invalid argument. See additional error messages for details. - Order total is invalid."

I have the proper logic in includes/classes/order_total.php but it doesn't seem to bypass the payment method. Is there any other way to bypass the payment method??? Or maybe this code needs to be altered?

// pre_confirmation_check is called on checkout confirmation. It's function is to decide whether the
// credits available are greater than the order total. If they are then a variable (credit_covers) is set to
// true. This is used to bypass the payment method. In other words if the Gift Voucher is more than the order
// total, we don't want to go to paypal etc.
//
function pre_confirmation_check($returnOrderTotalOnly = FALSE) {
global $order, $credit_covers;
if (MODULE_ORDER_TOTAL_INSTALLED) {
$total_deductions = 0;
reset($this->modules);
$orderInfoSaved = $order->info;
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ( $GLOBALS[$class]->credit_class ) {
$order_total = $GLOBALS[$class]->get_order_total();
if (is_array($order_total)) $order_total = $order_total['total'];
$deduction = $GLOBALS[$class]->pre_confirmation_check($order_total);
$total_deductions = $total_deductions + $deduction;
// echo 'class = ' . $class . "<br>";
// echo 'order-total = ' . $order_total . "<br>";
// echo 'deduction = ' . $deduction . "<br>";
}
else
{
$GLOBALS[$class]->process();
$GLOBALS[$class]->output = array();
}
}
$calculatedOrderTotal = $order->info['total'];
$order->info = $orderInfoSaved;
// echo "orderTotal = {$order->info['total']}";
// echo "TotalDeductions = {$total_deductions}";
// do not set when Free Charger is being used
$difference = $order->info['total'] - $total_deductions;
if ( $difference <= 0.009 && $_SESSION['payment'] != 'freecharger') {
$credit_covers = true;
}
if ($returnOrderTotalOnly == TRUE) return $calculatedOrderTotal;
}
}