function commerce_checkout_form_back_submit in Commerce Core 7
Special submit handler for the back button to avoid processing orders.
1 string reference to 'commerce_checkout_form_back_submit'
- commerce_checkout_form in modules/
checkout/ includes/ commerce_checkout.pages.inc - Builds the checkout form for the given order on the specified checkout page.
File
- modules/
checkout/ includes/ commerce_checkout.pages.inc, line 414 - The page and form callbacks for use in the checkout form.
Code
function commerce_checkout_form_back_submit($form, &$form_state) {
// If there is a previous page...
if ($previous_page = commerce_checkout_page_load($form_state['checkout_page']['prev_page'])) {
$order = commerce_order_load($form_state['order']->order_id);
// Move the form back to that page.
if ($previous_page['prev_page']) {
$form_state['redirect'] = 'checkout/' . $order->order_id . '/' . $previous_page['page_id'];
}
else {
$form_state['redirect'] = 'checkout/' . $order->order_id;
}
// Update the order status for the checkout step.
$form_state['order'] = commerce_order_status_update($order, 'checkout_' . $previous_page['page_id'], FALSE, NULL, t('Customer returned to the previous checkout page via a submit button.'));
}
}