function mailchimp_ecommerce_get_order in Mailchimp E-Commerce 7
Gets an order from the current Mailchimp store.
Parameters
string $order_id: The order ID.
Return value
object|null The order.
3 calls to mailchimp_ecommerce_get_order()
- mailchimp_ecommerce_commerce_batch_add_orders in modules/
mailchimp_ecommerce_commerce/ mailchimp_ecommerce_commerce.module - Batch callback used to add orders to MailChimp.
- mailchimp_ecommerce_ubercart_batch_add_orders in modules/
mailchimp_ecommerce_ubercart/ mailchimp_ecommerce_ubercart.module - Batch callback used to add orders to Mailchimp.
- mailchimp_ecommerce_ubercart_uc_order in modules/
mailchimp_ecommerce_ubercart/ mailchimp_ecommerce_ubercart.module - Implements hook_uc_order().
File
- ./
mailchimp_ecommerce.module, line 691 - Mailchimp eCommerce core functionality.
Code
function mailchimp_ecommerce_get_order($order_id) {
try {
$store_id = mailchimp_ecommerce_get_store_id();
if (empty($store_id)) {
throw new Exception('Cannot get an order without a store ID.');
}
/* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
$mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
$order = $mc_ecommerce
->getOrder($store_id, $order_id);
return $order;
} catch (Exception $e) {
if ($e
->getCode() == 404) {
// Order doesn't exist in the store; no need to log an error.
}
else {
mailchimp_ecommerce_log_error_message('Unable to get order: ' . $e
->getMessage());
mailchimp_ecommerce_show_error($e
->getMessage());
}
}
return NULL;
}