+deliveryServices options & install; -order send
This commit is contained in:
parent
34f83d5dcc
commit
3f7cc6b963
@ -313,6 +313,34 @@ class RestApi
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Получение списка служб доставки
|
||||
*
|
||||
* @return array - массив типов доставки
|
||||
*/
|
||||
public function deliveryServicesList()
|
||||
{
|
||||
$url = $this->apiUrl.'reference/delivery-services';
|
||||
$result = $this->curlRequest($url);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Редактирование службы доставки
|
||||
*
|
||||
* @param array $deliveryService - информация о типе доставки
|
||||
* @return array
|
||||
*/
|
||||
public function deliveryServiceEdit($deliveryService)
|
||||
{
|
||||
$dataJson = json_encode($deliveryService);
|
||||
$this->parameters['deliveryService'] = $dataJson;
|
||||
|
||||
$url = $this->apiUrl.'reference/delivery-services/'.$deliveryService['code'].'/edit';
|
||||
$result = $this->curlRequest($url, 'POST');
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Получение списка типов оплаты
|
||||
|
@ -26,6 +26,7 @@ class intaro_intarocrm extends CModule {
|
||||
var $CRM_API_KEY_OPTION = 'api_key';
|
||||
var $CRM_ORDER_TYPES_ARR = 'order_types_arr';
|
||||
var $CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
|
||||
var $CRM_DELIVERY_SERVICES_ARR = 'deliv_services_arr';
|
||||
var $CRM_PAYMENT_TYPES = 'pay_types_arr';
|
||||
var $CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
|
||||
var $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||
@ -204,6 +205,7 @@ class intaro_intarocrm extends CModule {
|
||||
}
|
||||
|
||||
$arResult['deliveryTypesList'] = $this->INTARO_CRM_API->deliveryTypesList();
|
||||
$arResult['deliveryServicesList'] = $this->INTARO_CRM_API->deliveryServicesList();
|
||||
$arResult['paymentTypesList'] = $this->INTARO_CRM_API->paymentTypesList();
|
||||
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
|
||||
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
|
||||
@ -247,6 +249,31 @@ class intaro_intarocrm extends CModule {
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
//bitrix deliveryServicesList
|
||||
$dbDeliveryServicesList = CSaleDeliveryHandler::GetList(
|
||||
array(
|
||||
'SORT' => 'ASC',
|
||||
'NAME' => 'ASC'
|
||||
),
|
||||
array(
|
||||
'ACTIVE' => 'Y'
|
||||
)
|
||||
);
|
||||
|
||||
//form delivery services ids arr
|
||||
$deliveryServicesArr = array();
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
//auto delivery types
|
||||
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
|
||||
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
|
||||
if(!$profile['TITLE']) continue; // services without name ?
|
||||
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
|
||||
}
|
||||
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
|
||||
//bitrix paymentTypesList
|
||||
$dbPaymentTypesList = CSalePaySystem::GetList(
|
||||
array(
|
||||
@ -298,6 +325,7 @@ class intaro_intarocrm extends CModule {
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryServicesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr));
|
||||
@ -327,6 +355,43 @@ class intaro_intarocrm extends CModule {
|
||||
$input['delivery-type-' . $bitrixDeliveryType['ID']] .= '</select>';
|
||||
}
|
||||
|
||||
foreach ($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService) {
|
||||
foreach($bitrixDeliveryService['PROFILES'] as $id => $profile) {
|
||||
if(!$profile['TITLE']) continue;
|
||||
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] =
|
||||
'<select name="delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id . '" class="typeselect">';
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '<option value=""></option>';
|
||||
|
||||
foreach ($arResult['deliveryTypesList'] as $deliveryType) {
|
||||
if(empty($deliveryType['deliveryServices'])) continue;
|
||||
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id].=
|
||||
'<optgroup label="' . $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET) . '">';
|
||||
|
||||
foreach ($deliveryType['deliveryServices'] as $ds) {
|
||||
if(!isset($arResult['deliveryServicesList'][$ds])) continue;
|
||||
|
||||
if ($deliveryServicesArr[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) {
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
|
||||
'<option value="' . $arResult['deliveryServicesList'][$ds]['code'] . '" selected>';
|
||||
} else {
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
|
||||
'<option value="' . $arResult['deliveryServicesList'][$ds]['code'] . '">';
|
||||
}
|
||||
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
|
||||
$APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET);
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</option>';
|
||||
}
|
||||
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</optgroup>';
|
||||
}
|
||||
|
||||
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</select>';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType) {
|
||||
$input['payment-type-' . $bitrixPaymentType['ID']] =
|
||||
'<select name="payment-type-' . $bitrixPaymentType['ID'] . '" class="typeselect">';
|
||||
@ -476,10 +541,12 @@ class intaro_intarocrm extends CModule {
|
||||
//prepare crm lists
|
||||
$arResult['orderTypesList'] = $this->INTARO_CRM_API->orderTypesList();
|
||||
$arResult['deliveryTypesList'] = $this->INTARO_CRM_API->deliveryTypesList();
|
||||
$arResult['deliveryServicesList'] = $this->INTARO_CRM_API->deliveryServicesList();
|
||||
$arResult['paymentTypesList'] = $this->INTARO_CRM_API->paymentTypesList();
|
||||
$arResult['paymentStatusesList'] = $this->INTARO_CRM_API->paymentStatusesList(); // --statuses
|
||||
$arResult['paymentList'] = $this->INTARO_CRM_API->orderStatusesList();
|
||||
$arResult['paymentGroupList'] = $this->INTARO_CRM_API->orderStatusGroupsList(); // -- statuses groups
|
||||
|
||||
//bitrix orderTypesList -- personTypes
|
||||
$dbOrderTypesList = CSalePersonType::GetList(
|
||||
array(
|
||||
@ -512,6 +579,24 @@ class intaro_intarocrm extends CModule {
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
// bitrix deliveryServicesList
|
||||
$dbDeliveryServicesList = CSaleDeliveryHandler::GetList(
|
||||
array(
|
||||
'SORT' => 'ASC',
|
||||
'NAME' => 'ASC'
|
||||
),
|
||||
array(
|
||||
'ACTIVE' => 'Y'
|
||||
)
|
||||
);
|
||||
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
$arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']);
|
||||
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
|
||||
//bitrix paymentTypesList
|
||||
$dbPaymentTypesList = CSalePaySystem::GetList(
|
||||
array(
|
||||
@ -601,8 +686,20 @@ class intaro_intarocrm extends CModule {
|
||||
), false, false, array()
|
||||
);
|
||||
|
||||
//form delivery types ids arr
|
||||
//bitrix deliveryServicesList
|
||||
$dbDeliveryServicesList = CSaleDeliveryHandler::GetList(
|
||||
array(
|
||||
'SORT' => 'ASC',
|
||||
'NAME' => 'ASC'
|
||||
),
|
||||
array(
|
||||
'ACTIVE' => 'Y'
|
||||
)
|
||||
);
|
||||
|
||||
//form delivery types / services ids arr
|
||||
$deliveryTypesArr = array();
|
||||
$deliveryServicesArr = array();
|
||||
|
||||
if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') {
|
||||
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
|
||||
@ -610,8 +707,20 @@ class intaro_intarocrm extends CModule {
|
||||
$deliveryTypesArr[$arDeliveryTypesList['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryTypesList['ID']]));
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
//auto delivery types
|
||||
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
|
||||
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
|
||||
if(!$profile['TITLE']) continue; // services without name ?
|
||||
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
|
||||
}
|
||||
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
} elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {
|
||||
// send to intaro crm and save
|
||||
// send to intaro crm and save delivery types!
|
||||
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
|
||||
do {
|
||||
// parse id
|
||||
@ -636,7 +745,7 @@ class intaro_intarocrm extends CModule {
|
||||
'paymentTypes' => ''
|
||||
)));
|
||||
|
||||
// error pushing customer
|
||||
// error pushing dt
|
||||
if ($this->INTARO_CRM_API->getStatusCode() != 200) {
|
||||
if ($this->INTARO_CRM_API->getStatusCode() != 201) {
|
||||
//handle err
|
||||
@ -645,6 +754,50 @@ class intaro_intarocrm extends CModule {
|
||||
}
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
|
||||
$deliveryTypesArr[$arDeliveryServicesList['SID']] = $arDeliveryServicesList['SID'];
|
||||
|
||||
// send to crm
|
||||
$this->INTARO_CRM_API->deliveryTypeEdit(ICrmOrderActions::clearArr(array(
|
||||
'code' => $arDeliveryServicesList['SID'],
|
||||
'name' => ICrmOrderActions::toJSON($arDeliveryServicesList['NAME']),
|
||||
'defaultCost' => 0,
|
||||
'description' => ICrmOrderActions::toJSON($arDeliveryTypesList['DESCRIPTION']),
|
||||
'paymentTypes' => ''
|
||||
)));
|
||||
|
||||
// error pushing dt
|
||||
if ($this->INTARO_CRM_API->getStatusCode() != 200) {
|
||||
if ($this->INTARO_CRM_API->getStatusCode() != 201) {
|
||||
//handle err
|
||||
ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError());
|
||||
}
|
||||
}
|
||||
|
||||
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
|
||||
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = $id;
|
||||
|
||||
// send to crm
|
||||
$this->INTARO_CRM_API->deliveryServiceEdit(ICrmOrderActions::clearArr(array(
|
||||
'code' => $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) {
|
||||
//handle err
|
||||
ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryServiceEdit', $this->INTARO_CRM_API->getLastError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
}
|
||||
|
||||
//bitrix paymentTypesList
|
||||
@ -715,6 +868,13 @@ class intaro_intarocrm extends CModule {
|
||||
//handler
|
||||
}
|
||||
|
||||
if (isset($_POST['back']) && $_POST['back']) {
|
||||
$APPLICATION->IncludeAdminFile(
|
||||
GetMessage('MODULE_INSTALL_TITLE'),
|
||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step2.php'
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
|
||||
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
|
||||
ICrmOrderActions::uploadOrders(); // each 50
|
||||
|
@ -91,14 +91,18 @@ $defaultPayment = array(
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('input[name="delivery-types-export"]').click(function() {
|
||||
if($(this).val() === 'true')
|
||||
if($(this).val() === 'true') {
|
||||
$('tr.delivery-types').hide('slow');
|
||||
else if($(this).val() === 'false')
|
||||
$('tr.delivery-types').show('show');
|
||||
|
||||
$('tr[name="delivery-services"]').hide('slow');
|
||||
$('tr.delivery-services').hide('slow');
|
||||
} else if($(this).val() === 'false') {
|
||||
$('tr.delivery-types').show('slow');
|
||||
$('tr[name="delivery-services"]').show('slow');
|
||||
$('tr.delivery-services').show('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -142,7 +146,7 @@ $defaultPayment = array(
|
||||
<?php foreach($arResult['bitrixDeliveryTypesList'] as $bitrixDeliveryType): ?>
|
||||
<tr class="delivery-types" style="display: none;">
|
||||
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryType['ID']; ?>">
|
||||
<?php echo $bitrixDeliveryType['NAME']; ?>
|
||||
<?php echo $bitrixDeliveryType['NAME']; ?>
|
||||
</td>
|
||||
<td width="50%" class="adm-detail-content-cell-r">
|
||||
<select name="delivery-type-<?php echo $bitrixDeliveryType['ID']; ?>" class="typeselect">
|
||||
@ -157,6 +161,34 @@ $defaultPayment = array(
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr name="delivery-services" class="heading" style="display: none;">
|
||||
<td colspan="2"><b><?php echo GetMessage('DELIVERY_SERVICES_LIST'); ?></b></td>
|
||||
</tr>
|
||||
<?php foreach($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService): ?>
|
||||
<?php foreach($bitrixDeliveryService['PROFILES'] as $id => $profile): if(!$profile['TITLE']) continue; ?>
|
||||
<tr class="delivery-services" style="display: none;">
|
||||
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>">
|
||||
<?php echo '<b>[' . $bitrixDeliveryService['NAME'] . ']</b>: ' . $profile['TITLE']; ?>
|
||||
</td>
|
||||
<td width="50%" class="adm-detail-content-cell-r">
|
||||
<select name="delivery-service-<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>" class="typeselect">
|
||||
<option value=""></option>
|
||||
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): if(!empty($deliveryType['deliveryServices'])) : ?>
|
||||
<optgroup label="<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>">
|
||||
<?php foreach($deliveryType['deliveryServices'] as $ds): ?>
|
||||
<?php if(isset($arResult['deliveryServicesList'][$ds])): ?>
|
||||
<option value="<?php echo $arResult['deliveryServicesList'][$ds]['code']; ?>" <?php if ($optionsDelivServices[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) echo 'selected'; ?>>
|
||||
<?php echo $APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET); ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endif; endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
|
||||
</tr>
|
||||
|
@ -96,7 +96,7 @@ $defaultOrderProps = array(
|
||||
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
<div align="left" style="float:right; width:50%; position:relative; visible: none;">
|
||||
<input type="submit" name="start" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -3,6 +3,7 @@ $MESS ['STEP_NAME'] = 'Шаг 2';
|
||||
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
|
||||
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
|
||||
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
|
||||
$MESS ['DELIVERY_SERVICES_LIST'] = 'Автоматизированные службы доставок';
|
||||
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
|
||||
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
|
||||
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';
|
||||
|
@ -52,4 +52,6 @@ $MESS ['HOUSE'] = 'Строение / корпус';
|
||||
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
||||
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
||||
|
||||
$MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:';
|
||||
$MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:';
|
||||
|
||||
$MESS ['DELIVERY_SERVICES_LIST'] = 'Автоматизированные службы доставок';
|
@ -7,6 +7,7 @@ $CRM_API_HOST_OPTION = 'api_host';
|
||||
$CRM_API_KEY_OPTION = 'api_key';
|
||||
$CRM_ORDER_TYPES_ARR = 'order_types_arr';
|
||||
$CRM_DELIVERY_TYPES_ARR = 'deliv_types_arr';
|
||||
$CRM_DELIVERY_SERVICES_ARR = 'deliv_services_arr';
|
||||
$CRM_PAYMENT_TYPES = 'pay_types_arr';
|
||||
$CRM_PAYMENT_STATUSES = 'pay_statuses_arr';
|
||||
$CRM_PAYMENT = 'payment_arr'; //order payment Y/N
|
||||
@ -162,7 +163,32 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
$deliveryTypesArr[$arDeliveryTypesList['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryTypesList['ID']]));
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
|
||||
//bitrix deliveryServicesList
|
||||
$dbDeliveryServicesList = CSaleDeliveryHandler::GetList(
|
||||
array(
|
||||
'SORT' => 'ASC',
|
||||
'NAME' => 'ASC'
|
||||
),
|
||||
array(
|
||||
'ACTIVE' => 'Y'
|
||||
)
|
||||
);
|
||||
|
||||
//form delivery services ids arr
|
||||
$deliveryServicesArr = array();
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
//auto delivery types
|
||||
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
|
||||
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
|
||||
if(!$profile['TITLE']) continue; // services without name ?
|
||||
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
|
||||
}
|
||||
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
|
||||
//bitrix paymentTypesList
|
||||
$dbPaymentTypesList = CSalePaySystem::GetList(
|
||||
array(
|
||||
@ -243,6 +269,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
|
||||
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
|
||||
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
|
||||
COption::SetOptionString($mid, $CRM_DELIVERY_SERVICES_ARR, serialize($deliveryServicesArr));
|
||||
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
|
||||
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
|
||||
COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr));
|
||||
@ -266,6 +293,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
//prepare crm lists
|
||||
$arResult['orderTypesList'] = $api->orderTypesList();
|
||||
$arResult['deliveryTypesList'] = $api->deliveryTypesList();
|
||||
$arResult['deliveryServicesList'] = $api->deliveryServicesList();
|
||||
$arResult['paymentTypesList'] = $api->paymentTypesList();
|
||||
$arResult['paymentStatusesList'] = $api->paymentStatusesList(); // --statuses
|
||||
$arResult['paymentList'] = $api->orderStatusesList();
|
||||
@ -315,6 +343,24 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
|
||||
}
|
||||
|
||||
// bitrix deliveryServicesList
|
||||
$dbDeliveryServicesList = CSaleDeliveryHandler::GetList(
|
||||
array(
|
||||
'SORT' => 'ASC',
|
||||
'NAME' => 'ASC'
|
||||
),
|
||||
array(
|
||||
'ACTIVE' => 'Y'
|
||||
)
|
||||
);
|
||||
|
||||
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
|
||||
do {
|
||||
$arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']);
|
||||
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
|
||||
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
|
||||
}
|
||||
|
||||
//bitrix paymentTypesList
|
||||
$dbPaymentTypesList = CSalePaySystem::GetList(
|
||||
array(
|
||||
@ -368,6 +414,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
//saved cat params
|
||||
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
|
||||
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
|
||||
$optionsDelivServices = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_SERVICES_ARR, 0));
|
||||
$optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0));
|
||||
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses
|
||||
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
|
||||
@ -471,6 +518,34 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('DELIVERY_SERVICES_LIST'); ?></b></td>
|
||||
</tr>
|
||||
<?php foreach($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService): ?>
|
||||
<?php foreach($bitrixDeliveryService['PROFILES'] as $id => $profile): if(!$profile['TITLE']) continue; ?>
|
||||
<tr>
|
||||
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>">
|
||||
<?php echo '<b>[' . $bitrixDeliveryService['NAME'] . ']</b>: ' . $profile['TITLE']; ?>
|
||||
</td>
|
||||
<td width="50%" class="adm-detail-content-cell-r">
|
||||
<select name="delivery-service-<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>" class="typeselect">
|
||||
<option value=""></option>
|
||||
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): if(!empty($deliveryType['deliveryServices'])) : ?>
|
||||
<optgroup label="<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>">
|
||||
<?php foreach($deliveryType['deliveryServices'] as $ds): ?>
|
||||
<?php if(isset($arResult['deliveryServicesList'][$ds])): ?>
|
||||
<option value="<?php echo $arResult['deliveryServicesList'][$ds]['code']; ?>" <?php if ($optionsDelivServices[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) echo 'selected'; ?>>
|
||||
<?php echo $APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET); ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endif; endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
<tr class="heading">
|
||||
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user