Smile\ElasticsuiteCatalog\Helper\Autocomplete::isShowOutOfStock PHP Method

isShowOutOfStock() public method

Check if Stock configuration allows to display out of stock products
public isShowOutOfStock ( integer $storeId = null ) : boolean
$storeId integer The store Id. Will use current store if null.
return boolean
    public function isShowOutOfStock($storeId = null)
    {
        return $this->stockConfiguration->isShowOutOfStock($storeId);
    }

Usage Example

Example #1
0
 /**
  * Init suggested products collection.
  * Returns null if no suggested search terms.
  *
  * @return \Smile\ElasticsuiteCatalog\Model\Autocomplete\Product
  */
 private function prepareProductCollection()
 {
     $terms = $this->getQueryText();
     $this->productCollection->addSearchFilter($terms);
     $this->productCollection->setPageSize($this->getResultsPageSize());
     $this->productCollection->addAttributeToSelect('name')->addAttributeToSelect('thumbnail')->addPriceData();
     if (!$this->configurationHelper->isShowOutOfStock()) {
         $this->productCollection->addIsInStockFilter();
     }
     return $this;
 }