shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

account.php (4372B)


      1 <?php
      2 class ControllerAccountAccount extends Controller {
      3 	public function index() {
      4 		if (!$this->customer->isLogged()) {
      5 			$this->session->data['redirect'] = $this->url->link('account/account', '', true);
      6 
      7 			$this->response->redirect($this->url->link('account/login', '', true));
      8 		}
      9 
     10 		$this->load->language('account/account');
     11 
     12 		$this->document->setTitle($this->language->get('heading_title'));
     13 
     14 		$data['breadcrumbs'] = array();
     15 
     16 		$data['breadcrumbs'][] = array(
     17 			'text' => $this->language->get('text_home'),
     18 			'href' => $this->url->link('common/home')
     19 		);
     20 
     21 		$data['breadcrumbs'][] = array(
     22 			'text' => $this->language->get('text_account'),
     23 			'href' => $this->url->link('account/account', '', true)
     24 		);
     25 
     26 		if (isset($this->session->data['success'])) {
     27 			$data['success'] = $this->session->data['success'];
     28 
     29 			unset($this->session->data['success']);
     30 		} else {
     31 			$data['success'] = '';
     32 		} 
     33 		
     34 		$data['edit'] = $this->url->link('account/edit', '', true);
     35 		$data['password'] = $this->url->link('account/password', '', true);
     36 		$data['address'] = $this->url->link('account/address', '', true);
     37 		
     38 		$data['credit_cards'] = array();
     39 		
     40 		$files = glob(DIR_APPLICATION . 'controller/extension/credit_card/*.php');
     41 		
     42 		foreach ($files as $file) {
     43 			$code = basename($file, '.php');
     44 			
     45 			if ($this->config->get('payment_' . $code . '_status') && $this->config->get('payment_' . $code . '_card')) {
     46 				$this->load->language('extension/credit_card/' . $code, 'extension');
     47 
     48 				$data['credit_cards'][] = array(
     49 					'name' => $this->language->get('extension')->get('heading_title'),
     50 					'href' => $this->url->link('extension/credit_card/' . $code, '', true)
     51 				);
     52 			}
     53 		}
     54 		
     55 		$data['wishlist'] = $this->url->link('account/wishlist');
     56 		$data['order'] = $this->url->link('account/order', '', true);
     57 		$data['download'] = $this->url->link('account/download', '', true);
     58 		
     59 		if ($this->config->get('total_reward_status')) {
     60 			$data['reward'] = $this->url->link('account/reward', '', true);
     61 		} else {
     62 			$data['reward'] = '';
     63 		}		
     64 		
     65 		$data['return'] = $this->url->link('account/return', '', true);
     66 		$data['transaction'] = $this->url->link('account/transaction', '', true);
     67 		$data['newsletter'] = $this->url->link('account/newsletter', '', true);
     68 		$data['recurring'] = $this->url->link('account/recurring', '', true);
     69 		
     70 		$this->load->model('account/customer');
     71 		
     72 		$affiliate_info = $this->model_account_customer->getAffiliate($this->customer->getId());
     73 		
     74 		if (!$affiliate_info) {	
     75 			$data['affiliate'] = $this->url->link('account/affiliate/add', '', true);
     76 		} else {
     77 			$data['affiliate'] = $this->url->link('account/affiliate/edit', '', true);
     78 		}
     79 		
     80 		if ($affiliate_info) {		
     81 			$data['tracking'] = $this->url->link('account/tracking', '', true);
     82 		} else {
     83 			$data['tracking'] = '';
     84 		}
     85 		
     86 		$data['column_left'] = $this->load->controller('common/column_left');
     87 		$data['column_right'] = $this->load->controller('common/column_right');
     88 		$data['content_top'] = $this->load->controller('common/content_top');
     89 		$data['content_bottom'] = $this->load->controller('common/content_bottom');
     90 		$data['footer'] = $this->load->controller('common/footer');
     91 		$data['header'] = $this->load->controller('common/header');
     92 		
     93 		$this->response->setOutput($this->load->view('account/account', $data));
     94 	}
     95 
     96 	public function country() {
     97 		$json = array();
     98 
     99 		$this->load->model('localisation/country');
    100 
    101 		$country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
    102 
    103 		if ($country_info) {
    104 			$this->load->model('localisation/zone');
    105 
    106 			$json = array(
    107 				'country_id'        => $country_info['country_id'],
    108 				'name'              => $country_info['name'],
    109 				'iso_code_2'        => $country_info['iso_code_2'],
    110 				'iso_code_3'        => $country_info['iso_code_3'],
    111 				'address_format'    => $country_info['address_format'],
    112 				'postcode_required' => $country_info['postcode_required'],
    113 				'zone'              => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
    114 				'status'            => $country_info['status']
    115 			);
    116 		}
    117 
    118 		$this->response->addHeader('Content-Type: application/json');
    119 		$this->response->setOutput(json_encode($json));
    120 	}
    121 }