This commit is contained in:
Dmitry Akolzin 2017-04-25 13:06:17 +03:00
parent 6a9b2a7e59
commit bcd319df05

View File

@ -47,27 +47,11 @@ class ControllerApiRetailcrm extends Controller
); );
foreach ($shippingModules as $shippingModule) { foreach ($shippingModules as $shippingModule) {
$this->load->model('extension/shipping/' . $shippingModule['code']); $this->load->model('extension/shipping/' . $shippingModule['code']);
if ($this->config->get($shippingModule['code'] . '_status')) { if ($this->config->get($shippingModule['code'] . '_status')) {
if($this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address)) { if($this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address)) {
$method_data = $this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address); $quote_data[] = $this->{'model_extension_shipping_' . $shippingModule['code']}->getQuote($address);
if($method_data['quote']) {
$quote_data[] = $method_data;
} else {
$this->load->language('extension/shipping/' . $shippingModule['code']);
$quote_data[] = array(
'code' => $shippingModule['code'],
'title' => $this->language->get('text_title')
);
}
} else {
$this->load->language('extension/shipping/' . $shippingModule['code']);
$quote_data[] = array(
'code' => $shippingModule['code'],
'title' => $this->language->get('text_title')
);
} }
} }
} }
@ -76,15 +60,12 @@ class ControllerApiRetailcrm extends Controller
$deliveryTypes = array(); $deliveryTypes = array();
foreach ($quote_data as $shipping) { foreach ($quote_data as $shipping) {
if(isset($shipping['quote']) && !empty($shipping['quote'])){
foreach ($shipping['quote'] as $shippingMethod) { foreach ($shipping['quote'] as $shippingMethod) {
$deliveryTypes[$shipping['code']]['title'] = $shipping['title'];
$deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod;
}
} else {
$deliveryTypes[$shipping['code']]['title'] = $shipping['title']; $deliveryTypes[$shipping['code']]['title'] = $shipping['title'];
$deliveryTypes[$shipping['code']][$shipping['code']] = $shipping; $deliveryTypes[$shipping['code']][$shippingMethod['code']] = $shippingMethod;
} }
} }
return $deliveryTypes; return $deliveryTypes;