Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ControllerAccountNewsletter extends Controller {
- public function index() {
- if (!$this->customer->isLogged()) {
- $this->session->data['redirect'] = $this->url->link('account/newsletter', '', 'SSL');
- $this->redirect($this->url->link('account/login', '', 'SSL'));
- }
- $this->language->load('account/newsletter');
- $this->document->setTitle($this->language->get('heading_title'));
- if ($this->request->server['REQUEST_METHOD'] == 'POST') {
- $this->load->model('account/customer');
- $this->model_account_customer->editNewsletter($this->request->post['newsletter']);
- $this->session->data['success'] = $this->language->get('text_success');
- $this->redirect($this->url->link('account/newsletter', '', 'SSL'));
- }
- if (isset($this->session->data['success'])) {
- $this->data['success'] = $this->session->data['success'];
- unset($this->session->data['success']);
- } else {
- $this->data['success'] = '';
- }
- $this->data['heading_title'] = $this->language->get('heading_title');
- $this->data['text_subheading'] = $this->language->get('text_subheading');
- $this->data['entry_newsletter'] = sprintf($this->language->get('entry_newsletter'), $this->config->get('config_name'));
- $this->data['button_update'] = $this->language->get('button_update');
- $this->data['action'] = $this->url->link('account/newsletter', '', 'SSL');
- $this->data['newsletter'] = $this->customer->getNewsletter();
- $this->data['back'] = $this->url->link('account/account', '', 'SSL');
- if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/newsletter.tpl')) {
- $this->template = $this->config->get('config_template') . '/template/account/newsletter.tpl';
- } else {
- $this->template = 'default/template/account/newsletter.tpl';
- }
- $this->children = array(
- 'common/column_left',
- 'common/column_right',
- 'common/content_top',
- 'common/content_bottom',
- 'common/footer',
- 'common/header'
- );
- $this->response->setOutput($this->render());
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement