| 1: | <?php
|
| 2: | namespace Opencart\Catalog\Model\Extension\Opencart\Shipping;
|
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: |
|
| 8: | class Pickup extends \Opencart\System\Engine\Model {
|
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: |
|
| 16: | public function getQuote(array $address): array {
|
| 17: | $this->load->language('extension/opencart/shipping/pickup');
|
| 18: |
|
| 19: | $this->load->model('localisation/geo_zone');
|
| 20: |
|
| 21: | $results = $this->model_localisation_geo_zone->getGeoZone((int)$this->config->get('shipping_pickup_geo_zone_id'), (int)$address['country_id'], (int)$address['zone_id']);
|
| 22: |
|
| 23: | if (!$this->config->get('shipping_pickup_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['pickup'] = [
|
| 37: | 'code' => 'pickup.pickup',
|
| 38: | 'name' => $this->language->get('text_description'),
|
| 39: | 'cost' => 0.00,
|
| 40: | 'tax_class_id' => 0,
|
| 41: | 'text' => $this->currency->format(0.00, $this->session->data['currency'])
|
| 42: | ];
|
| 43: |
|
| 44: | $method_data = [
|
| 45: | 'code' => 'pickup',
|
| 46: | 'name' => $this->language->get('heading_title'),
|
| 47: | 'quote' => $quote_data,
|
| 48: | 'sort_order' => $this->config->get('shipping_pickup_sort_order'),
|
| 49: | 'error' => false
|
| 50: | ];
|
| 51: | }
|
| 52: |
|
| 53: | return $method_data;
|
| 54: | }
|
| 55: | }
|
| 56: | |