function redirectToPayment(&$d) { require_once CLASSPATH . 'ps_checkout.php'; $checkout_steps = ps_checkout::get_checkout_steps(); $current_stage = 0; foreach ($checkout_steps as $step) { if (in_array('CHECK_OUT_GET_PAYMENT_METHOD', $checkout_steps[$current_stage])) { break; } else { $current_stage++; } } //Request used for when going from a regular link instead of a post from form $_REQUEST['checkout_stage'] = $current_stage; $_POST['checkout_this_step'] = $checkout_steps[$current_stage]; ps_paypal_api::destroyPaypalSession(); vmRedirect($sess->url('index.php?page=checkout.index&shipping_rate_id=' . urlencode($d['shipping_rate_id']) . '&ship_to_info_id=' . $d['ship_to_info_id'] . '&checkout_stage=' . $current_stage, false, false)); }
/** * Displays the "checkout bar" using the checkout bar template * * @param array $steps_to_do Array holding all steps the customer has to make * @param array $step_msg Array containing the step messages * @param int $step_count Number of steps to make * @param int $highlighted_step The index of the recent step */ function show_checkout_bar($highlighted_step = null) { global $sess, $ship_to_info_id, $shipping_rate_id, $VM_LANG; if (SHOW_CHECKOUT_BAR != '1' || defined('VM_CHECKOUT_BAR_LOADED')) { return; } // Let's assemble the steps $steps = ps_checkout::get_checkout_steps(); $step_count = sizeof($steps); $steps_tmp = $steps; $i = 0; foreach ($steps as $step) { foreach ($step as $step_name) { switch ($step_name) { case 'CHECK_OUT_GET_SHIPPING_ADDR': $step_msg = $VM_LANG->_('PHPSHOP_ADD_SHIPTO_2'); break; case 'CHECK_OUT_GET_SHIPPING_METHOD': $step_msg = $VM_LANG->_('PHPSHOP_ISSHIP_LIST_CARRIER_LBL'); break; case 'CHECK_OUT_GET_PAYMENT_METHOD': $step_msg = $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYMENT_LBL'); break; case 'CHECK_OUT_GET_FINAL_CONFIRMATION': $step_msg = $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_COMPORDER'); break; } $steps_to_do[$i][] = array('step_name' => $step_name, 'step_msg' => $step_msg, 'step_order' => key($steps_tmp)); } next($steps_tmp); $i++; } if (!$highlighted_step) { $highlighted_step = ps_checkout::get_current_stage(); } $theme = new $GLOBALS['VM_THEMECLASS'](); $theme->set_vars(array('step_count' => $step_count, 'steps_to_do' => $steps_to_do, 'steps' => $steps, 'highlighted_step' => $highlighted_step, 'ship_to_info_id' => vmGet($_REQUEST, 'ship_to_info_id'), 'shipping_rate_id' => vmGet($_REQUEST, 'shipping_rate_id'))); echo $theme->fetch('checkout/checkout_bar.tpl.php'); define('VM_CHECKOUT_BAR_LOADED', 1); }
* -CHECK_OUT_GET_SHIPPING_METHOD * let the user choose a shipto metho for the ship to address * -CHECK_OUT_GET_PAYMENT_METHOD * let the user choose a payment method * -CHECK_OUT_GET_FINAL_CONFIRMATION * shows a total summary including all payments, taxes, fees etc. and let the user confirm */ if ($auth['user_id'] > 0) { $show_basket = true; } else { $show_basket = false; } $current_stage = ps_checkout::get_current_stage(); $checkout_steps = ps_checkout::get_checkout_steps(); if (in_array('CHECK_OUT_GET_FINAL_CONFIRMATION', $checkout_steps[$current_stage])) { $next_page = 'checkout.thankyou'; if (sizeof($checkout_steps[$current_stage]) > 1) { include_once PAGEPATH . 'basket.php'; } else { include_once PAGEPATH . 'ro_basket.php'; } } else { $next_page = 'checkout.index'; include_once PAGEPATH . 'basket.php'; } // Get the zone quantity after it has been calculated in the basket $zone_qty = vmGet($_REQUEST, 'zone_qty'); $theme = new $GLOBALS['VM_THEMECLASS'](); $theme->set_vars(array('zone_qty' => $zone_qty, 'ship_to_info_id' => $ship_to_info_id, 'shipping_rate_id' => $shipping_rate_id, 'payment_method_id' => $payment_method_id, 'weight_total' => $weight_total, 'Itemid' => $Itemid));