Answer the question
In order to leave comments, you need to log in
How to display icons of catalog menu items?
Good day everyone!
Happy Defender's Day everyone!
The question is. My catalog menu items are displayed automatically, i.e. the names of sections of the catalog itself are taken:
.catalog.menu.php .catalog.menu_ext.phpArray();
$aMenuLinks =
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
global $APPLICATION;
$aMenuLinksExt=$APPLICATION->IncludeComponent("bitrix:menu.sections", "", array(
"IS_SEF" => "Y",
"SEF_BASE_URL" => "/catalog/",
"SECTION_PAGE_URL" => "#SECTION_CODE#/",
"DETAIL_PAGE_URL" => "#SECTION_CODE#/#ELEMENT_CODE#",
"IBLOCK_TYPE" => "catalog",
"IBLOCK_ID" => "14", // ID - id вашего инфоблока
"DEPTH_LEVEL" => "4",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "0",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "3600"
),
false
);
$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
?>
<?
$APPLICATION->IncludeComponent(
"bitrix:menu",
"menucat",
array(
"ROOT_MENU_TYPE" => "catalog",
"MENU_CACHE_TYPE" => "N",
"MENU_CACHE_TIME" => "3600",
"MENU_CACHE_USE_GROUPS" => "Y",
"MENU_CACHE_GET_VARS" => array(
),
"MAX_LEVEL" => "4",
"CHILD_MENU_TYPE" => "catalog",
"USE_EXT" => "Y",
"DELAY" => "N",
"ALLOW_MULTI_SELECT" => "Y",
"COMPONENT_TEMPLATE" => "menucat"
),
false
);
?>
<?
$aMenuLinks = Array(
Array(
"Каталог товаров",
"/shop/catalog/",
Array(),
Array(),
"false"
),
Array(
"Ремонт и сервис",
"/service/",
Array(),
Array(),
""
),
и тд
?>
Answer the question
In order to leave comments, you need to log in
It seemed clear enough to me.
1) Copy the bitrix:menu.sections component to its own namespace.
2) We make changes to the copied component
2.1) Approximately on line 45 in CIBlockSection::GetList we add an image to select and in the while block we check - if there is an image - we get its url, if not - we prescribe the url to the load
2.2) approximately on line 128 , to block:
$aMenuLinksNew[$menuIndex++] = array(
htmlspecialcharsbx($arSection["~NAME"]),
$arSection["~SECTION_PAGE_URL"],
$arResult["ELEMENT_LINKS"][$arSection["ID"]],
array(
"FROM_IBLOCK" => true,
"IS_PARENT" => false,
"DEPTH_LEVEL" => $arSection["DEPTH_LEVEL"],
),
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question