shop.balmet.com

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

pickup.php (1269B)


      1 <?php
      2 class ModelExtensionShippingPickup extends Model {
      3 	function getQuote($address) {
      4 		$this->load->language('extension/shipping/pickup');
      5 
      6 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('shipping_pickup_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_pickup_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['pickup'] = array(
     22 				'code'         => 'pickup.pickup',
     23 				'title'        => $this->language->get('text_description'),
     24 				'cost'         => 0.00,
     25 				'tax_class_id' => 0,
     26 				'text'         => $this->currency->format(0.00, $this->session->data['currency'])
     27 			);
     28 
     29 			$method_data = array(
     30 				'code'       => 'pickup',
     31 				'title'      => $this->language->get('text_title'),
     32 				'quote'      => $quote_data,
     33 				'sort_order' => $this->config->get('shipping_pickup_sort_order'),
     34 				'error'      => false
     35 			);
     36 		}
     37 
     38 		return $method_data;
     39 	}
     40 }