function process() { global $order, $currencies, $customer_shopping_points_spending; if (isset($_POST['customer_shopping_points_spending'])) { $_SESSION['customer_shopping_points_spending'] = $_POST['customer_shopping_points_spending']; } if ($_POST['customer_shopping_points_spending'] > 0 || $_SESSION['customer_shopping_points_spending'] > 0) { $customer_shopping_points_spending = calculate_required_points($order->info['total'], $_SESSION['customer_shopping_points_spending']); $order->info['total'] = number_format($order->info['total'] - tep_calc_shopping_pvalue($customer_shopping_points_spending), 4); $this->output[] = array('title' => MODULE_ORDER_TOTAL_REDEMPTIONS_TEXT . ': ', 'text' => $currencies->format(tep_calc_shopping_pvalue($customer_shopping_points_spending), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_calc_shopping_pvalue($customer_shopping_points_spending)); } }
function processCheckout() { global $customer_id, $comments, $coupon, $order, $currencies, $request_type, $languages_id, $currency, $customer_shopping_points_spending, $customer_referral, $cart_PayPal_Standard_ID, $cart_PayPal_IPN_ID, $cart_Worldpay_Junior_ID, $shipping, $cartID, $order_total_modules, $onepage, $credit_covers, $payment, $payment_modules; $this->checkCartValidity(); $comments = tep_db_prepare_input($_POST['comments']); if (!tep_session_is_registered('comments')) { tep_session_register('comments'); } $onepage['customer']['comments'] = $_POST['comments']; //BOF KGT if (MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true') { $onepage['info']['coupon'] = $order->info['coupon']; } //EOF KGT $lists = PHPLIST_LISTNUMBERS; $lists = explode(';', $lists); foreach ($lists as $key => $list) { if (isset($_POST['newsletters_' . $list])) { $onepage['customer']['newsletters'][] = $_POST['newsletters_' . $list]; } } $onepage['customer']['newsletter'] = isset($_POST['billing_newsletter']) ? $_POST['billing_newsletter'] : '0'; $order->customer = array_merge($order->customer, $onepage['customer']); if (tep_session_is_registered('customer_id')) { $onepage['createAccount'] = false; } else { if (tep_not_null($_POST['password'])) { $onepage['createAccount'] = true; $onepage['customer']['password'] = $_POST['password']; $this->createCustomerAccount(); } elseif (ONEPAGE_ACCOUNT_CREATE == 'create') { $onepage['createAccount'] = true; $onepage['customer']['password'] = tep_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $this->createCustomerAccount(); } } $payment_modules->update_status(); $paymentMethod = $onepage['info']['payment_method']; ##### Points/Rewards Module V2.1rc2a check for error BOF ####### if (USE_POINTS_SYSTEM == 'true' && USE_REDEEM_SYSTEM == 'true') { if (isset($_POST['customer_shopping_points_spending']) && is_numeric($_POST['customer_shopping_points_spending']) && $_POST['customer_shopping_points_spending'] > 0) { $customer_shopping_points_spending = false; if ($_POST['customer_shopping_points_spending'] > tep_get_shopping_points($customer_id)) { $_POST['customer_shopping_points_spending'] = tep_get_shopping_points($customer_id); } $customer_shopping_points = tep_get_shopping_points(); $max_points = calculate_max_points($customer_shopping_points); if ($points > $max_points) { $points = $max_points; } if (tep_calc_shopping_pvalue($_POST['customer_shopping_points_spending']) < $order->info['total'] && ($paymentMethod == '' || $paymentMethod == 'credit_covers')) { $customer_shopping_points_spending = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_NOT), 'SSL')); } else { $customer_shopping_points_spending = $_POST['customer_shopping_points_spending']; if (!tep_session_is_registered('customer_shopping_points_spending')) { tep_session_register('customer_shopping_points_spending'); } } } if (tep_not_null(USE_REFERRAL_SYSTEM)) { if (isset($_POST['customer_referred']) && tep_not_null($_POST['customer_referred'])) { $customer_referral = false; $check_mail = trim($_POST['customer_referred']); if (tep_validate_email($check_mail) == false) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REFERRAL_ERROR_NOT_VALID), 'SSL')); } else { $valid_referral_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $check_mail . "' limit 1"); $valid_referral = tep_db_fetch_array($valid_referral_query); if (!tep_db_num_rows($valid_referral_query)) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REFERRAL_ERROR_NOT_FOUND), 'SSL')); } if ($check_mail == $order->customer['email_address']) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REFERRAL_ERROR_SELF), 'SSL')); } else { $customer_referral = $valid_referral['customers_id']; if (!tep_session_is_registered('customer_referral')) { tep_session_register('customer_referral'); } } } } } } ##### Points/Rewards Module V2.1rc2a check for error EOF ####### if (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') { // Start - CREDIT CLASS Gift Voucher Contribution if ($credit_covers) { $paymentMethod = 'credit_covers'; } unset($_POST['gv_redeem_code']); unset($HTTP_POST_VARS['gv_redeem_code']); $order_total_modules->collect_posts(); $order_total_modules->pre_confirmation_check(); // End - CREDIT CLASS Gift Voucher Contribution } if ($order->info['total'] <= 0) { $payment = ''; $paymentMethod = ''; $onepage['info']['payment_method'] = ''; //$onepage['info']['order_id'] = ''; } $html = ''; $hiddenFields = ''; $infoMsg = 'Please press the continue button to confirm your order.'; $formUrl = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', $request_type); if ($paymentMethod != '' && $paymentMethod != 'credit_covers') { if (tep_not_null($GLOBALS[$paymentMethod]->form_action_url)) { $formUrl = $GLOBALS[$paymentMethod]->form_action_url; $infoMsg = 'Please press the continue button to proceed to the payment processors page.'; } $GLOBALS[$paymentMethod]->pre_confirmation_check(); $GLOBALS[$paymentMethod]->confirmation(); if (tep_session_is_registered('cart_PayPal_IPN_ID')) { $onepage['info']['order_id'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-') + 1); } if (tep_session_is_registered('cart_PayPal_Standard_ID')) { $onepage['info']['order_id'] = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-') + 1); } if (tep_session_is_registered('cart_Worldpay_Junior_ID')) { $onepage['info']['order_id'] = substr($cart_Worldpay_Junior_ID, strpos($cart_Worldpay_Junior_ID, '-') + 1); } $hiddenFields = $GLOBALS[$paymentMethod]->process_button(); if (!tep_not_null($hiddenFields)) { foreach ($_POST as $varName => $val) { if (is_array($_POST[$varName])) { foreach ($_POST[$varName] as $varName2 => $val2) { $hiddenFields .= tep_draw_hidden_field($varName2, $val2); } } else { $hiddenFields .= tep_draw_hidden_field($varName, $val); } } } } /* $html .= '<form name="redirectForm" action="' . $formUrl . '" method="POST"> <noscript>' . $infoMsg . tep_image_submit('button_continue.gif', IMAGE_CONTINUE) . '</noscript>' . tep_image_submit('button_continue.gif', IMAGE_CONTINUE, 'style="display:none;"') . $hiddenFields . '<script> document.write(\'<img src="' . DIR_WS_IMAGES . 'ajax-loader.gif"><br>Processing Order, Please Wait...\'); redirectForm.submit(); </script></form>'; */ $html .= '<form name="redirectForm" action="' . $formUrl . '" method="POST"> <noscript>' . $infoMsg . '<input type="submit" value="' . IMAGE_CONTINUE . '" class="button-a" /></noscript> <input type="submit" value="' . IMAGE_CONTINUE . '" class="button-a" style="display:none;" />' . $hiddenFields . '<script> document.write(\'<div style="width:100%;height:100%;margin-left:auto;margin-top:100px;color:#5d5d5d;font-family:Tahoma, Geneva, sans-serif;font-size:12px;text-align:center"><img src="' . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'ajax-loader.gif"><br>' . Translate('Bezig met de verwerking van uw bestelling. Even geduld...') . '</div>\'); setTimeout("redirectForm.submit()", 3000); </script></form>'; return $html; }