1
0
mirror of synced 2024-11-22 13:26:10 +03:00

deliveryServices export in options.php; several fixes.

This commit is contained in:
Grisha Pomadchin 2014-01-30 12:17:58 +04:00
parent 2de2077055
commit 4469c44861
3 changed files with 68 additions and 9 deletions

View File

@ -23,6 +23,20 @@ $MESS["PROPERTY_OFFER_HEADER_NAME"] = "Свойство торгового пр
$MESS["PROPERTY_ARTICLE_HEADER_NAME"] = "Артикул";
$MESS["PROPERTY_MANUFACTURER_HEADER_NAME"] = "Производитель";
$MESS["PROPERTY_COLOR_HEADER_NAME"] = "Цвет";
$MESS["PROPERTY_WEIGHT_HEADER_NAME"] = "Вес";
$MESS["PROPERTY_WEIGHT_HEADER_NAME"] = "Вес (габариты)";
$MESS["PROPERTY_LENGTH_HEADER_NAME"] = "Длина (габариты)";
$MESS["PROPERTY_WIDTH_HEADER_NAME"] = "Ширина (габариты)";
$MESS["PROPERTY_HEIGHT_HEADER_NAME"] = "Высота (габариты)";
$MESS["PROPERTY_SIZE_HEADER_NAME"] = "Размер";
?>
$MESS["SELECT_FIELD_NAME"] = "Поле";
$MESS["SELECT_PROPERTY_NAME"] = "Свойства";
$MESS["SELECT_WEIGHT_PROPERTY_NAME"] = "Вec (грамм)";
$MESS["SELECT_LENGTH_PROPERTY_NAME"] = "Длина (мм.)";
$MESS["SELECT_WIDTH_PROPERTY_NAME"] = "Ширина (мм.)";
$MESS["SELECT_HEIGHT_PROPERTY_NAME"] = "Высота (мм.)";
$MESS["UNIT_MEASUREMENT_MM"] = "мм.";
$MESS["UNIT_MEASUREMENT_CM"] = "см.";
$MESS["UNIT_MEASUREMENT_M"] = "м.";
$MESS["UNIT_MEASUREMENT_MG"] = "мг.";
$MESS["UNIT_MEASUREMENT_G"] = "г.";
$MESS["UNIT_MEASUREMENT_KG"] = "кг.";

View File

@ -50,4 +50,10 @@ $MESS ['FLOOR'] = 'Этаж';
$MESS ['BLOCK'] = 'Подъезд';
$MESS ['HOUSE'] = 'Строение / корпус';
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
$MESS ['UPDATE_DELIVERY_SERVICES'] = 'Выгрузка служб доставок';
$MESS ['MESS_1'] = 'Произошла ошибка при выгрузке одной или нескольких служб доставок, попробуйте еще раз. Если проблема повторилась, обратитесь в Интаро Софт.';
$MESS ['MESS_2'] = 'Произошла ошибка сервера, обратитесь в Интаро Софт.';

View File

@ -101,6 +101,8 @@ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_RE
$api = new IntaroCrm\RestApi($api_host, $api_key);
$api->paymentStatusesList();
//check connection & apiKey valid
if ((int) $api->getStatusCode() != 200) {
$APPLICATION->RestartBuffer();
@ -125,24 +127,24 @@ if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_RE
do {
if(!$optionsDelivTypes[$arDeliveryServicesList['SID']]) {
self::eventLog('options.php', 'No delivery type relations established', $arDeliveryServicesList['SID'] . ':' . $id);
ICrmOrderActions::eventLog('options.php', 'No delivery type relations established', $arDeliveryServicesList['SID'] . ':' . $id);
continue;
}
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
// send to crm
$this->INTARO_CRM_API->deliveryServiceEdit(ICrmOrderActions::clearArr(array(
$api->deliveryServiceEdit(ICrmOrderActions::clearArr(array(
'code' => $arDeliveryServicesList['SID'] . '-' . $id,
'name' => ICrmOrderActions::toJSON($profile['TITLE']),
'deliveryType' => $arDeliveryServicesList['SID']
)));
// error pushing dt
if ($this->INTARO_CRM_API->getStatusCode() != 200) {
if ($this->INTARO_CRM_API->getStatusCode() != 201) {
if ($api->getStatusCode() != 200) {
if ($api->getStatusCode() != 201) {
//handle err
self::eventLog('options.php', 'IntaroCrm\RestApi::deliveryServiceEdit', $this->INTARO_CRM_API->getLastError());
ICrmOrderActions::eventLog('options.php', 'IntaroCrm\RestApi::deliveryServiceEdit', $api->getLastError());
}
}
}
@ -518,10 +520,42 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$('tr.address-detail-' + orderType).hide('slow');
});
});
$('input[name="update-delivery-services"]').live('click', function() {
BX.showWait();
var updButton = this;
// hide next step button
$(updButton).css('opacity', '0.5').attr('disabled', 'disabled');
var handlerUrl = $(this).parents('form').attr('action');
var data = 'ajax=1';
$.ajax({
type: 'POST',
url: handlerUrl,
data: data,
dataType: 'json',
success: function(response) {
BX.closeWait();
$(updButton).css('opacity', '1').removeAttr('disabled');
if(!response.success)
alert('<?php echo GetMessage('MESS_1'); ?>');
},
error: function () {
BX.closeWait();
$(updButton).css('opacity', '1').removeAttr('disabled');
alert('<?php echo GetMessage('MESS_2'); ?>');
}
});
return false;
});
</script>
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
<?php
<?php
echo bitrix_sessid_post();
$tabControl->BeginNextTab();
?>
@ -572,6 +606,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td>
</tr>
<?php endforeach; ?>
<tr class="heading">
<td colspan="2">
<input type="submit" name="update-delivery-services" value="<?php echo GetMessage('UPDATE_DELIVERY_SERVICES'); ?>" class="adm-btn-save">
</td>
</tr>
<tr class="heading">
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
</tr>