- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/helpers/admin/skuprops.php
- Класс: BitrixSaleHelpersAdminto
- Вызов: to::getSkuPropValues
static function getSkuPropValues($propId, $currentValue, array &$offersIds)
{
if(!Loader::includeModule('iblock'))
return array();
$result = array();
$foundElements = array();
$res = CIBlockElement::GetList(
array("SORT"=>"ASC"),
array(
'ID' => $offersIds,
'!=PROPERTY_'.$propId => false
),
false,
false,
array('ID', 'PROPERTY_'.$propId)
);
while($el = $res->Fetch())
{
if(isset($el['PROPERTY_'.$propId.'_ENUM_ID']))
$value = $el['PROPERTY_'.$propId.'_ENUM_ID'];
else
$value = $el['PROPERTY_'.$propId.'_VALUE'];
if(!in_array($value, $result))
$result[] = $value;
$foundElements[] = $el['ID'];
if($value != $currentValue)
{
$key = array_search($el['ID'], $offersIds);
if($key !== false)
unset($offersIds[$key]);
}
}
$foundElements = array_unique($foundElements, SORT_NUMERIC);
$valueLess = array_diff($offersIds, $foundElements);
if(!empty($valueLess))
{
if(!empty($result))
$result[] = '-';
if($currentValue != '-')
$offersIds = array_diff($offersIds, $valueLess);
}
return $result;
}