shop.balmet.com

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

free.php (1360B)


      1 <?php
      2 class ModelExtensionShippingFree extends Model {
      3 	function getQuote($address) {
      4 		$this->load->language('extension/shipping/free');
      5 
      6 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('shipping_free_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('shipping_free_geo_zone_id')) {
      9 			$status = true;
     10 		} elseif ($query->num_rows) {
     11 			$status = true;
     12 		} else {
     13 			$status = false;
     14 		}
     15 
     16 		if ($this->cart->getSubTotal() < $this->config->get('shipping_free_total')) {
     17 			$status = false;
     18 		}
     19 
     20 		$method_data = array();
     21 
     22 		if ($status) {
     23 			$quote_data = array();
     24 
     25 			$quote_data['free'] = array(
     26 				'code'         => 'free.free',
     27 				'title'        => $this->language->get('text_description'),
     28 				'cost'         => 0.00,
     29 				'tax_class_id' => 0,
     30 				'text'         => $this->currency->format(0.00, $this->session->data['currency'])
     31 			);
     32 
     33 			$method_data = array(
     34 				'code'       => 'free',
     35 				'title'      => $this->language->get('text_title'),
     36 				'quote'      => $quote_data,
     37 				'sort_order' => $this->config->get('shipping_free_sort_order'),
     38 				'error'      => false
     39 			);
     40 		}
     41 
     42 		return $method_data;
     43 	}
     44 }