Answer the question
In order to leave comments, you need to log in
How to add pictures to the Bitrix menu?
There is a lot of information on this issue, but outdated. The essence is below
It is necessary to add pictures in the menu of the online store catalog, which is formed from the ext.php file, which I set for each category in the admin panel through the catalog infoblock
Code of my ext.php menu
<?
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" => "1c_catalog",
"IBLOCK_ID" => "5",
"DEPTH_LEVEL" => "3",
"CACHE_TYPE" => "A",
"CACHE_TIME" => "3600",
),
false
);
$aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
?>
$strImg = '';
if(intval($arItem["PARAMS"]["PICTURE"])>0 && $arItem["DEPTH_LEVEL"]==1){
$img = CFile::ResizeImageGet($arItem["PARAMS"]["PICTURE"], array('width'=>30, 'height'=>30),
BX_RESIZE_IMAGE_PROPORTIONAL, false);
$strImg = '<img alt="" src="'.$img['src'].'" />';
}
Answer the question
In order to leave comments, you need to log in
All data processing manipulations and changing (adding data) of the resulting menu array should be done in the result_modifier.php file
https://dev.1c-bitrix.ru/learning/course/index.php...
https://dev.1c -bitrix.ru/learning/course/index.php... For an
example of result_modifier.php for your task with pictures for each category, see the catalog_horizontal menu template, there is just a solution to questions with pictures and descriptions of categories. You can modify, I remember modifying pictures up to 4 levels of nesting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question