Back to Opencart

File extension\opencart\catalog\model\shipping\flat.php

docs/api/source-extension.opencart.catalog.model.shipping.flat.html

4.1.0.35.6 KB
Original Source

Namespaces

Classes

| 1: | <?php | | 2: | namespace Opencart\Catalog\Model\Extension\Opencart\Shipping; | | 3: | /** | | 4: | * Class Flat | | 5: | * | | 6: | * @package Opencart\Catalog\Model\Extension\Opencart\Shipping | | 7: | */ | | 8: | class Flat extends \Opencart\System\Engine\Model { | | 9: | /** | | 10: | * Get Quote | | 11: | * | | 12: | * @param array<string, mixed> $address | | 13: | * | | 14: | * @return array<string, mixed> | | 15: | */ | | 16: | public function getQuote(array $address): array { | | 17: | $this->load->language('extension/opencart/shipping/flat'); | | 18: | | | 19: | $this->load->model('localisation/geo_zone'); | | 20: | | | 21: | $results = $this->model_localisation_geo_zone->getGeoZone((int)$this->config->get('shipping_flat_geo_zone_id'), (int)$address['country_id'], (int)$address['zone_id']); | | 22: | | | 23: | if (!$this->config->get('shipping_flat_geo_zone_id')) { | | 24: | $status = true; | | 25: | } elseif ($results) { | | 26: | $status = true; | | 27: | } else { | | 28: | $status = false; | | 29: | } | | 30: | | | 31: | $method_data = []; | | 32: | | | 33: | if ($status) { | | 34: | $quote_data = []; | | 35: | | | 36: | $quote_data['flat'] = [ | | 37: | 'code' => 'flat.flat', | | 38: | 'name' => $this->language->get('text_description'), | | 39: | 'cost' => $this->config->get('shipping_flat_cost'), | | 40: | 'tax_class_id' => $this->config->get('shipping_flat_tax_class_id'), | | 41: | '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']) | | 42: | ]; | | 43: | | | 44: | $method_data = [ | | 45: | 'code' => 'flat', | | 46: | 'name' => $this->language->get('heading_title'), | | 47: | 'quote' => $quote_data, | | 48: | 'sort_order' => $this->config->get('shipping_flat_sort_order'), | | 49: | 'error' => false | | 50: | ]; | | 51: | } | | 52: | | | 53: | return $method_data; | | 54: | } | | 55: | } | | 56: | |

OpenCart API API documentation generated by ApiGen dev-master