Блог

30.09.2016

Товары из того же раздела (Битрикс)

Вывезти товары из того же раздела в компоненте catalog.element довольно просто. Всё, что нужно сделать это вставить в нужное место шаблона компонента код:
<? $GLOBALS['arrrFilter'] = array('!ID' => $arResult["ID"]); //это наш фильтр, который исключает товар, на странице которого мы находимся
$APPLICATION->IncludeComponent(
"bitrix:catalog.section", 
"", 
array(
"IBLOCK_TYPE" => "Catalog",
"IBLOCK_ID" => "2",
"SECTION_ID" => $arResult["IBLOCK_SECTION_ID"],
"SECTION_CODE" => "",
"SECTION_USER_FIELDS" => array(
0 => "",
1 => "",
),
"ELEMENT_SORT_FIELD" => "RAND",
"ELEMENT_SORT_ORDER" => "RAND",
"ELEMENT_SORT_FIELD2" => "RAND",
"ELEMENT_SORT_ORDER2" => "RAND",
"FILTER_NAME" => "arrrFilter",
"INCLUDE_SUBSECTIONS" => "Y",
"SHOW_ALL_WO_SECTION" => "Y",
"HIDE_NOT_AVAILABLE" => "N",
"PAGE_ELEMENT_COUNT" => "3",
"LINE_ELEMENT_COUNT" => "3",
"PROPERTY_CODE" => array(
0 => "",
1 => "",
),
"OFFERS_LIMIT" => "5",
"ADD_PICT_PROP" => "-",
"LABEL_PROP" => "-",
"PRODUCT_SUBSCRIPTION" => "N",
"SHOW_DISCOUNT_PERCENT" => "N",
"SHOW_OLD_PRICE" => "N",
"MESS_BTN_BUY" => "Купить",
"MESS_BTN_ADD_TO_BASKET" => "В корзину",
"MESS_BTN_SUBSCRIBE" => "Подписаться",
"MESS_BTN_DETAIL" => "Подробнее",
"MESS_NOT_AVAILABLE" => "Нет в наличии",
"SECTION_URL" => "/catalog/#SECTION_CODE#/",
"DETAIL_URL" => "/catalog/#SECTION_CODE#/#ELEMENT_CODE#/",
"BASKET_URL" => "/personal/cart/",
"ACTION_VARIABLE" => "action",
"PRODUCT_ID_VARIABLE" => "id",
"PRODUCT_QUANTITY_VARIABLE" => "quantity",
"PRODUCT_PROPS_VARIABLE" => "prop",
"SECTION_ID_VARIABLE" => "SECTION_ID",
"AJAX_MODE" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"AJAX_OPTION_HISTORY" => "N",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "36000000",
"CACHE_GROUPS" => "N",
"META_KEYWORDS" => "-",
"META_DESCRIPTION" => "-",
"BROWSER_TITLE" => "-",
"ADD_SECTIONS_CHAIN" => "N",
"DISPLAY_COMPARE" => "N",
"SET_TITLE" => "N",
"SET_STATUS_404" => "N",
"CACHE_FILTER" => "N",
"PRICE_CODE" => array(
0 => "PRICE_BASE",
),
"USE_PRICE_COUNT" => "N",
"SHOW_PRICE_COUNT" => "1",
"PRICE_VAT_INCLUDE" => "Y",
"PRODUCT_PROPERTIES" => array(
),
"USE_PRODUCT_QUANTITY" => "N",
"CONVERT_CURRENCY" => "N",
"PAGER_TEMPLATE" => "modern2",
"DISPLAY_TOP_PAGER" => "N",
"DISPLAY_BOTTOM_PAGER" => "N",
"PAGER_TITLE" => "Товары",
"PAGER_SHOW_ALWAYS" => "Y",
"PAGER_DESC_NUMBERING" => "N",
"PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
"PAGER_SHOW_ALL" => "N",
"AJAX_OPTION_ADDITIONAL" => "",
"TEMPLATE_THEME" => "blue",
"SET_META_KEYWORDS" => "N",
"SET_META_DESCRIPTION" => "N",
"ADD_PROPERTIES_TO_BASKET" => "Y",
"PARTIAL_PRODUCT_PROPERTIES" => "N"
),
false
);?>

