V
V
Vladislav Kopylov2015-10-29 18:17:37
1C-Bitrix
Vladislav Kopylov, 2015-10-29 18:17:37

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

3 answer(s)
V
Vladislav Kopylov, 2015-11-01
@kopylov_vlad

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"];
    }
  }
?>

S
Sergey, 2015-10-29
@Logic87

Component: bitrix:catalog.set.constructor
See how sets are displayed in it.

M
maximvp, 2015-12-12
@maximvp

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 question

Ask a Question

731 491 924 answers to any question