Skip to content

Commit

Permalink
Merge pull request #22 from acevodo/main
Browse files Browse the repository at this point in the history
Версия 0.9.0
  • Loading branch information
apiship-team authored Apr 29, 2024
2 parents eef75ff + cf73897 commit 9022009
Show file tree
Hide file tree
Showing 22 changed files with 196 additions and 57 deletions.
2 changes: 1 addition & 1 deletion 2.1/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<name>ApiShip</name>
<code>ApiShip</code>
<version>0.8.9 (OpenCart 2.0 - 2.2)</version>
<version>0.9.0 (OpenCart 2.0 - 2.2)</version>
<author>ApiShip</author>
<link>https://apiship.ru</link>

Expand Down
25 changes: 23 additions & 2 deletions 2.1/upload/admin/controller/shipping/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function index() {
$data['text_none'] = $this->language->get('text_none');
$data['text_shipping_apiship_cron_url_copy'] = $this->language->get('text_shipping_apiship_cron_url_copy');

$data['shipping_apiship_version'] = '0.8.9 (OpenCart 2.0 - 2.2)';
$data['shipping_apiship_version'] = '0.9.0 (OpenCart 2.0 - 2.2)';
$data['shipping_apiship_version_js_mod'] = rand();

$data['button_save'] = $this->language->get('button_save');
Expand All @@ -67,6 +67,7 @@ public function index() {
$data['entry_shipping_apiship_sending_office'] = $this->language->get('entry_shipping_apiship_sending_office');

$data['entry_shipping_apiship_contact_organization'] = $this->language->get('entry_shipping_apiship_contact_organization');
$data['entry_shipping_apiship_contact_inn'] = $this->language->get('entry_shipping_apiship_contact_inn');
$data['entry_shipping_apiship_contact_name'] = $this->language->get('entry_shipping_apiship_contact_name');
$data['entry_shipping_apiship_contact_phone'] = $this->language->get('entry_shipping_apiship_contact_phone');
$data['entry_shipping_apiship_contact_email'] = $this->language->get('entry_shipping_apiship_contact_email');
Expand Down Expand Up @@ -128,7 +129,11 @@ public function index() {
];

$data['shipping_apiship_countries'] = [
['code'=>'RU', 'code_text'=>$this->language->get('entry_country_ru')]
['code'=>'RU', 'code_text'=>$this->language->get('entry_country_ru')],
['code'=>'KZ', 'code_text'=>$this->language->get('entry_country_kz')],
['code'=>'BY', 'code_text'=>$this->language->get('entry_country_by')],
['code'=>'KG', 'code_text'=>$this->language->get('entry_country_kg')],
['code'=>'AM', 'code_text'=>$this->language->get('entry_country_am')]
];

$data['entry_shipping_apiship_pickup_type'] = $this->language->get('entry_shipping_apiship_pickup_type');
Expand Down Expand Up @@ -277,6 +282,12 @@ public function index() {
$data['shipping_apiship_contact_organization'] = $this->config->get('shipping_apiship_contact_organization');
}

if (isset($this->request->post['shipping_apiship_contact_inn'])) {
$data['shipping_apiship_contact_inn'] = $this->request->post['shipping_apiship_contact_inn'];
} else {
$data['shipping_apiship_contact_inn'] = $this->config->get('shipping_apiship_contact_inn');
}

if (isset($this->request->post['shipping_apiship_contact_name'])) {
$data['shipping_apiship_contact_name'] = $this->request->post['shipping_apiship_contact_name'];
} else {
Expand Down Expand Up @@ -517,6 +528,12 @@ public function index() {
$data['error_shipping_apiship_contact_organization'] = '';
}

if (isset($this->error['error_shipping_apiship_contact_inn'])) {
$data['error_shipping_apiship_contact_inn'] = $this->error['error_shipping_apiship_contact_inn'];
} else {
$data['error_shipping_apiship_contact_inn'] = '';
}

if (isset($this->error['error_shipping_apiship_contact_name'])) {
$data['error_shipping_apiship_contact_name'] = $this->error['error_shipping_apiship_contact_name'];
} else {
Expand Down Expand Up @@ -615,6 +632,10 @@ private function validate() {
$this->error['error_shipping_apiship_contact_organization'] = $this->language->get('error_shipping_apiship_contact_organization');
}

//if (!$this->request->post['shipping_apiship_contact_inn']) {
// $this->error['error_shipping_apiship_contact_inn'] = $this->language->get('error_shipping_apiship_contact_inn');
//}

if (!$this->request->post['shipping_apiship_contact_name']) {
$this->error['error_shipping_apiship_contact_name'] = $this->language->get('error_shipping_apiship_contact_name');
}
Expand Down
8 changes: 7 additions & 1 deletion 2.1/upload/admin/language/english/shipping/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
$_['entry_shipping_apiship_sending_block'] = 'Building/Building';
$_['entry_shipping_apiship_sending_office'] = 'Office/Apartment';

$_['entry_country_ru'] = 'Russia';
$_['entry_country_ru'] = 'Russian Federation';
$_['entry_country_kz'] = 'Kazakhstan';
$_['entry_country_by'] = 'Belarus';
$_['entry_country_kg'] = 'Kyrgyzstan';
$_['entry_country_am'] = 'Armenia';


$_['entry_shipping_apiship_contact_organization'] = 'Organization';
$_['entry_shipping_apiship_contact_inn'] = 'Organization EIN';
$_['entry_shipping_apiship_contact_name'] = 'Name';
$_['entry_shipping_apiship_contact_phone'] = 'Phone';
$_['entry_shipping_apiship_contact_email'] = 'Email';
Expand Down
8 changes: 7 additions & 1 deletion 2.1/upload/admin/language/russian/shipping/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
$_['entry_shipping_apiship_sending_block'] = 'Строение/Корпус';
$_['entry_shipping_apiship_sending_office'] = 'Офис/Квартира';

$_['entry_country_ru'] = 'Россия';
$_['entry_country_ru'] = 'Россия';
$_['entry_country_kz'] = 'Казахстан';
$_['entry_country_by'] = 'Беларусь';
$_['entry_country_kg'] = 'Киргизия';
$_['entry_country_am'] = 'Армения';


$_['entry_shipping_apiship_contact_organization'] = 'Организация';
$_['entry_shipping_apiship_contact_inn'] = 'ИНН компании';
$_['entry_shipping_apiship_contact_name'] = 'ФИО отвественного лица';
$_['entry_shipping_apiship_contact_phone'] = 'Телефон';
$_['entry_shipping_apiship_contact_email'] = 'Email';
Expand Down
10 changes: 10 additions & 0 deletions 2.1/upload/admin/view/template/shipping/apiship.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@
</div>
</div>

<div class="form-group ">
<label class="col-sm-4 control-label" for="shipping_apiship_contact_inn"><?php echo $entry_shipping_apiship_contact_inn; ?></label>
<div class="col-sm-8">
<input type="text" name="shipping_apiship_contact_inn" value="<?php echo $shipping_apiship_contact_inn; ?>" placeholder="<?php echo $entry_shipping_apiship_contact_inn; ?>" id="shipping_apiship_contact_inn" class="form-control" />
<?php if ($error_shipping_apiship_contact_inn) { ?>
<div class="text-danger"><?php echo $error_shipping_apiship_contact_inn; ?></div>
<?php } ?>
</div>
</div>

<div class="form-group required">
<label class="col-sm-4 control-label" for="shipping_apiship_contact_name"><?php echo $entry_shipping_apiship_contact_name; ?></label>
<div class="col-sm-8">
Expand Down
29 changes: 15 additions & 14 deletions 2.1/upload/catalog/model/shipping/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function __construct($params) {
'shipping_apiship_token' => $this->config->get('shipping_apiship_token'),

'shipping_apiship_contact_organization' => $this->config->get('shipping_apiship_contact_organization'),
'shipping_apiship_contact_inn' => $this->config->get('shipping_apiship_contact_inn'),
'shipping_apiship_contact_name' => $this->config->get('shipping_apiship_contact_name'),
'shipping_apiship_contact_phone' => $this->config->get('shipping_apiship_contact_phone'),
'shipping_apiship_contact_email' => $this->config->get('shipping_apiship_contact_email'),
Expand Down Expand Up @@ -175,7 +176,7 @@ private function getCartTotal() {
}
if ($end_total < 0) $end_total = $end_total + $shipping_cost;

return $end_total;
return $this->currency->convert($end_total,$this->config->get('config_currency'),$this->apiship_params['shipping_apiship_rub_select']);
}

private function check_geo_zone($address) {
Expand Down Expand Up @@ -331,9 +332,9 @@ public function get_quote_list($address, $full_list = false) {
$quote_data[$element['key']] = [
'code' => 'apiship.' . $element['key'],
'title' => $title,
'cost' => $element['deliveryCost'],
'cost' => $this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format($this->tax->calculate($element['deliveryCost'], $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'])
];

break;
Expand Down Expand Up @@ -372,9 +373,9 @@ public function get_quote_list($address, $full_list = false) {
$quote_data[$element['key']] = [
'code' => 'apiship.' . $element['key'],
'title' => $title,
'cost' => $element['deliveryCost'],
'cost' => $this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format($this->tax->calculate($element['deliveryCost'], $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'])
];

break;
Expand Down Expand Up @@ -417,9 +418,9 @@ public function get_quote_list($address, $full_list = false) {
$quote_data[$element['key']] = [
'code' => 'apiship.' . $element['key'],
'title' => $title,
'cost' => $element['deliveryCost'],
'cost' => $this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format($this->tax->calculate($element['deliveryCost'], $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($element['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'])
];

}
Expand Down Expand Up @@ -477,9 +478,9 @@ public function get_quote_list($address, $full_list = false) {
'daysMax' => $tariff['daysMax'],
'tariffDescription' => $tariff['tariffDescription']
]),
'cost' => $tariff['deliveryCost'],
'cost' => $this->currency->convert($tariff['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format($this->tax->calculate($tariff['deliveryCost'], $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($tariff['deliveryCost'], $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'])
];
}

Expand Down Expand Up @@ -510,7 +511,7 @@ public function get_quote_list($address, $full_list = false) {
'title' => $title,
'cost' => 0,
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format(0, $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format(0, $this->session->data['currency'])
);

}
Expand Down Expand Up @@ -681,8 +682,8 @@ private function get_points_array($country, $region, $city, $postcode, $ext_addr
'daysMin' => $tariff['daysMin'],
'daysMax' => $tariff['daysMax'],

'text' => $this->currency->format($this->tax->calculate($cost, $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select']),
'cost' => round($cost),
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($cost, $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
'cost' => $this->currency->convert($cost, $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),

'title' => $this->get_title([
'template' => 'shipping_apiship_template',
Expand Down Expand Up @@ -867,9 +868,9 @@ public function set_point() {
$shipping_apiship = [
'code' => $code,
'title' => $title,
'cost' => $cost,
'cost' => $this->currency->convert($cost, $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')),
'tax_class_id' => $this->apiship_params['shipping_apiship_tax_class_id'],
'text' => $this->currency->format($this->tax->calculate($cost, $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->apiship_params['shipping_apiship_rub_select'])
'text' => $this->currency->format($this->tax->calculate($this->currency->convert($cost, $this->apiship_params['shipping_apiship_rub_select'], $this->config->get('config_currency')), $this->apiship_params['shipping_apiship_tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'])
];

$select_points = $this->apiship->getData('shipping_apiship_select_points');
Expand Down
1 change: 1 addition & 0 deletions 2.1/upload/system/library/apiship/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ public function apiship_order($order_params) {
'email' => $this->apiship_params['shipping_apiship_contact_email'],// Контактный email адрес
'phone' => $this->apiship_params['shipping_apiship_contact_phone'], // Контактный телефон
'companyName' => $this->apiship_params['shipping_apiship_contact_organization'],// Название компании
'companyInn' => $this->apiship_params['shipping_apiship_contact_inn'],// ИНН компании
'contactName' => $this->apiship_params['shipping_apiship_contact_name'], // ФИО контактного лица
'countryCode' => $this->apiship_params['shipping_apiship_sending_country_code'], // Код страны в соответствии с ISO 3166-1 alpha-2
'region' => $this->apiship_params['shipping_apiship_sending_region'], // Область или республика или край
Expand Down
2 changes: 1 addition & 1 deletion 2.3/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<name>ApiShip</name>
<code>ApiShip</code>
<version>0.8.9 (OpenCart 2.3)</version>
<version>0.9.0 (OpenCart 2.3)</version>
<author>ApiShip</author>
<link>https://apiship.ru</link>

Expand Down
25 changes: 23 additions & 2 deletions 2.3/upload/admin/controller/extension/shipping/apiship.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function index() {
$data['text_none'] = $this->language->get('text_none');
$data['text_shipping_apiship_cron_url_copy'] = $this->language->get('text_shipping_apiship_cron_url_copy');

$data['shipping_apiship_version'] = '0.8.9 (OpenCart 2.3)';
$data['shipping_apiship_version'] = '0.9.0 (OpenCart 2.3)';
$data['shipping_apiship_version_js_mod'] = rand();

$data['button_save'] = $this->language->get('button_save');
Expand All @@ -66,6 +66,7 @@ public function index() {
$data['entry_shipping_apiship_sending_office'] = $this->language->get('entry_shipping_apiship_sending_office');

$data['entry_shipping_apiship_contact_organization'] = $this->language->get('entry_shipping_apiship_contact_organization');
$data['entry_shipping_apiship_contact_inn'] = $this->language->get('entry_shipping_apiship_contact_inn');
$data['entry_shipping_apiship_contact_name'] = $this->language->get('entry_shipping_apiship_contact_name');
$data['entry_shipping_apiship_contact_phone'] = $this->language->get('entry_shipping_apiship_contact_phone');
$data['entry_shipping_apiship_contact_email'] = $this->language->get('entry_shipping_apiship_contact_email');
Expand Down Expand Up @@ -127,7 +128,11 @@ public function index() {
];

$data['shipping_apiship_countries'] = [
['code'=>'RU', 'code_text'=>$this->language->get('entry_country_ru')]
['code'=>'RU', 'code_text'=>$this->language->get('entry_country_ru')],
['code'=>'KZ', 'code_text'=>$this->language->get('entry_country_kz')],
['code'=>'BY', 'code_text'=>$this->language->get('entry_country_by')],
['code'=>'KG', 'code_text'=>$this->language->get('entry_country_kg')],
['code'=>'AM', 'code_text'=>$this->language->get('entry_country_am')]
];

$data['entry_shipping_apiship_pickup_type'] = $this->language->get('entry_shipping_apiship_pickup_type');
Expand Down Expand Up @@ -276,6 +281,12 @@ public function index() {
$data['shipping_apiship_contact_organization'] = $this->config->get('shipping_apiship_contact_organization');
}

if (isset($this->request->post['shipping_apiship_contact_inn'])) {
$data['shipping_apiship_contact_inn'] = $this->request->post['shipping_apiship_contact_inn'];
} else {
$data['shipping_apiship_contact_inn'] = $this->config->get('shipping_apiship_contact_inn');
}

if (isset($this->request->post['shipping_apiship_contact_name'])) {
$data['shipping_apiship_contact_name'] = $this->request->post['shipping_apiship_contact_name'];
} else {
Expand Down Expand Up @@ -516,6 +527,12 @@ public function index() {
$data['error_shipping_apiship_contact_organization'] = '';
}

if (isset($this->error['error_shipping_apiship_contact_inn'])) {
$data['error_shipping_apiship_contact_inn'] = $this->error['error_shipping_apiship_contact_inn'];
} else {
$data['error_shipping_apiship_contact_inn'] = '';
}

if (isset($this->error['error_shipping_apiship_contact_name'])) {
$data['error_shipping_apiship_contact_name'] = $this->error['error_shipping_apiship_contact_name'];
} else {
Expand Down Expand Up @@ -614,6 +631,10 @@ private function validate() {
$this->error['error_shipping_apiship_contact_organization'] = $this->language->get('error_shipping_apiship_contact_organization');
}

//if (!$this->request->post['shipping_apiship_contact_inn']) {
// $this->error['error_shipping_apiship_contact_inn'] = $this->language->get('error_shipping_apiship_contact_inn');
//}

if (!$this->request->post['shipping_apiship_contact_name']) {
$this->error['error_shipping_apiship_contact_name'] = $this->language->get('error_shipping_apiship_contact_name');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
$_['entry_shipping_apiship_sending_block'] = 'Building/Building';
$_['entry_shipping_apiship_sending_office'] = 'Office/Apartment';

$_['entry_country_ru'] = 'Russia';
$_['entry_country_ru'] = 'Russian Federation';
$_['entry_country_kz'] = 'Kazakhstan';
$_['entry_country_by'] = 'Belarus';
$_['entry_country_kg'] = 'Kyrgyzstan';
$_['entry_country_am'] = 'Armenia';


$_['entry_shipping_apiship_contact_organization'] = 'Organization';
$_['entry_shipping_apiship_contact_inn'] = 'Organization EIN';
$_['entry_shipping_apiship_contact_name'] = 'Name';
$_['entry_shipping_apiship_contact_phone'] = 'Phone';
$_['entry_shipping_apiship_contact_email'] = 'Email';
Expand Down
Loading

0 comments on commit 9022009

Please sign in to comment.