M
M
malayamarisha2020-06-29 08:44:23
1C-Bitrix
malayamarisha, 2020-06-29 08:44:23

How to add custom parameter to catalog.element?

Good day!
You need to add your own parameter to catalog.element.
In the catalog component, I add my own parameter to the .parameters.php file

"DISCOUNT_FOR_RECRUITMENT" => Array(
            "PARENT" => "DETAIL_SETTINGS",
            "NAME" => 'Размер скидки для набора %',
            //"VALUE" => '20',
            "TYPE" => "STRING",
            "DEFAULT" => "20",
        ),

In the settings of the catalog component, this parameter is displayed in the "Detailed view settings" section.
But in .result_modifier.php catalog.element in $arParams there is no this parameter. Tell me
, please, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
PetrPo, 2020-06-29
@malayamarisha

.parameters.php and is needed in order to see the parameters through a visual editor for ease of administration, but the component itself gets the parameters that are passed to the component call (method). Those. it is necessary
- either to resave the component through the visual editor
- or manually add the name and value of the parameter to the component call code.
If the component is complex, then the parameter must be passed to the simple component call code

"DISCOUNT_FOR_RECRUITMENT" => $arParams["DISCOUNT_FOR_RECRUITMENT"]

M
malayamarisha, 2020-06-29
@malayamarisha


It is necessary to write in /aspro_next/components/bitrix/catalog/main/page_blocks/element_5.php

"DISCOUNT_FOR_RECRUITMENT" => $arParams['DISCOUNT_FOR_RECRUITMENT'],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question