Название: Товары из того же раздела (Битрикс)
Картинка для анонса: 
Детальное описание: Вывезти товары из того же раздела в компоненте catalog.element довольно просто. Всё, что нужно сделать это вставить в нужное место шаблона компонента код:
<? $GLOBALS['arrrFilter'] = array('!ID' => $arResult["ID"]); //это наш фильтр, который исключает товар, на странице которого мы находимся
$APPLICATION->IncludeComponent(
"bitrix:catalog.section", 
"", 
array(
"IBLOCK_TYPE" => "Catalog",
"IBLOCK_ID" => "2",
"SECTION_ID" => $arResult["IBLOCK_SECTION_ID"],
"SECTION_CODE" => "",
"SECTION_USER_FIELDS" => array(
0 => "",
1 => "",
),
"ELEMENT_SORT_FIELD" => "RAND",
"ELEMENT_SORT_ORDER" => "RAND",
"ELEMENT_SORT_FIELD2" => "RAND",
"ELEMENT_SORT_ORDER2" => "RAND",
"FILTER_NAME" => "arrrFilter",
"INCLUDE_SUBSECTIONS" => "Y",
"SHOW_ALL_WO_SECTION" => "Y",
"HIDE_NOT_AVAILABLE" => "N",
"PAGE_ELEMENT_COUNT" => "3",
"LINE_ELEMENT_COUNT" => "3",
"PROPERTY_CODE" => array(
0 => "",
1 => "",
),
"OFFERS_LIMIT" => "5",
"ADD_PICT_PROP" => "-",
"LABEL_PROP" => "-",
"PRODUCT_SUBSCRIPTION" => "N",
"SHOW_DISCOUNT_PERCENT" => "N",
"SHOW_OLD_PRICE" => "N",
"MESS_BTN_BUY" => "Купить",
"MESS_BTN_ADD_TO_BASKET" => "В корзину",
"MESS_BTN_SUBSCRIBE" => "Подписаться",
"MESS_BTN_DETAIL" => "Подробнее",
"MESS_NOT_AVAILABLE" => "Нет в наличии",
"SECTION_URL" => "/catalog/#SECTION_CODE#/",
"DETAIL_URL" => "/catalog/#SECTION_CODE#/#ELEMENT_CODE#/",
"BASKET_URL" => "/personal/cart/",
"ACTION_VARIABLE" => "action",
"PRODUCT_ID_VARIABLE" => "id",
"PRODUCT_QUANTITY_VARIABLE" => "quantity",
"PRODUCT_PROPS_VARIABLE" => "prop",
"SECTION_ID_VARIABLE" => "SECTION_ID",
"AJAX_MODE" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"AJAX_OPTION_HISTORY" => "N",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "36000000",
"CACHE_GROUPS" => "N",
"META_KEYWORDS" => "-",
"META_DESCRIPTION" => "-",
"BROWSER_TITLE" => "-",
"ADD_SECTIONS_CHAIN" => "N",
"DISPLAY_COMPARE" => "N",
"SET_TITLE" => "N",
"SET_STATUS_404" => "N",
"CACHE_FILTER" => "N",
"PRICE_CODE" => array(
0 => "PRICE_BASE",
),
"USE_PRICE_COUNT" => "N",
"SHOW_PRICE_COUNT" => "1",
"PRICE_VAT_INCLUDE" => "Y",
"PRODUCT_PROPERTIES" => array(
),
"USE_PRODUCT_QUANTITY" => "N",
"CONVERT_CURRENCY" => "N",
"PAGER_TEMPLATE" => "modern2",
"DISPLAY_TOP_PAGER" => "N",
"DISPLAY_BOTTOM_PAGER" => "N",
"PAGER_TITLE" => "Товары",
"PAGER_SHOW_ALWAYS" => "Y",
"PAGER_DESC_NUMBERING" => "N",
"PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
"PAGER_SHOW_ALL" => "N",
"AJAX_OPTION_ADDITIONAL" => "",
"TEMPLATE_THEME" => "blue",
"SET_META_KEYWORDS" => "N",
"SET_META_DESCRIPTION" => "N",
"ADD_PROPERTIES_TO_BASKET" => "Y",
"PARTIAL_PRODUCT_PROPERTIES" => "N"
),
false
);?>

Детальная картинка: 
Начало активности (дата): 30.09.2016 11:02:58
Дата создания: 30.09.2016 11:03:18
Кем создан (ID): 1
Кем создан (имя): (admin) Виталий Элс

Возврат к списку

Хотите посотрудничать? Contact Us

Подписаться на обновления

Согласен