This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,62 @@
<?php
/**
* @category WeltPixel
* @package WeltPixel_LayeredNavigation
* @copyright Copyright (c) 2018 Weltpixel
* @author Weltpixel TEAM
*/
namespace WeltPixel\LayeredNavigation\Plugin\Layer;
use WeltPixel\LayeredNavigation\Helper\Data;
/**
* Class FilterList
* @package WeltPixel\LayeredNavigation\Plugin\Layer
*/
class FilterList
{
/**
* @var \WeltPixel\LayeredNavigation\Helper\Data
*/
protected $_wpHelper;
/**
* FilterList constructor.
* @param Data $wpHelper
*/
public function __construct(
Data $wpHelper
)
{
$this->_wpHelper = $wpHelper;
}
/**
* Remove category filter if disabled in configuration
*
* @param \Magento\Catalog\Model\Layer\FilterList $subject
* @param $result
* @return array
*/
public function afterGetFilters(\Magento\Catalog\Model\Layer\FilterList $subject, $result)
{
if(!$this->_wpHelper->isEnabled()){
return $result;
}
$filteredResult = [];
if(!$this->_wpHelper->showCategoriesBlock()) {
foreach($result as $r) {
if($r->getRequestVar() != 'cat') {
$filteredResult[] = $r;
}
}
return $filteredResult;
} else {
return $result;
}
}
}