Answer the question
In order to leave comments, you need to log in
How, knowing the product ID, display the ID of all sets in which this product is located?
The site has products and kits of products. On the product card page, you need to display the kit in which this product is located. How to do this knowing the product ID?
Answer the question
In order to leave comments, you need to log in
If anyone is interested, here is the code:
<?
//имея id товара получить id комплекта в котором есть этот товар
Cmodule::IncludeMOdule('catalog');
$rsElem = CCatalogProductSet::getList(
array(),
array('TYPE' => CCatalogProductSet::TYPE_SET, 'ITEM_ID' => $ElementID),
false,
false,
array('SET_ID', 'OWNER_ID', 'ITEM_ID')
);
while ( $set = $rsElem->Fetch() ){
echo $set['OWNER_ID'];
}
?>
<?
//по id комплекта берем id элементов
Cmodule::IncludeMOdule('catalog');
$arSets = CCatalogProductSet::getList(
array(), array( "TYPE" => 1, "OWNER_ID" => $set["OWNER_ID"] ), false, false, array()
);
while( $set2 = $arSets->Fetch() ){
if( $set2["OWNER_ID"]!=$set2["ITEM_ID"] ){
echo $set2["ITEM_ID"];
}
}
?>
Component: bitrix:catalog.set.constructor
See how sets are displayed in it.
Gentlemen "junker" bitrix:catalog.set.constructor at the moment displays only sets, sets by regular means (and generally according to Bitrix developers, creators of 1C-Bitrix) are not displayed in the visual part, but are used purely for internal inventory control, see the result is possible only when placing an order, after the appropriate settings
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question