How to correctly calculate the active goods in Bitrix (not counting deactivated)?

In my case, 1 product is deactivated, and the second is active, but it shows that there are 2 products (must be 1). How to fix it?

The code looks like this: <? echo $arSection['ELEMENT_CNT']; ?> <? echo $arSection['ELEMENT_CNT']; ?> <? echo $arSection['ELEMENT_CNT']; ?> product.

Bitrix Version 16.0.9

    1 answer 1

    Use the standard bitrix: catalog component

     $cAllItems = $arResult['NAV_RESULT']; $cAllItems = $cAllItems -> NavRecordCount; echo $cAllItems;