function processPayment() { $errors = \GC::checkOrder(); if (count($errors) > 0) { echo json_encode(['errors' => $errors]); return false; } else { $payment = ['order_id' => \GC::getAttribute('id'), 'amount' => \GC::getGrandTotal(), 'status' => 'processed', 'payment_module' => 'Cod', 'description' => lang('charge_on_delivery')]; \CI::Orders()->savePaymentInfo($payment); $orderId = \GC::submitOrder(); //send the order ID echo json_encode(['orderId' => $orderId]); return false; } }
public function submitOrder() { $errors = \GC::checkOrder(); if (\GC::getGrandTotal() > 0) { $errors['payment'] = lang('error_choose_payment'); } if (count($errors) > 0) { echo json_encode(['errors' => $errors]); return false; } else { $payment = ['order_id' => \GC::getAttribute('id'), 'amount' => \GC::getGrandTotal(), 'status' => 'processed', 'payment_module' => '', 'description' => lang('no_payment_needed')]; \CI::Orders()->savePaymentInfo($payment); $orderId = \GC::submitOrder(); //send the order ID echo json_encode(['orderId' => $orderId]); return false; } }
//reprocess $.each(checks, function(key, val) { $('#cartItem-'+key).addClass('errorAlert').prepend('<div class="summaryStockAlert">'+val+'</div>'); }); } setInventoryErrors(inventoryCheck); updateItemCount(<?php echo GC::totalItems(); ?> ); var closeBtn = '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'; var newGrandTotalTest = <?php echo GC::getGrandTotal() > 0 ? 1 : 0; ?> ; if(newGrandTotalTest != grandTotalTest) { getPaymentMethods(); grandTotalTest = newGrandTotalTest; //reset grand total test. } $('.quantityInput').bind('blur keyup', function(e){ if(e.type === 'blur' || e.which === 13) { updateItem($(this).attr('data-product-id'), $(this).val(), $(this).attr('data-orig-val')); } }).bind('focus', function(e){ lastInput = $(this);
<h3><?php echo lang('payment_methods'); ?> </h3> </div> <?php if (count($modules) == 0) { ?> <div class="alert alert-danger" role="alert"> <?php echo lang('error_no_payment_method'); ?> </div> <?php } elseif (GC::getGrandTotal() == 0) { ?> <div class="alert alert-danger" role="alert"> <?php echo lang('no_payment_needed'); ?> </div> <button class="btn btn-main" onclick="SubmitNoPaymentOrder()"><?php echo lang('submit_order'); ?> </button> <script> function SubmitNoPaymentOrder() {