ltsecurityinc安防产品在线商城代码
This commit is contained in:
+68
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
|
||||
namespace Olegnax\LayeredNavigation\Helper;
|
||||
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use Olegnax\Core\Helper\Helper as CoreHelperHelper;
|
||||
|
||||
class Filter extends CoreHelperHelper
|
||||
{
|
||||
const CONFIG_MODULE = 'olegnax_layered_navigation';
|
||||
|
||||
public function isPriceSlider()
|
||||
{
|
||||
return $this->getModuleConfig('price_slider/price_slider');
|
||||
}
|
||||
|
||||
public function checkedFilter($item, $echoselected = ' checked')
|
||||
{
|
||||
$filter = $item->getFilter();
|
||||
$itemValue = $item->getValue();
|
||||
$itemValue = is_array($itemValue) ? implode('-', $itemValue) : $itemValue;
|
||||
$valueRequest = $this->getFilterValue($filter);
|
||||
if (is_array($valueRequest)) {
|
||||
$result = in_array($itemValue, $valueRequest);
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
if (!empty($echoselected)) {
|
||||
$result = $result ? $echoselected : '';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getFilterValue($filter, $explode = true)
|
||||
{
|
||||
$filterValue = $this->getRequest()->getParam($filter->getRequestVar());
|
||||
if (empty($filterValue)) {
|
||||
return [];
|
||||
}
|
||||
if ($explode) {
|
||||
$filterValue = explode(',', $filterValue);
|
||||
}
|
||||
|
||||
return $filterValue;
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->_loadObject(RequestInterface::class);
|
||||
}
|
||||
|
||||
public function getSelectedSlider($filter)
|
||||
{
|
||||
$filterValue = $this->getRequest()->getParam($filter->getRequestVar());
|
||||
if (empty($filterValue)) {
|
||||
return '';
|
||||
}
|
||||
return $filterValue;
|
||||
}
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Olegnax LayeredNavigation
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Olegnax.com license that is
|
||||
* available through the world-wide-web at this URL:
|
||||
* https://www.olegnax.com/license
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this extension to newer
|
||||
* version in the future.
|
||||
*
|
||||
* @category Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://www.olegnax.com/)
|
||||
* @license https://www.olegnax.com/license
|
||||
*/
|
||||
|
||||
namespace Olegnax\LayeredNavigation\Helper;
|
||||
|
||||
use Magento\CatalogSearch\Model\ResourceModel\EngineInterface;
|
||||
use Olegnax\Core\Helper\Helper as CoreHelperHelper;
|
||||
|
||||
class Helper extends CoreHelperHelper
|
||||
{
|
||||
|
||||
const CONFIG_MODULE = 'olegnax_layered_navigation';
|
||||
|
||||
protected $_currentEngine = '';
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->getModuleConfig('general/enable');
|
||||
|
||||
}
|
||||
|
||||
public function isPriceSlider()
|
||||
{
|
||||
return $this->getModuleConfig('price_slider/price_slider');
|
||||
|
||||
}
|
||||
|
||||
public function isElasticSearchEngine()
|
||||
{
|
||||
if (!$this->_currentEngine) {
|
||||
$this->_currentEngine = $this->getSystemValue(EngineInterface::CONFIG_ENGINE_PATH);
|
||||
}
|
||||
if ($this->_currentEngine == 'elasticsearch' || $this->_currentEngine == 'elasticsearch5') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function AjaxEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user