Any error or blank screen. Payment is still displayed in the list.
use below code in checkout_select_default_payment_method hook to fix this or this in checkout.php controller after line " fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);"
$available_payment_ids = array();
foreach ($payment_methods as $group) {
foreach ($group as $method) {
$available_payment_ids[] = $method['payment_id'];
}
}
// Change default payment if it doesn't exists
if (!in_array($cart['payment_id'], $available_payment_ids)) {
$cart['payment_id'] = reset($available_payment_ids);
$cart['payment_method_data'] = fn_get_payment_method_data($cart['payment_id']);
}
I have inserted debug code and system print only subtotal (any other value)
use below code in checkout_select_default_payment_method hook to fix this or this in checkout.php controller after line " fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);"
$available_payment_ids = array();
foreach ($payment_methods as $group) {
foreach ($group as $method) {
$available_payment_ids[] = $method['payment_id'];
}
}
// Change default payment if it doesn't exists
if (!in_array($cart['payment_id'], $available_payment_ids)) {
$cart['payment_id'] = reset($available_payment_ids);
$cart['payment_method_data'] = fn_get_payment_method_data($cart['payment_id']);
}
i have created hook (init.php and func.php) with code attached above and insert my code into checkout.php. The result is still the same (COD in always show).
use below code in checkout_select_default_payment_method hook to fix this or this in checkout.php controller after line " fn_set_hook('checkout_select_default_payment_method', $cart, $payment_methods, $completed_steps);"
$available_payment_ids = array(); foreach($payment_methods as $group){ foreach($group as $method){ $available_payment_ids[]= $method['payment_id']; } }
// Change default payment if it doesn't exists if(!in_array($cart['payment_id'], $available_payment_ids)){ $cart['payment_id']= reset($available_payment_ids); $cart['payment_method_data']= fn_get_payment_method_data($cart['payment_id']); }
i have created hook (init.php and func.php) with code attached above and insert my code into checkout.php. The result is still the same (COD in always show).