P
P
Prog-Time2021-03-04 15:57:05
1C-Bitrix
Prog-Time, 2021-03-04 15:57:05

How can I create a field in a catalog category that will store the number of active items?

Can you tell me how to create a field in an infoblock, in a category, that will store the number of active elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2021-03-04
@winer

Create a custom field of the Number type (you can do it directly from the admin panel on the tab of the Additional fields section).
Then this field must be filled in somehow. Can be done using event handlers:
OnAfterIBlockElementAdd
OnAfterIBlockElementDelete
OnAfterIBlockElementUpdate
On them, count the number of elements in the section and write this value to the custom field

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question