Сделал сохранение свойств для всех каталогов. Убрал вывод свойств, для которых не заданы коды
This commit is contained in:
parent
7c762dff2f
commit
7b9c2e4f96
@ -190,8 +190,7 @@ if ($STEP === 1) {
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
foreach ($settingsService->defaultPropList as $propertyKey => $property) {
|
foreach ($settingsService->defaultPropList as $propertyKey => $property) { ?>
|
||||||
$productSelected = false; ?>
|
|
||||||
|
|
||||||
<tr class="adm-list-table-row">
|
<tr class="adm-list-table-row">
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
@ -215,14 +214,14 @@ if ($STEP === 1) {
|
|||||||
if ($keyField === $propertyKey) { ?>
|
if ($keyField === $propertyKey) { ?>
|
||||||
<option value="<?=$field['CODE']?>"
|
<option value="<?=$field['CODE']?>"
|
||||||
<?php
|
<?php
|
||||||
$productSelected = $settingsService->isOptionSelected(
|
$isSelected = $settingsService->isOptionSelected(
|
||||||
$field,
|
$field,
|
||||||
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
||||||
$propertyKey
|
$propertyKey
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?= $productSelected ? ' selected' : ''?>
|
<?= $isSelected ? ' selected' : ''?>
|
||||||
>
|
>
|
||||||
<?=$field['name']?>
|
<?=$field['name']?>
|
||||||
</option>
|
</option>
|
||||||
@ -241,7 +240,7 @@ if ($STEP === 1) {
|
|||||||
<?php
|
<?php
|
||||||
echo $settingsService->getOptionClass($prop, true);
|
echo $settingsService->getOptionClass($prop, true);
|
||||||
|
|
||||||
$productSelected = $settingsService->isOptionSelected(
|
$isSelected = $settingsService->isOptionSelected(
|
||||||
$prop,
|
$prop,
|
||||||
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
||||||
$propertyKey
|
$propertyKey
|
||||||
@ -251,7 +250,7 @@ if ($STEP === 1) {
|
|||||||
= $settingsService->getHlTableName($prop)
|
= $settingsService->getHlTableName($prop)
|
||||||
?? $productHlTableName;
|
?? $productHlTableName;
|
||||||
|
|
||||||
echo $productSelected ? ' selected' : '';
|
echo $isSelected ? ' selected' : '';
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<?=$prop['NAME']?>
|
<?=$prop['NAME']?>
|
||||||
@ -376,19 +375,18 @@ if ($STEP === 1) {
|
|||||||
<option value="<?=$prop['CODE']?>"
|
<option value="<?=$prop['CODE']?>"
|
||||||
<?php
|
<?php
|
||||||
echo $settingsService->getOptionClass($prop, false);
|
echo $settingsService->getOptionClass($prop, false);
|
||||||
if (!$productSelected) {
|
|
||||||
$isSelected = $settingsService->isOptionSelected(
|
|
||||||
$prop,
|
|
||||||
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
|
|
||||||
$propertyKey
|
|
||||||
);
|
|
||||||
|
|
||||||
$skuHlTableName
|
$isSelected = $settingsService->isOptionSelected(
|
||||||
= $settingsService->getHlTableName($prop)
|
$prop,
|
||||||
?? $skuHlTableName;
|
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
|
||||||
|
$propertyKey
|
||||||
|
);
|
||||||
|
|
||||||
echo $isSelected ? ' selected' : '';
|
$skuHlTableName
|
||||||
}
|
= $settingsService->getHlTableName($prop)
|
||||||
|
?? $skuHlTableName;
|
||||||
|
|
||||||
|
echo $isSelected ? ' selected' : '';
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<?=$prop['NAME']?>
|
<?=$prop['NAME']?>
|
||||||
@ -475,7 +473,6 @@ if ($STEP === 1) {
|
|||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$productSelected = false;
|
|
||||||
$catalogId = $arIBlock['ID'];
|
$catalogId = $arIBlock['ID'];
|
||||||
$catalogCustomProps = $settingsService->customPropList[$catalogId];
|
$catalogCustomProps = $settingsService->customPropList[$catalogId];
|
||||||
|
|
||||||
@ -500,7 +497,7 @@ if ($STEP === 1) {
|
|||||||
<?php
|
<?php
|
||||||
echo $settingsService->getOptionClass($prop, true);
|
echo $settingsService->getOptionClass($prop, true);
|
||||||
|
|
||||||
$productSelected = $settingsService->isOptionSelected(
|
$isSelected = $settingsService->isOptionSelected(
|
||||||
$prop,
|
$prop,
|
||||||
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
$arIBlock['OLD_PROPERTY_PRODUCT_SELECT'],
|
||||||
$catalogCustomPropCode
|
$catalogCustomPropCode
|
||||||
@ -510,7 +507,7 @@ if ($STEP === 1) {
|
|||||||
= $settingsService->getHlTableName($prop)
|
= $settingsService->getHlTableName($prop)
|
||||||
?? $productHlTableName;
|
?? $productHlTableName;
|
||||||
|
|
||||||
echo $productSelected ? ' selected' : '';
|
echo $isSelected ? ' selected' : '';
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<?=$prop['NAME']?>
|
<?=$prop['NAME']?>
|
||||||
@ -519,12 +516,11 @@ if ($STEP === 1) {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php if ($arIBlock['PROPERTIES_SKU'] !== null) {
|
<?php if ($arIBlock['PROPERTIES_SKU'] !== null) { ?>
|
||||||
$productSelected = false; ?>
|
|
||||||
<td class="adm-list-table-cell">
|
<td class="adm-list-table-cell">
|
||||||
<select
|
<select
|
||||||
name="iblockPropertyProduct_<?=$catalogCustomPropCode?>[<?= $catalogId ?>]"
|
name="iblockPropertySku_<?=$catalogCustomPropCode?>[<?= $catalogId ?>]"
|
||||||
id="iblockPropertyProduct_<?=$catalogCustomPropCode . $catalogId ?>"
|
id="iblockPropertySku_<?=$catalogCustomPropCode . $catalogId ?>"
|
||||||
class="property-export"
|
class="property-export"
|
||||||
data-type="<?= $catalogCustomPropCode ?>"
|
data-type="<?= $catalogCustomPropCode ?>"
|
||||||
onchange="propertyChange(this)"
|
onchange="propertyChange(this)"
|
||||||
@ -535,9 +531,8 @@ if ($STEP === 1) {
|
|||||||
$skuHlTableName = ''; ?>
|
$skuHlTableName = ''; ?>
|
||||||
<option value="<?=$prop['CODE']?>"
|
<option value="<?=$prop['CODE']?>"
|
||||||
<?php
|
<?php
|
||||||
echo $settingsService->getOptionClass($prop, false);
|
echo $settingsService->getOptionClass($prop, false);
|
||||||
|
|
||||||
if (!$productSelected) {
|
|
||||||
$isSelected = $settingsService->isOptionSelected(
|
$isSelected = $settingsService->isOptionSelected(
|
||||||
$prop,
|
$prop,
|
||||||
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
|
$arIBlock['OLD_PROPERTY_SKU_SELECT'],
|
||||||
@ -549,7 +544,6 @@ if ($STEP === 1) {
|
|||||||
?? $skuHlTableName;
|
?? $skuHlTableName;
|
||||||
|
|
||||||
echo $isSelected ? ' selected' : '';
|
echo $isSelected ? ' selected' : '';
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
>
|
>
|
||||||
<?=$prop['NAME']?>
|
<?=$prop['NAME']?>
|
||||||
@ -766,6 +760,7 @@ if ($STEP === 1) {
|
|||||||
|
|
||||||
function propertyChange(obj) {
|
function propertyChange(obj) {
|
||||||
let selectedOption = $(obj).find('option')[obj.selectedIndex];
|
let selectedOption = $(obj).find('option')[obj.selectedIndex];
|
||||||
|
console.log(selectedOption);
|
||||||
|
|
||||||
if (selectedOption.className === 'not-highloadblock') {
|
if (selectedOption.className === 'not-highloadblock') {
|
||||||
let objId = '#' + obj.id;
|
let objId = '#' + obj.id;
|
||||||
@ -932,7 +927,7 @@ if ($STEP === 1) {
|
|||||||
properties: customProps,
|
properties: customProps,
|
||||||
profileId: profileId
|
profileId: profileId
|
||||||
},
|
},
|
||||||
}).then(addParamsToSetupFieldsList);
|
}).then(addParamsToSetupFieldsList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(customPropsToDelete).length > 0) {
|
if (Object.keys(customPropsToDelete).length > 0) {
|
||||||
@ -941,7 +936,7 @@ if ($STEP === 1) {
|
|||||||
properties: customPropsToDelete,
|
properties: customPropsToDelete,
|
||||||
profileId: profileId
|
profileId: profileId
|
||||||
},
|
},
|
||||||
}).then(deleteParamsFromSetupFieldsList);
|
}).then(deleteParamsFromSetupFieldsList());
|
||||||
}
|
}
|
||||||
|
|
||||||
const promises = [savePromise, deletePromise].filter(Boolean);
|
const promises = [savePromise, deletePromise].filter(Boolean);
|
||||||
|
@ -541,6 +541,9 @@ class SettingsService
|
|||||||
*/
|
*/
|
||||||
public function isOptionSelected(array $prop, array $oldSelect, string $key): bool
|
public function isOptionSelected(array $prop, array $oldSelect, string $key): bool
|
||||||
{
|
{
|
||||||
|
if ($key === 'manufacturer') {
|
||||||
|
$a = 'yes';
|
||||||
|
}
|
||||||
if (count($oldSelect) > 0) {
|
if (count($oldSelect) > 0) {
|
||||||
if ($prop['CODE'] === $oldSelect[$key]) {
|
if ($prop['CODE'] === $oldSelect[$key]) {
|
||||||
return true;
|
return true;
|
||||||
@ -635,7 +638,9 @@ class SettingsService
|
|||||||
$dbSkuProperties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], [], ['MULTIPLE' => 'N']);
|
$dbSkuProperties = CIBlock::GetProperties($iblockOffer['IBLOCK_ID'], [], ['MULTIPLE' => 'N']);
|
||||||
|
|
||||||
while ($prop = $dbSkuProperties->Fetch()) {
|
while ($prop = $dbSkuProperties->Fetch()) {
|
||||||
$propertiesSKU[] = $prop;
|
if ($prop['CODE'] !== '') {
|
||||||
|
$propertiesSKU[] = $prop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,7 +694,9 @@ class SettingsService
|
|||||||
$iblockResult = CIBlock::GetProperties($iblockId, [], ['MULTIPLE' => 'N']);
|
$iblockResult = CIBlock::GetProperties($iblockId, [], ['MULTIPLE' => 'N']);
|
||||||
|
|
||||||
while ($prop = $iblockResult->Fetch()) {
|
while ($prop = $iblockResult->Fetch()) {
|
||||||
$propertiesProduct[] = $prop;
|
if ($prop['CODE'] !== '') {
|
||||||
|
$propertiesProduct[] = $prop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $propertiesProduct;
|
return $propertiesProduct;
|
||||||
|
Loading…
Reference in New Issue
Block a user