Skip to content

Commit

Permalink
Added option to round order amount (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellynoize authored Jan 20, 2025
1 parent c5916fc commit b1d013d
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v4.1.19
* Added option to round order amount

## v4.1.18
* Fixed constant with version of module.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.18
4.1.19
2 changes: 2 additions & 0 deletions src/upload/admin/controller/extension/module/retailcrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ public function index()
'special_price',
'order_number',
'text_order_number',
'summ_around',
'text_summ_around',
'icml_settings',
'icml_service_enabled_label',
'icml_service_description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

$_['order_number'] = 'Order number';
$_['text_order_number'] = 'Upload the order number to RetailCRM';
$_['summ_around'] = 'Around total summ';
$_['text_summ_around'] = 'Around the order total summ';
$_['icml_settings'] = 'ICML settings';
$_['icml_service_enabled_label'] = 'Upload services in ICML';
$_['icml_service_description'] = 'When the option is enabled, all products for which delivery is disabled will be considered as services and uploaded to CRM as services';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

$_['order_number'] = 'Número de pedido';
$_['text_order_number'] = 'Transferir número de pedido a RetailCRM';
$_['summ_around'] = 'Redondeo del costo del pedido';
$_['text_summ_around'] = 'Redondear los costos del pedido a RetailCRM';
$_['icml_settings'] = 'Ajustes de ICML';
$_['icml_service_enabled_label'] = 'Subir servicios de ICML';
$_['icml_service_description'] = 'Si habilita la opción, todos los productos para los que la entrega está desactivada se tratarán como servicios y se cargarán en CRM como servicios';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

$_['order_number'] = 'Номер заказа';
$_['text_order_number'] = 'Передавать номер заказа в RetailCRM';
$_['summ_around'] = 'Округление суммы заказа';
$_['text_summ_around'] = 'Округлять сумму заказа';
$_['icml_settings'] = 'Настройки ICML';
$_['icml_service_enabled_label'] = 'Выгружать услуги в ICML';
$_['icml_service_description'] = 'При включении опции все товары, для которых отключена доставка, будут рассматриваться как услуги и загружаться в CRM как услуги';
Expand Down
20 changes: 20 additions & 0 deletions src/upload/admin/view/template/extension/module/retailcrm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,26 @@
</div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $summ_around; ?></legend>
<div class="form-group">
<label class="col-sm-2 control-label" for="retailcrm_summ_around"><?php echo $text_summ_around; ?></label>
<div class="col-sm-10">
<label class="radio-inline">
<input type="radio" name="retailcrm_summ_around" value="1" <?php if (isset($saved_settings['retailcrm_summ_around']) &&
$saved_settings['retailcrm_summ_around'] == 1) :
echo 'checked'; endif; ?> />
<?php echo $text_yes; ?>
</label>
<label class="radio-inline">
<input type="radio" name="retailcrm_summ_around" value="0" <?php if (!isset($saved_settings['retailcrm_summ_around']) ||
$saved_settings['retailcrm_summ_around'] == 0) :
echo 'checked'; endif; ?> />
<?php echo $text_no; ?>
</label>
</div>
</div>
</fieldset>
<fieldset>
<legend><?php echo $text_retailcrm_discount; ?></legend>
<div class="form-group">
Expand Down
22 changes: 22 additions & 0 deletions src/upload/admin/view/template/extension/module/retailcrm.twig
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,28 @@
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ summ_around }}</legend>
<div class="form-group">
<label class="col-sm-2 control-label" class="col-sm-2 control-label" for="module_retailcrm_summ_around">{{ text_summ_around }}</label>
<div class="col-sm-10">
<label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_summ_around" value="1"
{% if saved_settings.module_retailcrm_summ_around is defined and saved_settings.module_retailcrm_summ_around == 1 %}
checked
{% endif %} />
{{ text_yes }}
</label>
<label class="control-label" class="radio-inline">
<input type="radio" name="module_retailcrm_summ_around" value="0"
{% if saved_settings.module_retailcrm_summ_around is not defined or saved_settings.module_retailcrm_summ_around == 0 %}
checked
{% endif %} />
{{ text_no }}
</label>
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ text_retailcrm_discount }}</legend>
<div class="form-group">
Expand Down
6 changes: 6 additions & 0 deletions src/upload/catalog/model/extension/retailcrm/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ public function processOrder($order_data, $create = true) {
$order['number'] = $order_data['order_id'];
}

if (isset($this->settings[$this->moduleTitle . '_summ_around'])
&& $this->settings[$this->moduleTitle . '_summ_around'] == 1
) {
$order['applyRound'] = true;
}

$order['externalId'] = $order_id;
$order['firstName'] = $order_data['shipping_firstname'];
$order['lastName'] = $order_data['shipping_lastname'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ public function setOrderData() {
$this->data['countryIso'] = $this->order_data['shipping_iso_code_2'];
}

if ($this->settingsManager->getSetting('order_number')
&& $this->settingsManager->getSetting('order_number') == 1
) {
if ($this->settingsManager->getSetting('order_number') == 1) {
$this->data['number'] = $this->order_data['order_id'];
}

if ($this->settingsManager->getSetting('summ_around') == 1) {
$this->data['applyRound'] = true;
}

$this->data['externalId'] = $this->order_data['order_id'];
$this->data['firstName'] = $this->order_data['shipping_firstname'];
$this->data['lastName'] = $this->order_data['shipping_lastname'];
Expand Down
2 changes: 1 addition & 1 deletion src/upload/system/library/retailcrm/retailcrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Retailcrm {

const RETAILCRM_DISCOUNT = 'retailcrm_discount';
const RETAILCRM_DISCOUNT_SORT_ORDER = 8;
const VERSION_MODULE = '4.1.18';
const VERSION_MODULE = '4.1.19';

protected $registry;

Expand Down

0 comments on commit b1d013d

Please sign in to comment.