$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_none'] = $this->language->get('text_none');
$this->data['text_select'] = $this->language->get('text_select');
$this->data['entry_product'] = $this->language->get('entry_product');
$this->data['entry_author'] = $this->language->get('entry_author');
$this->data['entry_rating'] = $this->language->get('entry_rating');
$this->data['entry_status'] = $this->language->get('entry_status');
$this->data['entry_text'] = $this->language->get('entry_text');
$this->data['entry_good'] = $this->language->get('entry_good');
$this->data['entry_bad'] = $this->language->get('entry_bad');
$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['product'])) {
$this->data['error_product'] = $this->error['product'];
} else {
$this->data['error_product'] = '';
}
if (isset($this->error['author'])) {
$this->data['error_author'] = $this->error['author'];
} else {
$this->data['error_author'] = '';
}
if (isset($this->error['text'])) {
$this->data['error_text'] = $this->error['text'];
} else {
$this->data['error_text'] = '';
}
if (isset($this->error['rating'])) {
$this->data['error_rating'] = $this->error['rating'];
} else {
$this->data['error_rating'] = '';
}
$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('catalog/review', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['review_id'])) {
$this->data['action'] = $this->url->link('catalog/review/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('catalog/review/update', 'token=' . $this->session->data['token'] . '&review_id=' . $this->request->get['review_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('catalog/review', 'token=' . $this->session->data['token'] . $url, 'SSL');
if (isset($this->request->get['review_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$review_info = $this->model_catalog_review->getReview($this->request->get['review_id']);
}
$this->data['token'] = $this->session->data['token'];
$this->load->model('catalog/product');
if (isset($this->request->post['product_id'])) {
$this->data['product_id'] = $this->request->post['product_id'];
} elseif (!empty($review_info)) {
$this->data['product_id'] = $review_info['product_id'];
} else {
$this->data['product_id'] = '';
}
if (isset($this->request->post['product'])) {
$this->data['product'] = $this->request->post['product'];
} elseif (!empty($review_info)) {
$this->data['product'] = $review_info['product'];
} else {
$this->data['product'] = '';
}
if (isset($this->request->post['author'])) {
$this->data['author'] = $this->request->post['author'];
} elseif (!empty($review_info)) {
$this->data['author'] = $review_info['author'];
} else {
$this->data['author'] = '';
}
if (isset($this->request->post['text'])) {
$this->data['text'] = $this->request->post['text'];
} elseif (!empty($review_info)) {
$this->data['text'] = $review_info['text'];
} else {
$this->data['text'] = '';
}
if (isset($this->request->post['rating'])) {
$this->data['rating'] = $this->request->post['rating'];
} elseif (!empty($review_info)) {
$this->data['rating'] = $review_info['rating'];
} else {
$this->data['rating'] = '';
}
if (isset($this->request->post['status'])) {
$this->data['status'] = $this->request->post['status'];
} elseif (!empty($review_info)) {
$this->data['status'] = $review_info['status'];
} else {
$this->data['status'] = '';
}
$this->template = 'catalog/review_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());