- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/component/storeamount.php
- Класс: BitrixCatalogComponentStoreAmount
- Вызов: StoreAmount::getStoresCount
public function getStoresCount(): int
{
if (!isset($this->storesCount))
{
$filter = [
'=PRODUCT_ID' => $this->getVariationIds(),
[
'LOGIC' => 'OR',
'!=AMOUNT' => 0,
'!=QUANTITY_RESERVED' => 0,
],
'=STORE.ACTIVE' => 'Y',
];
$filter = array_merge(
$filter,
AccessController::getCurrent()->getEntityFilter(
ActionDictionary::ACTION_STORE_VIEW,
StoreProductTable::class
)
);
$this->storesCount = StoreProductTable::getList([
'select' => ['CNT'],
'filter' => $filter,
'runtime' => [
new BitrixMainEntityExpressionField('CNT', 'COUNT(DISTINCT(STORE_ID))')
],
])->fetch()['CNT'];
}
return $this->storesCount;
}