/** * Retrieve inactive category item ids * * @param Collection $collection * @param int $storeId * @return array */ protected function _getInactiveItemIds($collection, $storeId) { $linkField = $this->metadataPool->getMetadata(CategoryInterface::class)->getLinkField(); $intTable = $this->_coreResource->getTableName('catalog_category_entity_int'); $select = $collection->getAllIdsSql()->joinInner(['d' => $intTable], "e.{$linkField} = d.{$linkField}", [])->joinLeft(['c' => $intTable], "c.attribute_id = :attribute_id AND c.store_id = :store_id AND c.{$linkField} = d.{$linkField}", [])->where('d.attribute_id = :attribute_id')->where('d.store_id = :zero_store_id')->where($this->_conn->getCheckSql('c.value_id > 0', 'c.value', 'd.value') . ' = :cond'); return $this->_conn->fetchCol($select, ['attribute_id' => $this->_catalogCategory->getIsActiveAttributeId(), 'store_id' => $storeId, 'zero_store_id' => 0, 'cond' => 0]); }