shop.balmet.com

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

ebay_listing.php (6620B)


      1 <?php
      2 class ControllerExtensionModuleEbayListing extends Controller {
      3 	private $error = array();
      4 
      5 	public function index() {
      6 		$this->load->language('extension/module/ebay_listing');
      7 
      8 		$this->document->setTitle($this->language->get('heading_title'));
      9 		$this->document->addScript('view/javascript/openbay/js/faq.js');
     10 
     11 		$this->load->model('setting/setting');
     12 
     13 		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
     14 			$this->model_setting_setting->editSetting('module_ebay_listing', $this->request->post);
     15 
     16 			$this->session->data['success'] = $this->language->get('text_success');
     17 
     18 			$this->cache->delete('ebay');
     19 
     20 			$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true));
     21 		}
     22 
     23 		if (isset($this->error['warning'])) {
     24 			$data['error_warning'] = $this->error['warning'];
     25 		} else {
     26 			$data['error_warning'] = '';
     27 		}
     28 
     29 		if (isset($this->error['width'])) {
     30 			$data['error_width'] = $this->error['width'];
     31 		} else {
     32 			$data['error_width'] = '';
     33 		}
     34 
     35 		if (isset($this->error['height'])) {
     36 			$data['error_height'] = $this->error['height'];
     37 		} else {
     38 			$data['error_height'] = '';
     39 		}
     40 
     41 		$data['breadcrumbs'] = array();
     42 
     43 		$data['breadcrumbs'][] = array(
     44 			'text' => $this->language->get('text_home'),
     45 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true),
     46 		);
     47 
     48 		$data['breadcrumbs'][] = array(
     49 			'text' => $this->language->get('text_extension'),
     50 			'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true),
     51 		);
     52 
     53 		$data['breadcrumbs'][] = array(
     54 			'text' => $this->language->get('heading_title'),
     55 			'href' => $this->url->link('extension/module/ebay_listing', 'user_token=' . $this->session->data['user_token'], true)
     56 		);
     57 
     58 		$data['action'] = $this->url->link('extension/module/ebay_listing', 'user_token=' . $this->session->data['user_token'], true);
     59 
     60 		$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=module', true);
     61 
     62 		if (isset($this->request->post['ebay_listing_username'])) {
     63 			$data['ebay_listing_username'] = $this->request->post['ebay_listing_username'];
     64 		} else {
     65 			$data['ebay_listing_username'] = $this->config->get('ebay_listing_username');
     66 		}
     67 
     68 		if (isset($this->request->post['ebay_listing_keywords'])) {
     69 			$data['ebay_listing_keywords'] = $this->request->post['ebay_listing_keywords'];
     70 		} else {
     71 			$data['ebay_listing_keywords'] = $this->config->get('ebay_listing_keywords');
     72 		}
     73 
     74 		if (isset($this->request->post['ebay_listing_description'])) {
     75 			$data['ebay_listing_description'] = $this->request->post['ebay_listing_description'];
     76 		} else {
     77 			$data['ebay_listing_description'] = $this->config->get('ebay_listing_description');
     78 		}
     79 
     80 		if (isset($this->request->post['ebay_listing_limit'])) {
     81 			$data['ebay_listing_limit'] = $this->request->post['ebay_listing_limit'];
     82 		} elseif ($this->config->has('ebay_listing_limit')) {
     83 			$data['ebay_listing_limit'] = $this->config->get('ebay_listing_limit');
     84 		} else {
     85 			$data['ebay_listing_limit'] = 5;
     86 		}
     87 
     88 		if (isset($this->request->post['ebay_listing_width'])) {
     89 			$data['ebay_listing_width'] = $this->request->post['width'];
     90 		} elseif ($this->config->has('ebay_listing_width')) {
     91 			$data['ebay_listing_width'] = $this->config->get('ebay_listing_width');
     92 		} else {
     93 			$data['ebay_listing_width'] = 200;
     94 		}
     95 
     96 		if (isset($this->request->post['ebay_listing_height'])) {
     97 			$data['ebay_listing_height'] = $this->request->post['ebay_listing_height'];
     98 		} elseif ($this->config->has('ebay_listing_height')) {
     99 			$data['ebay_listing_height'] = $this->config->get('ebay_listing_height');
    100 		} else {
    101 			$data['ebay_listing_height'] = 200;
    102 		}
    103 
    104 		if (isset($this->request->post['ebay_listing_sort'])) {
    105 			$data['ebay_listing_sort'] = $this->request->post['ebay_listing_sort'];
    106 		} elseif ($this->config->has('ebay_listing_sort')) {
    107 			$data['ebay_listing_sort'] = $this->config->get('ebay_listing_sort');
    108 		} else {
    109 			$data['ebay_listing_sort'] = 'StartTimeNewest';
    110 		}
    111 
    112 		if (isset($this->request->post['ebay_listing_site'])) {
    113 			$data['ebay_listing_site'] = $this->request->post['ebay_listing_site'];
    114 		} else {
    115 			$data['ebay_listing_site'] = $this->config->get('ebay_listing_site');
    116 		}
    117 
    118 		$data['sites'] = array();
    119 
    120 		$data['sites'][] = array(
    121 			'text'  => 'USA',
    122 			'value' => 0
    123 		);
    124 
    125 		$data['sites'][] = array(
    126 			'text'  => 'UK',
    127 			'value' => 3
    128 		);
    129 		$data['sites'][] = array(
    130 			'text'  => 'Australia',
    131 			'value' => 15
    132 		);
    133 
    134 		$data['sites'][] = array(
    135 			'text'  => 'Canada (English)',
    136 			'value' => 2
    137 		);
    138 
    139 		$data['sites'][] = array(
    140 			'text'  => 'France',
    141 			'value' => 71
    142 		);
    143 		$data['sites'][] = array(
    144 			'text'  => 'Germany',
    145 			'value' => 77
    146 		);
    147 		$data['sites'][] = array(
    148 			'text'  => 'Italy',
    149 			'value' => 101
    150 		);
    151 		$data['sites'][] = array(
    152 			'text'  => 'Spain',
    153 			'value' => 186
    154 		);
    155 		$data['sites'][] = array(
    156 			'text'  => 'Ireland',
    157 			'value' => 205
    158 		);
    159 
    160 		$data['sites'][] = array(
    161 			'text'  => 'Austria',
    162 			'value' => 16
    163 		);
    164 
    165 		$data['sites'][] = array(
    166 			'text'  => 'Netherlands',
    167 			'value' => 146
    168 		);
    169 
    170 		$data['sites'][] = array(
    171 			'text'  => 'Belgium (French)',
    172 			'value' => 23
    173 		);
    174 
    175 		$data['sites'][] = array(
    176 			'text'  => 'Belgium (Dutch)',
    177 			'value' => 123
    178 		);
    179 
    180 		if (isset($this->request->post['ebay_listing_status'])) {
    181 			$data['ebay_listing_status'] = $this->request->post['ebay_listing_status'];
    182 		} else {
    183 			$data['ebay_listing_status'] = $this->config->get('ebay_listing_status');
    184 		}
    185 
    186 		$data['header'] = $this->load->controller('common/header');
    187 		$data['column_left'] = $this->load->controller('common/column_left');
    188 		$data['footer'] = $this->load->controller('common/footer');
    189 
    190 		$this->response->setOutput($this->load->view('extension/module/ebay_listing', $data));
    191 	}
    192 
    193 	protected function validate() {
    194 		if (!$this->user->hasPermission('modify', 'extension/module/ebay_listing')) {
    195 			$this->error['warning'] = $this->language->get('error_permission');
    196 		}
    197 
    198 		if (!$this->request->post['ebay_listing_width']) {
    199 			$this->error['width'] = $this->language->get('error_width');
    200 		}
    201 
    202 		if (!$this->request->post['ebay_listing_height']) {
    203 			$this->error['height'] = $this->language->get('error_height');
    204 		}
    205 
    206 		return !$this->error;
    207 	}
    208 }