Приветствую!
Версия ocStore 2.1.0.2.1
Подскажи пожалуйста, как убрать один из способов доставки, если появился способ оплаты "Бесплатный заказ".
Например:
Способы доставки - 1)Доставка почтой, 2)Наложенный платеж
Способы оплаты - 1)Картой
Покупатель закрывает сумму товара полностью бонусами, Итог равен 0,в способах оплаты появляется возможность оплатить "бесплатно" и получается:
Способы оплаты - 1)Картой, 2)Бесплатный заказ
Вопрос:
1.Как убрать способ доставки "наложенный платеж", если появился "бесплатный заказ" в способах оплаты?
я так понимаю надо править в модели catalog/model/payment/ , но тут модуль мультидоставка , который формирует несколько вариантов доставки.... и как прописать условие для доставки по key я не понял(
что то типа такого:
if (isset($this->session->data['payment_method']['code']) && strpos($this->session->data['payment_method']['code'], 'free_checkout') && $key == 3) /*наложенный платеж*/
$status = false;
} else {
$status = true;
}
в файл модели доставки перед if ($status) :
<?php
class ModelShippingCs extends Model {
function getQuote($address) {
$this->load->language('shipping/cs');
$this->load->model('setting/setting');
$custom_shippings = $this->model_setting_setting->getSetting('cs');
$method_data = array();
$status = $this->config->get('cs_status');
$quote_data = array();
if(!empty($custom_shippings['cs'])){
foreach($custom_shippings['cs'] as $key => $custom_shipping){
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$custom_shipping['cs_geo_zone_id'] . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
if (!$custom_shipping['cs_geo_zone_id']) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
if ($status) {
if(!empty($custom_shipping['cost'])){
$textt = $this->currency->format($this->tax->calculate($custom_shipping['cost'], $custom_shipping['cs_tax_class_id'], $this->config->get('config_tax')));
} else{
$textt = $this->language->get('');
}
$quote_data['cs_'.$key] = array(
'code' => 'cs.cs_'.$key,
'title' => $custom_shipping['shipping_description'][(int)$this->config->get('config_language_id')]['name'],
'cost' => $custom_shipping['cost'],
'tax_class_id' => $custom_shipping['cs_tax_class_id'],
/*'text' => $this->currency->format($this->tax->calculate($custom_shipping['cost'], $custom_shipping['cs_tax_class_id'], $this->config->get('config_tax')))*/
'text' => $textt
);
}
}
}
$titlearray = $this->config->get('cs_group_shipping');
$method_data = array(
'code' => 'cs',
'title' => $titlearray[(int)$this->config->get('config_language_id')]['shipping_name'],
'quote' => $quote_data,
'sort_order' => $this->config->get('cs_sort_order'),
'error' => false
);
return $method_data;
}
}
подскажите пожалуйста!