private function submit_shipping_method() { global $wpsc_cart; if (!$this->verify_nonce('wpsc-checkout-form-shipping-method')) { return; } $form_args = wpsc_get_checkout_shipping_form_args(); $validation = wpsc_validate_form($form_args); if (is_wp_error($validation)) { wpsc_set_validation_errors($validation); return; } $submitted_value = $_POST['wpsc_shipping_option']; $found = false; foreach ($this->shipping_calculator->quotes as $module_name => $quotes) { foreach ($quotes as $option => $cost) { $id = $this->shipping_calculator->ids[$module_name][$option]; if ($id == $submitted_value) { $found = true; $wpsc_cart->update_shipping($module_name, $option); break 2; } } } if (!$found) { return; } $this->wizard->completed_step('shipping-method'); /* @todo: I _think_ this will be fine, as $module_name should still be defined at this execution path from the loop, but we need to confirm. */ $this->shipping_calculator->set_active_method($module_name, $option); wp_redirect(wpsc_get_checkout_url($this->wizard->pending_step)); exit; }
private function submit_shipping_method() { global $wpsc_cart; if (!$this->verify_nonce('wpsc-checkout-form-shipping-method')) { return; } $form_args = wpsc_get_checkout_shipping_form_args(); $validation = wpsc_validate_form($form_args); if (is_wp_error($validation)) { wpsc_set_validation_errors($validation); return; } $submitted_value = $_POST['wpsc_shipping_option']; $found = false; $module_name = ''; $option = ''; foreach ($this->shipping_calculator->quotes as $module_name => $quotes) { foreach ($quotes as $option => $cost) { $id = $this->shipping_calculator->ids[$module_name][$option]; if ($id == $submitted_value) { $found = true; $wpsc_cart->update_shipping($module_name, $option); break 2; } } } if (!$found) { return; } $this->wizard->completed_step('shipping-method'); $this->shipping_calculator->set_active_method($module_name, $option); $url = add_query_arg($_GET, wpsc_get_checkout_url($this->wizard->pending_step)); wp_redirect($url); exit; }
function wpsc_get_checkout_shipping_form() { if (!class_exists('WPSC_Shipping_Calculator')) { return ''; } $args = wpsc_get_checkout_shipping_form_args(); return apply_filters('wpsc_get_checkout_shipping_form', wpsc_get_form_output($args)); }