- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Product/BaseProduct.php
- Класс: BitrixCatalogv2ProductBaseProduct
- Вызов: BaseProduct::__construct
public function __construct(
IblockInfo $iblockInfo,
ProductRepositoryContract $productRepository,
PropertyRepositoryContract $propertyRepository,
ImageRepositoryContract $imageRepository,
SectionRepositoryContract $sectionRepository,
SkuRepositoryContract $skuRepository
)
{
parent::__construct($iblockInfo, $productRepository, $propertyRepository, $imageRepository);
$this->sectionRepository = $sectionRepository;
$this->skuRepository = $skuRepository;
$this->setIblockId($this->iblockInfo->getProductIblockId());
$this->setType($this->iblockInfo->canHaveSku() ? ProductTable::TYPE_SKU : ProductTable::TYPE_PRODUCT);
if (SystemFieldProductMapping::isAllowed())
{
$userField = SystemFieldProductMapping::load();
if (!empty($userField))
{
$value = (!empty($userField['SETTINGS']['DEFAULT_VALUE']) && is_array($userField['SETTINGS']['DEFAULT_VALUE'])
? $userField['SETTINGS']['DEFAULT_VALUE']
: null
);
if ($value === null)
{
/** @var SystemFieldTypeHighloadBlock $className */
$className = SystemFieldProductMapping::getTypeId();
$list = $className::getIdByXmlId(
$userField['SETTINGS']['HLBLOCK_ID'],
[SystemFieldProductMapping::MAP_LANDING]
);
if (isset($list[SystemFieldProductMapping::MAP_LANDING]))
{
$value = [
$list[SystemFieldProductMapping::MAP_LANDING],
];
}
}
if ($value !== null)
{
$this->setField($userField['FIELD_NAME'], $value);
}
}
}
}