You are here

function mailchimp_ecommerce_get_store in Mailchimp E-Commerce 7

Return information about the store from the supplied id.

Parameters

string $store_id: The ID of the store.

Return value

object Mailchimp store object.

2 calls to mailchimp_ecommerce_get_store()
MailchimpEcommerceTestCase::testAddStore in tests/mailchimp_ecommerce.test
Tests adding a store to Mailchimp.
mailchimp_ecommerce_admin_settings_submit in includes/mailchimp_ecommerce.admin.inc
Submit handler for the Mailchimp eCommerce form.

File

./mailchimp_ecommerce.module, line 196
Mailchimp eCommerce core functionality.

Code

function mailchimp_ecommerce_get_store($store_id) {
  $store = NULL;
  try {

    /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
    $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
    $store = $mc_ecommerce
      ->getStore($store_id);
  } catch (Exception $e) {
    if ($e
      ->getCode() == 404) {

      // Store doesn't exist; no need to log an error.
    }
    else {
      mailchimp_ecommerce_log_error_message('Unable to get store: ' . $e
        ->getMessage());
      mailchimp_ecommerce_show_error($e
        ->getMessage());
    }
  }
  return $store;
}