_storeManager = $storeManager;
$this->pageConfig = $pageConfig;
parent::__construct($context);
$this->_storeId = $this->getCurrentStoreId();
}
/**
* Return current store_id
*
* @return int
*/
public function getCurrentStoreId()
{
return $this->_storeManager->getStore()->getId();
}
/**
* @param int $storeId
* @return mixed
*/
public function isEnabled($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/general/enable', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param int $storeId
* @return mixed
*/
public function isAjaxEnabled($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/general/ajax', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param int $storeId
* @return mixed
*/
public function showCategoriesBlock($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/sidebar/category_block', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param int $storeId
* @return mixed
*/
public function showCompareBlock($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/sidebar/compare_block', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param int $storeId
* @return mixed
*/
public function showWishlistBlock($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/sidebar/wishlist_block', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param int $storeId
* @return mixed
*/
public function showRecentlyOrderedBlock($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/sidebar/recentlyordered_block', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* @param null $storeId
* @return mixed
*/
public function getFilterButton($storeId = null)
{
return $this->scopeConfig->getValue('weltpixel_layerednavigation/sidebar/filter_button', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
/**
* Filter Button option
* 0-icon only
* 1-icon & label
* 2-label only
*
* @return \Magento\Framework\Phrase|string
*/
public function getFilterButtonStyle()
{
switch ($this->getFilterButton()) {
case 0:
$filterButtonHtml = "";
break;
case 1:
$filterButtonHtml = "" . /* @escapeNotVerified */
__(self::FILTER_BUTTON_LABEL) . "";
break;
case 2:
$filterButtonHtml = __(self::FILTER_BUTTON_LABEL);
break;
default:
$filterButtonHtml = '';
}
return $filterButtonHtml;
}
/**
* Check the engine provider is 'elasticsearch'
* @deprecated
*
* @return bool
*/
public function isElasticSearchEngine()
{
if (!$this->_currentEngine) {
$this->_currentEngine = $this->scopeConfig->getValue(EngineInterface::CONFIG_ENGINE_PATH, ScopeInterface::SCOPE_STORE);
}
if($this->_currentEngine == 'elasticsearch' || $this->_currentEngine == 'elasticsearch5'
|| $this->_currentEngine == 'elasticsearch6' || $this->_currentEngine == 'elasticsearch7' ) {
return true;
}
return false;
}
/**
* Check the engine provider is 'elasticsearch' or 'opensearch'
* @deprecated
*
* @return bool
*/
public function isElasticOrOpenSearchEngine()
{
if (!$this->_currentEngine) {
$this->_currentEngine = $this->scopeConfig->getValue(EngineInterface::CONFIG_ENGINE_PATH, ScopeInterface::SCOPE_STORE);
}
if($this->_currentEngine == 'elasticsearch' || $this->_currentEngine == 'elasticsearch5'
|| $this->_currentEngine == 'elasticsearch6' || $this->_currentEngine == 'elasticsearch7' || $this->_currentEngine == 'opensearch' ) {
return true;
}
return false;
}
}