$this->data = array_merge($this->data, $this->load->language('openbay/ebay_settings'));
$this->load->model('setting/setting');
$this->load->model('openbay/ebay');
$this->load->model('localisation/currency');
$this->load->model('localisation/order_status');
$this->load->model('sale/customer_group');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) {
$this->model_setting_setting->editSetting('openbay', $this->request->post);
$this->session->data['success'] = $this->language->get('lang_text_success');
$this->redirect($this->url->link('openbay/openbay&token=' . $this->session->data['token']));
}
$this->document->setTitle($this->language->get('lang_heading_title'));
$this->document->addStyle('view/stylesheet/openbay.css');
$this->document->addScript('view/javascript/openbay/faq.js');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('text_home'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('extension/openbay', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('lang_openbay'),
'separator' => ' :: '
);
$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('openbay/openbay', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('lang_ebay'),
'separator' => ' :: '
);
$this->data['breadcrumbs'][] = array(
'href' => $this->url->link('openbay/openbay/settings', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('lang_settings'),
'separator' => ' :: '
);
$this->data['action'] = $this->url->link('openbay/openbay/settings', 'token=' . $this->session->data['token'], 'SSL');
$this->data['cancel'] = $this->url->link('openbay/openbay', 'token=' . $this->session->data['token'], 'SSL');
/*
* Currency Import
*/
if (isset($this->request->post['openbay_def_currency'])) {
$this->data['openbay_def_currency'] = $this->request->post['openbay_def_currency'];
} else {
$this->data['openbay_def_currency'] = $this->config->get('openbay_def_currency');
}
$this->data['currency_list'] = $this->model_localisation_currency->getCurrencies();
/*
* Customer Import
*/
if (isset($this->request->post['openbay_def_customer_grp'])) {
$this->data['openbay_def_customer_grp'] = $this->request->post['openbay_def_customer_grp'];
} else {
$this->data['openbay_def_customer_grp'] = $this->config->get('openbay_def_customer_grp');
}
$this->data['customer_grp_list'] = $this->model_sale_customer_group->getCustomerGroups();
$this->data['token'] = $this->session->data['token'];
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->request->post['openbay_status'])) {
$this->data['openbay_status'] = $this->request->post['openbay_status'];
} else {
$this->data['openbay_status'] = $this->config->get('openbay_status');
}
if (isset($this->request->post['openbaypro_token'])) {
$this->data['openbaypro_token'] = $this->request->post['openbaypro_token'];
} else {
$this->data['openbaypro_token'] = $this->config->get('openbaypro_token');
}
if (isset($this->request->post['openbaypro_secret'])) {
$this->data['openbaypro_secret'] = $this->request->post['openbaypro_secret'];
} else {
$this->data['openbaypro_secret'] = $this->config->get('openbaypro_secret');
}
if (isset($this->request->post['openbaypro_string1'])) {
$this->data['openbaypro_string1'] = $this->request->post['openbaypro_string1'];
} else {
$this->data['openbaypro_string1'] = $this->config->get('openbaypro_string1');
}
if (isset($this->request->post['openbaypro_string2'])) {
$this->data['openbaypro_string2'] = $this->request->post['openbaypro_string2'];
} else {
$this->data['openbaypro_string2'] = $this->config->get('openbaypro_string2');
}
if (isset($this->request->post['openbaypro_enditems'])) {
$this->data['openbaypro_enditems'] = $this->request->post['openbaypro_enditems'];
} else {
$this->data['openbaypro_enditems'] = $this->config->get('openbaypro_enditems');
}
if (isset($this->request->post['openbaypro_relistitems'])) {
$this->data['openbaypro_relistitems'] = $this->request->post['openbaypro_relistitems'];
} else {
$this->data['openbaypro_relistitems'] = $this->config->get('openbaypro_relistitems');
}
if (isset($this->request->post['ebay_disable_nostock'])) {
$this->data['ebay_disable_nostock'] = $this->request->post['ebay_disable_nostock'];
} else {
$this->data['ebay_disable_nostock'] = $this->config->get('ebay_disable_nostock');
}
if (isset($this->request->post['openbaypro_logging'])) {
$this->data['openbaypro_logging'] = $this->request->post['openbaypro_logging'];
} else {
$this->data['openbaypro_logging'] = $this->config->get('openbaypro_logging');
}
if (isset($this->request->post['openbaypro_created_hours'])) {
$this->data['openbaypro_created_hours'] = $this->request->post['openbaypro_created_hours'];
} else {
$this->data['openbaypro_created_hours'] = $this->config->get('openbaypro_created_hours');
}
if (isset($this->request->post['openbaypro_time_offset'])) {
$this->data['openbaypro_time_offset'] = $this->request->post['openbaypro_time_offset'];
} else {
$this->data['openbaypro_time_offset'] = $this->config->get('openbaypro_time_offset');
}
/**
* notification settings
*/
if (isset($this->request->post['openbaypro_update_notify'])) {
$this->data['openbaypro_update_notify'] = $this->request->post['openbaypro_update_notify'];
} else {
$this->data['openbaypro_update_notify'] = $this->config->get('openbaypro_update_notify');
}
if (isset($this->request->post['openbaypro_confirm_notify'])) {
$this->data['openbaypro_confirm_notify'] = $this->request->post['openbaypro_confirm_notify'];
} else {
$this->data['openbaypro_confirm_notify'] = $this->config->get('openbaypro_confirm_notify');
}
if (isset($this->request->post['openbaypro_confirmadmin_notify'])) {
$this->data['openbaypro_confirmadmin_notify'] = $this->request->post['openbaypro_confirmadmin_notify'];
} else {
$this->data['openbaypro_confirmadmin_notify'] = $this->config->get('openbaypro_confirmadmin_notify');
}
if (isset($this->request->post['openbaypro_email_brand_disable'])) {
$this->data['openbaypro_email_brand_disable'] = $this->request->post['openbaypro_email_brand_disable'];
} else {
$this->data['openbaypro_email_brand_disable'] = $this->config->get('openbaypro_email_brand_disable');
}
if (isset($this->request->post['openbaypro_ebay_itm_link'])) {
$this->data['openbaypro_ebay_itm_link'] = $this->request->post['openbaypro_ebay_itm_link'];
} else {
$this->data['openbaypro_ebay_itm_link'] = $this->config->get('openbaypro_ebay_itm_link');
}
/**
* stock allocation
*/
if (isset($this->request->post['openbaypro_stock_allocate'])) {
$this->data['openbaypro_stock_allocate'] = $this->request->post['openbaypro_stock_allocate'];
} else {
$this->data['openbaypro_stock_allocate'] = $this->config->get('openbaypro_stock_allocate');
}
if (isset($this->request->post['openbaypro_create_date'])) {
$this->data['openbaypro_create_date'] = $this->request->post['openbaypro_create_date'];
} else {
$this->data['openbaypro_create_date'] = $this->config->get('openbaypro_create_date');
}
$this->data['durations'] = array(
'Days_1' => $this->data['lang_listing_1day'],
'Days_3' => $this->data['lang_listing_3day'],
'Days_5' => $this->data['lang_listing_5day'],
'Days_7' => $this->data['lang_listing_7day'],
'Days_10' => $this->data['lang_listing_10day'],
'Days_30' => $this->data['lang_listing_30day'],
'GTC' => $this->data['lang_listing_gtc']
);
if (isset($this->request->post['openbaypro_duration'])) {
$this->data['openbaypro_duration'] = $this->request->post['openbaypro_duration'];
} else {
$this->data['openbaypro_duration'] = $this->config->get('openbaypro_duration');
}
if (isset($this->request->post['openbay_default_addressformat'])) {
$this->data['openbay_default_addressformat'] = $this->request->post['openbay_default_addressformat'];
} else {
$this->data['openbay_default_addressformat'] = $this->config->get('openbay_default_addressformat');
}
/*
* Payments & tax
*/
$this->data['payment_options'] = $this->model_openbay_ebay->getPaymentTypes();
if (isset($this->request->post['ebay_payment_types'])) {
$this->data['ebay_payment_types'] = $this->request->post['ebay_payment_types'];
} else {
$this->data['ebay_payment_types'] = $this->config->get('ebay_payment_types');
}
if (isset($this->request->post['field_payment_instruction'])) {
$this->data['field_payment_instruction'] = $this->request->post['field_payment_instruction'];
} else {
$this->data['field_payment_instruction'] = $this->config->get('field_payment_instruction');
}
if (isset($this->request->post['field_payment_paypal_address'])) {
$this->data['field_payment_paypal_address'] = $this->request->post['field_payment_paypal_address'];
} else {
$this->data['field_payment_paypal_address'] = $this->config->get('field_payment_paypal_address');
}
if (isset($this->request->post['payment_immediate'])) {
$this->data['payment_immediate'] = $this->request->post['payment_immediate'];
} else {
$this->data['payment_immediate'] = $this->config->get('payment_immediate');
}
if (isset($this->request->post['ebay_tax_listing'])) {
$this->data['ebay_tax_listing'] = $this->request->post['ebay_tax_listing'];
} else {
$this->data['ebay_tax_listing'] = $this->config->get('ebay_tax_listing');
}
if (isset($this->request->post['tax'])) {
$this->data['tax'] = $this->request->post['tax'];
} else {
$this->data['tax'] = $this->config->get('tax');
}
if (isset($this->request->post['ebay_import_unpaid'])) {
$this->data['ebay_import_unpaid'] = $this->request->post['ebay_import_unpaid'];
} else {
$this->data['ebay_import_unpaid'] = $this->config->get('ebay_import_unpaid');
}
if (isset($this->request->post['EBAY_DEF_PARTIAL_REFUND_ID'])) {
$this->data['EBAY_DEF_PARTIAL_REFUND_ID'] = $this->request->post['EBAY_DEF_PARTIAL_REFUND_ID'];
} else {
$this->data['EBAY_DEF_PARTIAL_REFUND_ID'] = $this->config->get('EBAY_DEF_PARTIAL_REFUND_ID');
}
if (isset($this->request->post['EBAY_DEF_IMPORT_ID'])) {
$this->data['EBAY_DEF_IMPORT_ID'] = $this->request->post['EBAY_DEF_IMPORT_ID'];
} else {
$this->data['EBAY_DEF_IMPORT_ID'] = $this->config->get('EBAY_DEF_IMPORT_ID');
}
if (isset($this->request->post['EBAY_DEF_PAID_ID'])) {
$this->data['EBAY_DEF_PAID_ID'] = $this->request->post['EBAY_DEF_PAID_ID'];
} else {
$this->data['EBAY_DEF_PAID_ID'] = $this->config->get('EBAY_DEF_PAID_ID');
}
if (isset($this->request->post['EBAY_DEF_SHIPPED_ID'])) {
$this->data['EBAY_DEF_SHIPPED_ID'] = $this->request->post['EBAY_DEF_SHIPPED_ID'];
} else {
$this->data['EBAY_DEF_SHIPPED_ID'] = $this->config->get('EBAY_DEF_SHIPPED_ID');
}
if (isset($this->request->post['EBAY_DEF_CANCELLED_ID'])) {
$this->data['EBAY_DEF_CANCELLED_ID'] = $this->request->post['EBAY_DEF_CANCELLED_ID'];
} else {
$this->data['EBAY_DEF_CANCELLED_ID'] = $this->config->get('EBAY_DEF_CANCELLED_ID');
}
if (isset($this->request->post['EBAY_DEF_REFUNDED_ID'])) {
$this->data['EBAY_DEF_REFUNDED_ID'] = $this->request->post['EBAY_DEF_REFUNDED_ID'];
} else {
$this->data['EBAY_DEF_REFUNDED_ID'] = $this->config->get('EBAY_DEF_REFUNDED_ID');
}
$this->data['api_server'] = $this->openbay->ebay->getApiServer();
$this->data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
$this->template = 'openbay/ebay_settings.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render(true), $this->config->get('config_compression'));