/** * {@inheritdoc} */ public function prepareProductCollection($collection) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'prepareProductCollection'); if (!$pluginInfo) { return parent::prepareProductCollection($collection); } else { return $this->___callPlugins('prepareProductCollection', func_get_args(), $pluginInfo); } }
/** * Retrieve child categories of current category * * @return \Magento\Framework\Data\Tree\Node\Collection */ public function getCurrentChildCategories() { $categories = $this->_catalogLayer->getCurrentCategory()->getChildrenCategories(); /** @var \Magento\Catalog\Model\Resource\Product\Collection $productCollection */ $productCollection = $this->_productCollectionFactory->create(); $this->_catalogLayer->prepareProductCollection($productCollection); $productCollection->addCountToCategories($categories); return $categories; }