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