A
A
alexwprof2021-08-30 14:00:07
1C-Bitrix
alexwprof, 2021-08-30 14:00:07

How to add a variable like {=this.Name} to a regular Bitrix field?

There is a catalog element, it has an SEO tab. Variables of the type {=this.Name} {=this.catalog.price.BASE} are available in the fields of this tab. I am attaching a screenshot
:
612cb99971d12306568238.jpeg
If, for example, you set the variables in the "Details" tab in the same way, the
612cb9b7b6658542447139.jpeg
variables will not be substituted, they will be displayed simply as text.
How to make it possible to substitute such variables in the text "detailed"?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tgarl, 2021-08-30
@alexwprof

Variables on the SEO tab are not processed in the fields of other tabs. They are for the SEO tab only.
If you want to use them in detail, then you need to write your own handler for such variables in your template.
For example, you decide to use {=this.Name} in the detail field.
You need to do something like this

$arResult['DETAIL_TEXT']=str_replace('{=this.Name}', $arResult['NAME'], $arResult['DETAIL_TEXT']);

For the price, you need to get the desired price in the format you need and write a replacement in approximately the same way.
And so with all the variables you want to use

A
Alexander, 2021-08-30
@idruweb

replace in component template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question