shop.balmet.com

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

item.php (1654B)


      1 <?php
      2 class ModelExtensionShippingItem extends Model {
      3 	function getQuote($address) {
      4 		$this->load->language('extension/shipping/item');
      5 
      6 		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('shipping_item_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_item_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 			$items = 0;
     20 
     21 			foreach ($this->cart->getProducts() as $product) {
     22 				if ($product['shipping']) {
     23 					$items += $product['quantity'];
     24 				}
     25 			}
     26 
     27 			$quote_data = array();
     28 
     29 			$quote_data['item'] = array(
     30 				'code'         => 'item.item',
     31 				'title'        => $this->language->get('text_description'),
     32 				'cost'         => $this->config->get('shipping_item_cost') * $items,
     33 				'tax_class_id' => $this->config->get('shipping_item_tax_class_id'),
     34 				'text'         => $this->currency->format($this->tax->calculate($this->config->get('shipping_item_cost') * $items, $this->config->get('shipping_item_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'])
     35 			);
     36 
     37 			$method_data = array(
     38 				'code'       => 'item',
     39 				'title'      => $this->language->get('text_title'),
     40 				'quote'      => $quote_data,
     41 				'sort_order' => $this->config->get('shipping_item_sort_order'),
     42 				'error'      => false
     43 			);
     44 		}
     45 
     46 		return $method_data;
     47 	}
     48 }