S
S
sergeyviktorovich2021-01-20 14:21:46
1C-Bitrix
sergeyviktorovich, 2021-01-20 14:21:46

Why is catalog.set.constructor sometimes in catalog.element?

why catalog.element ind is catalog.set.constructor idn-set and is it possible to get rid of catalog.element and include directly catalog.set.constructor ?

<div class="row">
      <div class="col-xs-12">
        <?
        if ($haveOffers)
        {
          if ($arResult['OFFER_GROUP'])
          {
            foreach ($arResult['OFFER_GROUP_VALUES'] as $offerId)
            {
              ?>
              <span id="<?=$itemIds['OFFER_GROUP'].$offerId?>" style="display: none;">
                <?
                $APPLICATION->IncludeComponent(
                  'bitrix:catalog.set.constructor',
                  'idn-set',
                  array(
                    'CUSTOM_SITE_ID' => isset($arParams['CUSTOM_SITE_ID']) ? $arParams['CUSTOM_SITE_ID'] : null,
                    'IBLOCK_ID' => $arResult['OFFERS_IBLOCK'],
                    'ELEMENT_ID' => $offerId,
                    'PRICE_CODE' => $arParams['PRICE_CODE'],
                    'BASKET_URL' => $arParams['BASKET_URL'],
                    'OFFERS_CART_PROPERTIES' => $arParams['OFFERS_CART_PROPERTIES'],
                    'CACHE_TYPE' => $arParams['CACHE_TYPE'],
                    'CACHE_TIME' => $arParams['CACHE_TIME'],
                    'CACHE_GROUPS' => $arParams['CACHE_GROUPS'],
                    'TEMPLATE_THEME' => $arParams['~TEMPLATE_THEME'],
                    'CONVERT_CURRENCY' => $arParams['CONVERT_CURRENCY'],
                    'CURRENCY_ID' => $arParams['CURRENCY_ID'],
                    'DETAIL_PICTURE_SRC' => $arResult["DETAIL_PICTURE"]["SRC"],
                    'PROPERTIES_WEIGHT_VALUE' => $arResult["PROPERTIES"]["WEIGHT"]["VALUE"],
                    'PROPERTIES_ANKERS_VALUE' => $arResult["PROPERTIES"]["ANKERS"]["VALUE"],
                    'PROPERTIES_DISCOUNT1_VALUE' => $arResult["PROPERTIES"]["DISCOUNT1"]["VALUE"],
                    'PROPERTIES_DISCOUNT_STAR_VALUE' => $arResult["PROPERTIES"]["DISCOUNT_STAR"]["VALUE"],
                    'PROPERTIES_VOLUME_VALUE' => $arResult["PROPERTIES"]["VOLUME"]["VALUE"],
                    'PROPERTIES_LENGTH_VALUE' => $arResult["PROPERTIES"]["LENGTH"]["VALUE"],
                    'PROPERTIES_MATERIAL_VALUE' => $arResult["PROPERTIES"]["MATERIAL"]["VALUE"],
                    'PROPERTIES_MORE_PHOTO_VALUE' => $arResult["PROPERTIES"]["MORE_PHOTO"]["VALUE"],
                    'PROPERTIES_MORE_PHOTO_MOB_VALUE' => $arResult["PROPERTIES"]["MORE_PHOTO_MOB"]["VALUE"]
                  ),
                  $component,
                  array('HIDE_ICONS' => 'Y')
                );
                ?>
              </span>
              <?
            }
          }
        }
        else
        {
          if ($arResult['MODULES']['catalog'] && $arResult['OFFER_GROUP'])
          {
            $APPLICATION->IncludeComponent(
              'bitrix:catalog.set.constructor',
              'idn-set',
              array(
                'CUSTOM_SITE_ID' => isset($arParams['CUSTOM_SITE_ID']) ? $arParams['CUSTOM_SITE_ID'] : null,
                'IBLOCK_ID' => $arParams['IBLOCK_ID'],
                'ELEMENT_ID' => $arResult['ID'],
                'PRICE_CODE' => $arParams['PRICE_CODE'],
                'BASKET_URL' => $arParams['BASKET_URL'],
                'CACHE_TYPE' => $arParams['CACHE_TYPE'],
                'CACHE_TIME' => $arParams['CACHE_TIME'],
                'CACHE_GROUPS' => $arParams['CACHE_GROUPS'],
                'TEMPLATE_THEME' => $arParams['~TEMPLATE_THEME'],
                'CONVERT_CURRENCY' => $arParams['CONVERT_CURRENCY'],
                'CURRENCY_ID' => $arParams['CURRENCY_ID'],
                'DETAIL_PICTURE_SRC' => $arResult["DETAIL_PICTURE"]["SRC"],
                'PROPERTIES_WEIGHT_VALUE' => $arResult["PROPERTIES"]["WEIGHT"]["VALUE"],
                'PROPERTIES_ANKERS_VALUE' => $arResult["PROPERTIES"]["ANKERS"]["VALUE"],
                'PROPERTIES_DISCOUNT1_VALUE' => $arResult["PROPERTIES"]["DISCOUNT1"]["VALUE"],
                'PROPERTIES_DISCOUNT_STAR_VALUE' => $arResult["PROPERTIES"]["DISCOUNT_STAR"]["VALUE"],
                'PROPERTIES_VOLUME_VALUE' => $arResult["PROPERTIES"]["VOLUME"]["VALUE"],
                'PROPERTIES_LENGTH_VALUE' => $arResult["PROPERTIES"]["LENGTH"]["VALUE"],
                'PROPERTIES_MATERIAL_VALUE' => $arResult["PROPERTIES"]["MATERIAL"]["VALUE"],
                'PROPERTIES_MORE_PHOTO_VALUE' => $arResult["PROPERTIES"]["MORE_PHOTO"]["VALUE"],
                'PROPERTIES_MORE_PHOTO_MOB_VALUE' => $arResult["PROPERTIES"]["MORE_PHOTO_MOB"]["VALUE"]
              ),
              $component,
              array('HIDE_ICONS' => 'Y')
            );
          }
        }
        ?>
      </div>
    </div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karpov, 2021-01-20
@Inkognitoss

If you pass the necessary parameters to the component, then in theory it will work anywhere.

A
Andrey Nikolaev, 2021-01-20
@gromdron

There are some components that implement a whole layer of large additional logic or display.
If the template of such an element requires that the template of another element be tailored specifically for the use of this component and does not work outside the scope of its use, then it makes no sense to put it into general templates.
I couldn't come up with a simpler one, but there is an example: suppose there are 2 components A and B with .default templates. Both components can be used independently of each other.
However, at some point in template A, it was necessary to modify template B in a certain place for a certain task. This template is called special_a.
So, using component B with the special_a template outside of component B does not make sense, since the special_a template uses parts of the template of component A and it simply does not make sense to store it separately.
Is it possible to take out such a template from a template? Yes, you can. However, such an action has no practical meaning.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question