$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_enabled'] = $this->language->get('text_enabled');
$this->data['text_disabled'] = $this->language->get('text_disabled');
$this->data['text_select'] = $this->language->get('text_select');
$this->data['text_none'] = $this->language->get('text_none');
$this->data['text_wait'] = $this->language->get('text_wait');
$this->data['text_cheque'] = $this->language->get('text_cheque');
$this->data['text_paypal'] = $this->language->get('text_paypal');
$this->data['text_bank'] = $this->language->get('text_bank');
$this->data['entry_firstname'] = $this->language->get('entry_firstname');
$this->data['entry_lastname'] = $this->language->get('entry_lastname');
$this->data['entry_email'] = $this->language->get('entry_email');
$this->data['entry_telephone'] = $this->language->get('entry_telephone');
$this->data['entry_fax'] = $this->language->get('entry_fax');
$this->data['entry_company'] = $this->language->get('entry_company');
$this->data['entry_address_1'] = $this->language->get('entry_address_1');
$this->data['entry_address_2'] = $this->language->get('entry_address_2');
$this->data['entry_city'] = $this->language->get('entry_city');
$this->data['entry_postcode'] = $this->language->get('entry_postcode');
$this->data['entry_country'] = $this->language->get('entry_country');
$this->data['entry_zone'] = $this->language->get('entry_zone');
$this->data['entry_code'] = $this->language->get('entry_code');
$this->data['entry_commission'] = $this->language->get('entry_commission');
$this->data['entry_tax'] = $this->language->get('entry_tax');
$this->data['entry_payment'] = $this->language->get('entry_payment');
$this->data['entry_cheque'] = $this->language->get('entry_cheque');
$this->data['entry_paypal'] = $this->language->get('entry_paypal');
$this->data['entry_bank_name'] = $this->language->get('entry_bank_name');
$this->data['entry_bank_branch_number'] = $this->language->get('entry_bank_branch_number');
$this->data['entry_bank_swift_code'] = $this->language->get('entry_bank_swift_code');
$this->data['entry_bank_account_name'] = $this->language->get('entry_bank_account_name');
$this->data['entry_bank_account_number'] = $this->language->get('entry_bank_account_number');
$this->data['entry_password'] = $this->language->get('entry_password');
$this->data['entry_confirm'] = $this->language->get('entry_confirm');
$this->data['entry_status'] = $this->language->get('entry_status');
$this->data['entry_amount'] = $this->language->get('entry_amount');
$this->data['entry_description'] = $this->language->get('entry_description');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
$this->data['button_add_transaction'] = $this->language->get('button_add_transaction');
$this->data['button_remove'] = $this->language->get('button_remove');
$this->data['tab_general'] = $this->language->get('tab_general');
$this->data['tab_payment'] = $this->language->get('tab_payment');
$this->data['tab_transaction'] = $this->language->get('tab_transaction');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->error['firstname'])) {
$this->data['error_firstname'] = $this->error['firstname'];
} else {
$this->data['error_firstname'] = '';
}
if (isset($this->error['lastname'])) {
$this->data['error_lastname'] = $this->error['lastname'];
} else {
$this->data['error_lastname'] = '';
}
if (isset($this->error['email'])) {
$this->data['error_email'] = $this->error['email'];
} else {
$this->data['error_email'] = '';
}
if (isset($this->error['telephone'])) {
$this->data['error_telephone'] = $this->error['telephone'];
} else {
$this->data['error_telephone'] = '';
}
if (isset($this->error['password'])) {
$this->data['error_password'] = $this->error['password'];
} else {
$this->data['error_password'] = '';
}
if (isset($this->error['confirm'])) {
$this->data['error_confirm'] = $this->error['confirm'];
} else {
$this->data['error_confirm'] = '';
}
if (isset($this->error['address_1'])) {
$this->data['error_address_1'] = $this->error['address_1'];
} else {
$this->data['error_address_1'] = '';
}
if (isset($this->error['city'])) {
$this->data['error_city'] = $this->error['city'];
} else {
$this->data['error_city'] = '';
}
if (isset($this->error['postcode'])) {
$this->data['error_postcode'] = $this->error['postcode'];
} else {
$this->data['error_postcode'] = '';
}
if (isset($this->error['country'])) {
$this->data['error_country'] = $this->error['country'];
} else {
$this->data['error_country'] = '';
}
if (isset($this->error['zone'])) {
$this->data['error_zone'] = $this->error['zone'];
} else {
$this->data['error_zone'] = '';
}
if (isset($this->error['code'])) {
$this->data['error_code'] = $this->error['code'];
} else {
$this->data['error_code'] = '';
}
$url = '';
if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . urlencode(html_entity_decode($this->request->get['filter_name'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_email'])) {
$url .= '&filter_email=' . urlencode(html_entity_decode($this->request->get['filter_email'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_status'])) {
$url .= '&filter_status=' . $this->request->get['filter_status'];
}
if (isset($this->request->get['filter_approved'])) {
$url .= '&filter_approved=' . $this->request->get['filter_approved'];
}
if (isset($this->request->get['filter_date_added'])) {
$url .= '&filter_date_added=' . $this->request->get['filter_date_added'];
}
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('sale/affiliate', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['affiliate_id'])) {
$this->data['action'] = $this->url->link('sale/affiliate/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('sale/affiliate/update', 'token=' . $this->session->data['token'] . '&affiliate_id=' . $this->request->get['affiliate_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('sale/affiliate', 'token=' . $this->session->data['token'] . $url, 'SSL');
if (isset($this->request->get['affiliate_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$affiliate_info = $this->model_sale_affiliate->getAffiliate($this->request->get['affiliate_id']);
}
$this->data['token'] = $this->session->data['token'];
if (isset($this->request->get['affiliate_id'])) {
$this->data['affiliate_id'] = $this->request->get['affiliate_id'];
} else {
$this->data['affiliate_id'] = 0;
}
if (isset($this->request->post['firstname'])) {
$this->data['firstname'] = $this->request->post['firstname'];
} elseif (!empty($affiliate_info)) {
$this->data['firstname'] = $affiliate_info['firstname'];
} else {
$this->data['firstname'] = '';
}
if (isset($this->request->post['lastname'])) {
$this->data['lastname'] = $this->request->post['lastname'];
} elseif (!empty($affiliate_info)) {
$this->data['lastname'] = $affiliate_info['lastname'];
} else {
$this->data['lastname'] = '';
}
if (isset($this->request->post['email'])) {
$this->data['email'] = $this->request->post['email'];
} elseif (!empty($affiliate_info)) {
$this->data['email'] = $affiliate_info['email'];
} else {
$this->data['email'] = '';
}
if (isset($this->request->post['telephone'])) {
$this->data['telephone'] = $this->request->post['telephone'];
} elseif (!empty($affiliate_info)) {
$this->data['telephone'] = $affiliate_info['telephone'];
} else {
$this->data['telephone'] = '';
}
if (isset($this->request->post['fax'])) {
$this->data['fax'] = $this->request->post['fax'];
} elseif (!empty($affiliate_info)) {
$this->data['fax'] = $affiliate_info['fax'];
} else {
$this->data['fax'] = '';
}
if (isset($this->request->post['company'])) {
$this->data['company'] = $this->request->post['company'];
} elseif (!empty($affiliate_info)) {
$this->data['company'] = $affiliate_info['company'];
} else {
$this->data['company'] = '';
}
if (isset($this->request->post['address_1'])) {
$this->data['address_1'] = $this->request->post['address_1'];
} elseif (!empty($affiliate_info)) {
$this->data['address_1'] = $affiliate_info['address_1'];
} else {
$this->data['address_1'] = '';
}
if (isset($this->request->post['address_2'])) {
$this->data['address_2'] = $this->request->post['address_2'];
} elseif (!empty($affiliate_info)) {
$this->data['address_2'] = $affiliate_info['address_2'];
} else {
$this->data['address_2'] = '';
}
if (isset($this->request->post['city'])) {
$this->data['city'] = $this->request->post['city'];
} elseif (!empty($affiliate_info)) {
$this->data['city'] = $affiliate_info['city'];
} else {
$this->data['city'] = '';
}
if (isset($this->request->post['postcode'])) {
$this->data['postcode'] = $this->request->post['postcode'];
} elseif (!empty($affiliate_info)) {
$this->data['postcode'] = $affiliate_info['postcode'];
} else {
$this->data['postcode'] = '';
}
if (isset($this->request->post['country_id'])) {
$this->data['country_id'] = $this->request->post['country_id'];
} elseif (!empty($affiliate_info)) {
$this->data['country_id'] = $affiliate_info['country_id'];
} else {
$this->data['country_id'] = '';
}
$this->load->model('localisation/country');
$this->data['countries'] = $this->model_localisation_country->getCountries();
if (isset($this->request->post['zone_id'])) {
$this->data['zone_id'] = $this->request->post['zone_id'];
} elseif (!empty($affiliate_info)) {
$this->data['zone_id'] = $affiliate_info['zone_id'];
} else {
$this->data['zone_id'] = '';
}
if (isset($this->request->post['code'])) {
$this->data['code'] = $this->request->post['code'];
} elseif (!empty($affiliate_info)) {
$this->data['code'] = $affiliate_info['code'];
} else {
$this->data['code'] = uniqid();
}
if (isset($this->request->post['commission'])) {
$this->data['commission'] = $this->request->post['commission'];
} elseif (!empty($affiliate_info)) {
$this->data['commission'] = $affiliate_info['commission'];
} else {
$this->data['commission'] = $this->config->get('config_commission');
}
if (isset($this->request->post['tax'])) {
$this->data['tax'] = $this->request->post['tax'];
} elseif (!empty($affiliate_info)) {
$this->data['tax'] = $affiliate_info['tax'];
} else {
$this->data['tax'] = '';
}
if (isset($this->request->post['payment'])) {
$this->data['payment'] = $this->request->post['payment'];
} elseif (!empty($affiliate_info)) {
$this->data['payment'] = $affiliate_info['payment'];
} else {
$this->data['payment'] = 'cheque';
}
if (isset($this->request->post['cheque'])) {
$this->data['cheque'] = $this->request->post['cheque'];
} elseif (!empty($affiliate_info)) {
$this->data['cheque'] = $affiliate_info['cheque'];
} else {
$this->data['cheque'] = '';
}
if (isset($this->request->post['paypal'])) {
$this->data['paypal'] = $this->request->post['paypal'];
} elseif (!empty($affiliate_info)) {
$this->data['paypal'] = $affiliate_info['paypal'];
} else {
$this->data['paypal'] = '';
}
if (isset($this->request->post['bank_name'])) {
$this->data['bank_name'] = $this->request->post['bank_name'];
} elseif (!empty($affiliate_info)) {
$this->data['bank_name'] = $affiliate_info['bank_name'];
} else {
$this->data['bank_name'] = '';
}
if (isset($this->request->post['bank_branch_number'])) {
$this->data['bank_branch_number'] = $this->request->post['bank_branch_number'];
} elseif (!empty($affiliate_info)) {
$this->data['bank_branch_number'] = $affiliate_info['bank_branch_number'];
} else {
$this->data['bank_branch_number'] = '';
}
if (isset($this->request->post['bank_swift_code'])) {
$this->data['bank_swift_code'] = $this->request->post['bank_swift_code'];
} elseif (!empty($affiliate_info)) {
$this->data['bank_swift_code'] = $affiliate_info['bank_swift_code'];
} else {
$this->data['bank_swift_code'] = '';
}
if (isset($this->request->post['bank_account_name'])) {
$this->data['bank_account_name'] = $this->request->post['bank_account_name'];
} elseif (!empty($affiliate_info)) {
$this->data['bank_account_name'] = $affiliate_info['bank_account_name'];
} else {
$this->data['bank_account_name'] = '';
}
if (isset($this->request->post['bank_account_number'])) {
$this->data['bank_account_number'] = $this->request->post['bank_account_number'];
} elseif (!empty($affiliate_info)) {
$this->data['bank_account_number'] = $affiliate_info['bank_account_number'];
} else {
$this->data['bank_account_number'] = '';
}
if (isset($this->request->post['status'])) {
$this->data['status'] = $this->request->post['status'];
} elseif (!empty($affiliate_info)) {
$this->data['status'] = $affiliate_info['status'];
} else {
$this->data['status'] = 1;
}
if (isset($this->request->post['password'])) {
$this->data['password'] = $this->request->post['password'];
} else {
$this->data['password'] = '';
}
if (isset($this->request->post['confirm'])) {
$this->data['confirm'] = $this->request->post['confirm'];
} else {
$this->data['confirm'] = '';
}
$this->template = 'sale/affiliate_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());