3namespace Bitrix\Catalog\Controller\Product;
5use Bitrix\Catalog\Controller\ErrorCode;
6use Bitrix\Catalog\ProductTable;
14 private static array $parentProductCache = [];
39 $view = $this->getViewManager()->getView($this);
44 $this->addErrors(
$result->getErrors());
52 $skuPropertyId =
'PROPERTY_' .
$catalog[
'SKU_PROPERTY_ID'];
57 $this->addErrors(
$result->getErrors());
62 $parentId = (
$result->getData()[
'PARENT_ID']) ??
null;
63 $fields[$skuPropertyId] = $parentId;
64 if (
$fields[$skuPropertyId] ===
null)
75 if (isset(self::$parentProductCache[$id]))
77 return self::$parentProductCache[$id] !==
false ? self::$parentProductCache[$id] :
null;
80 self::$parentProductCache[$id] =
false;
81 $result = Producttable::getRow([
85 'IBLOCK_ID' =>
'IBLOCK_ELEMENT.IBLOCK_ID',
100 self::$parentProductCache[$id] =
$result;
107 $emptyParent = [
'PARENT_ID' =>
null];
110 if ($parentId ===
null)
112 $result->setData($emptyParent);
118 is_array($parentId) && isset($parentId[
'VALUE'])
119 ? (int)$parentId[
'VALUE']
124 $result->setData($emptyParent);
133 'Parent product not found.',
147 'Invalid parent product type.',
157 'Invalid information block of the parent product.',
164 $result->setData([
'PARENT_ID' => $row[
'ID']]);
const PRODUCT_OFFER_BAD_PARENT_TYPE
const PRODUCT_OFFER_PARENT_NOT_FOUND
const PRODUCT_OFFER_BAD_PARENT_IBLOCK_ID
prepareParentId(mixed $parentId, int $iblockId)
getParentProduct(int $id)
prepareFieldsForAdd(array $fields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)