/** * Load some inventory configuration settings * * @return void */ protected function _initConfig() { if (!$this->_isConfig) { $configMap = ['_isConfigManageStock' => \Magento\CatalogInventory\Model\Configuration::XML_PATH_MANAGE_STOCK, '_isConfigBackorders' => \Magento\CatalogInventory\Model\Configuration::XML_PATH_BACKORDERS, '_configMinQty' => \Magento\CatalogInventory\Model\Configuration::XML_PATH_MIN_QTY, '_configNotifyStockQty' => \Magento\CatalogInventory\Model\Configuration::XML_PATH_NOTIFY_STOCK_QTY]; foreach ($configMap as $field => $const) { $this->{$field} = (int) $this->_scopeConfig->getValue($const, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } $this->_isConfig = true; $this->_configTypeIds = array_keys($this->stockConfiguration->getIsQtyTypeIds(true)); } }
/** * Add filter by product types from config - only types which have QTY parameter * * @return $this */ public function filterByIsQtyProductTypes() { $this->filterByProductType(array_keys(array_filter($this->stockConfiguration->getIsQtyTypeIds()))); return $this; }