Answer the question
In order to leave comments, you need to log in
Where is the error in displaying catalog elements through catalog.section and catalog.element?
Hello. It is necessary to display the elements of the catalog.
Structure: Infoblock -> Infoblock elements IS
settings:
Information block page URL: /podobrat-dver/
Detailed view page URL: /podobrat-dver/#ELEMENT_CODE#/
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
"catalog_list",
array(
....
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_CODE" => $_REQUEST["SECTION_CODE"],
"SECTION_ID" => "",
"SECTION_ID_VARIABLE" => "ELEMENT_CODE",
"SECTION_URL" => "",
"SHOW_ALL_WO_SECTION" => "Y",
....
),
false
);?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.element",
"detail",
array(
.....
"IBLOCK_ID" => "30",
"ELEMENT_ID" => "",
"ELEMENT_CODE" => $_REQUEST["ELEMENT_CODE"],
"SECTION_ID" => "",
"SECTION_CODE" => $_REQUEST["SECTION_CODE"],
"SECTION_URL" => "",
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_ID_VARIABLE" => "ELEMENT_CODE",
"SECTION_CODE_PATH" => ""
.....
),
false
);?>
"CONDITION" => "#^/podobrat-dver/([a-z0-9\-]+)/(\?.*|)$#",
"RULE" => "CODE=$1",
"ID" => "",
"PATH" => "/podobrat-dver/detail.php",
Answer the question
In order to leave comments, you need to log in
bitrix:catalog.element - displays a product card
bitrix:catalog.section - section content.
Accordingly, you should have two rules in urlrewrite.php
// Для элемента
array(
"CONDITION" => "#^/podobrat-dver/([a-z0-9\-]+)/([^/\?]*)(.*)$#",
"RULE" => "SECION_CODE=\$1&ELEMENT_CODE=\$2&$3",
"PATH" => "/podobrat-dver/detail.php",
)
// Для раздела
array(
"CONDITION" => "#^/podobrat-dver/([a-z0-9\-]+)/(.*)$#",
"RULE" => "SECION_CODE=$1&$2",
"PATH" => "/podobrat-dver/section.php",
)
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.element",
"detail",
array(
.....
"IBLOCK_ID" => "30",
"ELEMENT_ID" => "",
"ELEMENT_CODE" => $_REQUEST["ELEMENT_CODE"],
"SECTION_ID" => "",
"SECTION_CODE" => $_REQUEST["SECION_CODE"],
"SECTION_URL" => "",
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_ID_VARIABLE" => "ELEMENT_CODE",
"SECTION_CODE_PATH" => ""
.....
),
false
);?>
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.section",
"catalog_list",
array(
....
"DETAIL_URL" => "/podobrat-dver/#ELEMENT_CODE#/",
"SECTION_CODE" => $_REQUEST["SECTION_CODE"],
"SECTION_ID" => "",
"SECTION_URL" => "",
"SHOW_ALL_WO_SECTION" => "Y",
....
),
false
);?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question