diff --git a/includes/mailchimp_ecommerce.admin.inc b/includes/mailchimp_ecommerce.admin.inc index 6b15e20..761ae7d 100644 --- a/includes/mailchimp_ecommerce.admin.inc +++ b/includes/mailchimp_ecommerce.admin.inc @@ -19,6 +19,13 @@ function mailchimp_ecommerce_admin_settings() { '#default_value' => variable_get('mailchimp_ecommerce_store_name', ''), '#description' => t('The name of your store as it should appear in your MailChimp account.'), ]; + $form['mailchimp_ecommerce_store_domain'] = [ + '#type' => 'textfield', + '#title' => t('Store Domain'), + '#required' => TRUE, + '#default_value' => variable_get('mailchimp_ecommerce_store_domain', ''), + '#description' => t('The domain of your store as it should appear in your MailChimp account. Use absolute URL without protocol or trailing slash.'), + ]; $mailchimp_lists = mailchimp_get_lists(); $list_options = [ @@ -100,6 +107,7 @@ function mailchimp_ecommerce_admin_settings_submit($form, &$form_state) { 'list_id' => isset($form_state['values']['mailchimp_ecommerce_list_id']) ? $form_state['values']['mailchimp_ecommerce_list_id'] : variable_get('mailchimp_ecommerce_list_id'), 'name' => $form_state['values']['mailchimp_ecommerce_store_name'], 'currency_code' => $currency, + 'domain' => $form_state['values']['mailchimp_ecommerce_store_domain'], ]; mailchimp_ecommerce_add_store($store_id, $store); @@ -107,7 +115,8 @@ function mailchimp_ecommerce_admin_settings_submit($form, &$form_state) { else { mailchimp_ecommerce_update_store($store_id, $form_state['values']['mailchimp_ecommerce_store_name'], - $currency); + $currency, + array('domain' => $form_state['values']['mailchimp_ecommerce_store_domain'])); } } diff --git a/mailchimp_ecommerce.install b/mailchimp_ecommerce.install index 6c4fceb..662502a 100644 --- a/mailchimp_ecommerce.install +++ b/mailchimp_ecommerce.install @@ -13,6 +13,7 @@ function mailchimp_ecommerce_uninstall() { variable_del('mailchimp_ecommerce_currency'); variable_del('mailchimp_ecommerce_list_id'); variable_del('mailchimp_ecommerce_store_name'); + variable_del('mailchimp_ecommerce_store_domain'); } /** diff --git a/mailchimp_ecommerce.module b/mailchimp_ecommerce.module index 7fdf004..c24a1e1 100644 --- a/mailchimp_ecommerce.module +++ b/mailchimp_ecommerce.module @@ -113,11 +113,11 @@ function mailchimp_ecommerce_add_store($store_id, $store) { * @param string $currency_code * The three-letter ISO 4217 code. */ -function mailchimp_ecommerce_update_store($store_id, $name, $currency_code) { +function mailchimp_ecommerce_update_store($store_id, $name, $currency_code, $parameters = array()) { try { /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */ $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce'); - $mc_ecommerce->updateStore($store_id, $name, $currency_code); + $mc_ecommerce->updateStore($store_id, $name, $currency_code, $parameters); } catch (Exception $e) { mailchimp_ecommerce_log_error_message('Unable to update a store: ' . $e->getMessage()); --