Добавил в установку модуля
This commit is contained in:
parent
ae3ed71855
commit
876ab7cf13
5 changed files with 72 additions and 2 deletions
|
@ -14,10 +14,10 @@ use Bitrix\Sale\Delivery\Services\Manager;
|
|||
use Bitrix\Sale\EventActions;
|
||||
use Bitrix\Sale\Internals\OrderTable;
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Component\Constants;
|
||||
use Intaro\RetailCrm\Component\Installer\InstallerTrait;
|
||||
use Intaro\RetailCrm\Service\CurrencyService;
|
||||
use Intaro\RetailCrm\Service\OrderLoyaltyDataService;
|
||||
use Intaro\RetailCrm\Vendor\Symfony\Component\Process\PhpExecutableFinder;
|
||||
use RetailCrm\ApiClient;
|
||||
use RetailCrm\Exception\CurlException;
|
||||
use RetailCrm\Http\Client;
|
||||
|
@ -552,6 +552,24 @@ class intaro_retailcrm extends CModule
|
|||
$api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0);
|
||||
$this->RETAIL_CRM_API = new ApiClient($api_host, $api_key);
|
||||
|
||||
$useCrmOrderMethods = htmlspecialchars(trim($_POST['use_crm_order_methods'])) === 'Y' ? 'Y' : 'N';
|
||||
$crmOrderMethod = [];
|
||||
|
||||
if ($useCrmOrderMethods === 'Y') {
|
||||
$crmOrderMethod = $_POST['crm_order_methods'];
|
||||
}
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
Constants::USE_CRM_ORDER_METHODS,
|
||||
$useCrmOrderMethods
|
||||
);
|
||||
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
Constants::CRM_ORDER_METHODS,
|
||||
serialize(RCrmActions::clearArr(is_array($crmOrderMethod) ? $crmOrderMethod : []))
|
||||
);
|
||||
|
||||
//bitrix orderTypesList
|
||||
$arResult['arSites'] = RCrmActions::getSitesList();
|
||||
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use RetailCrm\ApiClient;
|
||||
|
||||
/** @var $APPLICATION */
|
||||
|
@ -132,6 +133,23 @@ if (isset($arResult['PAYMENT'])) {
|
|||
'N' => 'not-paid',
|
||||
];
|
||||
}
|
||||
|
||||
$orderMethods = [];
|
||||
$getOrderMethods = $RETAIL_CRM_API->orderMethodsList();
|
||||
|
||||
if ($getOrderMethods !== null && $getOrderMethods->isSuccessful()) {
|
||||
foreach ($getOrderMethods->orderMethods as $method) {
|
||||
if (!$method['active']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$orderMethods[$method['code']] = $method['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$arResult['orderMethods'] = $orderMethods;
|
||||
$crmOrderMethods = ConfigProvider::getCrmOrderMethods();
|
||||
$useCrmOrderMethods = ConfigProvider::useCrmOrderMethods();
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
|
@ -145,6 +163,10 @@ if (isset($arResult['PAYMENT'])) {
|
|||
<?php CJSCore::Init(['jquery']);?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function switchCrmOrderMethods() {
|
||||
$('#crm_order_methods').toggle(500);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('input[name="update"]').on('click', function() {
|
||||
$('input[name="step"]').val(2);
|
||||
|
@ -381,6 +403,32 @@ if (isset($arResult['PAYMENT'])) {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('CRM_ORDER_METHODS'); ?></b></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center!important;">
|
||||
<label><input class="addr" type="checkbox" name="use_crm_order_methods" value="Y" onclick="switchCrmOrderMethods();" <?php if ($useCrmOrderMethods === 'Y') {
|
||||
echo "checked";
|
||||
} ?>><?php echo GetMessage('CRM_ORDER_METHODS_OPTION'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="crm_order_methods" style="display:<?php echo $useCrmOrderMethods !== 'Y' ? 'none' : '';?>">
|
||||
<td colspan="2" style="text-align: center!important;">
|
||||
<br><br>
|
||||
<select multiple size="<?php echo count($arResult['orderMethods']);?>" name="crm_order_methods[]">
|
||||
<?php foreach ($arResult['orderMethods'] as $key => $name): ?>
|
||||
<option value="<?php echo $key;?>"<?php if (is_array($crmOrderMethods) && in_array($key, $crmOrderMethods)) {
|
||||
echo 'selected';
|
||||
} ?>>
|
||||
<?php echo $name;?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
|
|
|
@ -22,3 +22,5 @@ $MESS ['DELIV_TYPES_EXPORT_F'] = 'Set the correspondence between 1C-Bitrix and R
|
|||
$MESS ['STATUS_NOT_SETTINGS'] ='Cannot find suitable statuses in Bitrix';
|
||||
$MESS ['INTEGRATIONS'] = ' (integration)';
|
||||
$MESS ['INTEGRATION_PAYMENT_LIST'] = 'The status will not be transferred for integration payments';
|
||||
$MESS ['CRM_ORDER_METHODS'] = 'Transfer of orders from CRM to Bitrix';
|
||||
$MESS ['CRM_ORDER_METHODS_OPTION'] = 'Upload orders using selected methods from RetailCRM';
|
|
@ -22,3 +22,5 @@ $MESS ['DELIV_TYPES_EXPORT_F'] = 'Настроить соответствие д
|
|||
$MESS ['STATUS_NOT_SETTINGS'] ='Не найдены подходящие статусы в Битрикс';
|
||||
$MESS ['INTEGRATIONS'] = ' (интеграционная)';
|
||||
$MESS ['INTEGRATION_PAYMENT_LIST'] = 'Для интеграционных оплат статус не передаётся';
|
||||
$MESS ['CRM_ORDER_METHODS'] = 'Передача заказов из CRM в Битрикс';
|
||||
$MESS ['CRM_ORDER_METHODS_OPTION'] = 'Выгружать из RetailCRM заказы оформленные выбранными способами';
|
|
@ -1184,7 +1184,7 @@ class ConfigProvider
|
|||
*/
|
||||
public static function getCrmOrderMethods()
|
||||
{
|
||||
return static::getUnserializedOption(Constants::CRM_ORDER_METHODS, []);
|
||||
return static::getUnserializedOption(Constants::CRM_ORDER_METHODS);
|
||||
}
|
||||
|
||||
public static function setTrackNumberStatus($trackNumberStatus)
|
||||
|
|
Loading…
Add table
Reference in a new issue