shop.balmet.com

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

nochex.php (1062B)


      1 <?php
      2 class ModelExtensionPaymentNOCHEX extends Model {
      3 	public function getMethod($address, $total) {
      4 		$this->load->language('extension/payment/nochex');
      5 
      6 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_nochex_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_nochex_total') > 0 && $this->config->get('payment_nochex_total') > $total) {
      9 			$status = false;
     10 		} elseif (!$this->config->get('payment_nochex_geo_zone_id')) {
     11 			$status = true;
     12 		} elseif ($query->num_rows) {
     13 			$status = true;
     14 		} else {
     15 			$status = false;
     16 		}
     17 
     18 		$method_data = array();
     19 
     20 		if ($status) {
     21 			$method_data = array(
     22 				'code'       => 'nochex',
     23 				'title'      => $this->language->get('text_title'),
     24 				'terms'      => '',
     25 				'sort_order' => $this->config->get('payment_nochex_sort_order')
     26 			);
     27 		}
     28 
     29 		return $method_data;
     30 	}
     31 }