shop.balmet.com

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

pp_standard.php (1461B)


      1 <?php
      2 class ModelExtensionPaymentPPStandard extends Model {
      3 	public function getMethod($address, $total) {
      4 		$this->load->language('extension/payment/pp_standard');
      5 
      6 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_pp_standard_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
      7 
      8 		if ($this->config->get('payment_pp_standard_total') > $total) {
      9 			$status = false;
     10 		} elseif (!$this->config->get('payment_pp_standard_geo_zone_id')) {
     11 			$status = true;
     12 		} elseif ($query->num_rows) {
     13 			$status = true;
     14 		} else {
     15 			$status = false;
     16 		}
     17 
     18 		$currencies = array(
     19 			'AUD',
     20 			'CAD',
     21 			'EUR',
     22 			'GBP',
     23 			'JPY',
     24 			'USD',
     25 			'NZD',
     26 			'CHF',
     27 			'HKD',
     28 			'SGD',
     29 			'SEK',
     30 			'DKK',
     31 			'PLN',
     32 			'NOK',
     33 			'HUF',
     34 			'CZK',
     35 			'ILS',
     36 			'MXN',
     37 			'MYR',
     38 			'BRL',
     39 			'PHP',
     40 			'TWD',
     41 			'THB',
     42 			'TRY',
     43 			'RUB'
     44 		);
     45 
     46 		if (!in_array(strtoupper($this->session->data['currency']), $currencies)) {
     47 			$status = false;
     48 		}
     49 
     50 		$method_data = array();
     51 
     52 		if ($status) {
     53 			$method_data = array(
     54 				'code'       => 'pp_standard',
     55 				'title'      => $this->language->get('text_title'),
     56 				'terms'      => '',
     57 				'sort_order' => $this->config->get('payment_pp_standard_sort_order')
     58 			);
     59 		}
     60 
     61 		return $method_data;
     62 	}
     63 }