function commerce_checkout_order_uri in Commerce Core 7
Returns the current checkout URI for the given order.
Parameters
$order: The fully loaded order object.
Return value
A string containing the URI to the order's current checkout page or NULL if the order is in a state that does not have a valid checkout URL.
2 calls to commerce_checkout_order_uri()
- commerce_checkout_router in modules/
checkout/ includes/ commerce_checkout.pages.inc - Redirects invalid checkout attempts or displays the checkout form if valid.
- commerce_payment_redirect_pane_checkout_form in modules/
payment/ includes/ commerce_payment.checkout_pane.inc - Payment redirect pane: form callback.
File
- modules/
checkout/ commerce_checkout.module, line 914 - Enable checkout as a multi-step form with customizable pages and a simple checkout pane API.
Code
function commerce_checkout_order_uri($order) {
$order_status = commerce_order_status_load($order->status);
if ($order_status === FALSE) {
return NULL;
}
if ($order_status['state'] == 'checkout') {
$page_id = '/' . $order_status['checkout_page'];
}
elseif ($order_status['state'] == 'cart') {
$page_id = '';
}
elseif (commerce_checkout_complete_access($order)) {
$page_id = '/complete';
}
else {
return NULL;
}
return 'checkout/' . $order->order_id . $page_id;
}