$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_percent'] = $this->language->get('text_percent');
$this->data['text_amount'] = $this->language->get('text_amount');
$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_rate'] = $this->language->get('entry_rate');
$this->data['entry_type'] = $this->language->get('entry_type');
$this->data['entry_customer_group'] = $this->language->get('entry_customer_group');
$this->data['entry_geo_zone'] = $this->language->get('entry_geo_zone');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->error['name'])) {
$this->data['error_name'] = $this->error['name'];
} else {
$this->data['error_name'] = '';
}
if (isset($this->error['rate'])) {
$this->data['error_rate'] = $this->error['rate'];
} else {
$this->data['error_rate'] = '';
}
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('localisation/tax_rate', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['tax_rate_id'])) {
$this->data['action'] = $this->url->link('localisation/tax_rate/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('localisation/tax_rate/update', 'token=' . $this->session->data['token'] . '&tax_rate_id=' . $this->request->get['tax_rate_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('localisation/tax_rate', 'token=' . $this->session->data['token'] . $url, 'SSL');
if (isset($this->request->get['tax_rate_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$tax_rate_info = $this->model_localisation_tax_rate->getTaxRate($this->request->get['tax_rate_id']);
}
if (isset($this->request->post['name'])) {
$this->data['name'] = $this->request->post['name'];
} elseif (!empty($tax_rate_info)) {
$this->data['name'] = $tax_rate_info['name'];
} else {
$this->data['name'] = '';
}
if (isset($this->request->post['rate'])) {
$this->data['rate'] = $this->request->post['rate'];
} elseif (!empty($tax_rate_info)) {
$this->data['rate'] = $tax_rate_info['rate'];
} else {
$this->data['rate'] = '';
}
if (isset($this->request->post['type'])) {
$this->data['type'] = $this->request->post['type'];
} elseif (!empty($tax_rate_info)) {
$this->data['type'] = $tax_rate_info['type'];
} else {
$this->data['type'] = '';
}
if (isset($this->request->post['tax_rate_customer_group'])) {
$this->data['tax_rate_customer_group'] = $this->request->post['tax_rate_customer_group'];
} elseif (isset($this->request->get['tax_rate_id'])) {
$this->data['tax_rate_customer_group'] = $this->model_localisation_tax_rate->getTaxRateCustomerGroups($this->request->get['tax_rate_id']);
} else {
$this->data['tax_rate_customer_group'] = array();
}
$this->load->model('sale/customer_group');
$this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups();
if (isset($this->request->post['geo_zone_id'])) {
$this->data['geo_zone_id'] = $this->request->post['geo_zone_id'];
} elseif (!empty($tax_rate_info)) {
$this->data['geo_zone_id'] = $tax_rate_info['geo_zone_id'];
} else {
$this->data['geo_zone_id'] = '';
}
$this->load->model('localisation/geo_zone');
$this->data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
$this->template = 'localisation/tax_rate_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());