The visibility of the private method : getFilterField causes a problem for us when displaying the price slider filter of elasticsuite.
When we called this method in the DecimalFilterTrait.php of elasticsuite catalog in _getItemsData() method to get items :
/**
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* Get data array for building attribute filter items
*
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _getItemsData()
{
$attribute = $this->getAttributeModel();
$this->_requestVar = $attribute->getAttributeCode();
/** @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $productCollection */
$productCollection = $this->getLayer()->getProductCollection();
$facets = $productCollection->getFacetedData($this->getFilterField());
The function calls a magic method and not the correct method because it is private :
Description
The visibility of the private method :
getFilterField
causes a problem for us when displaying the price slider filter of elasticsuite. When we called this method in theDecimalFilterTrait.php
of elasticsuite catalog in_getItemsData()
method to get items :The function calls a magic method and not the correct method because it is private :
And so, the method returns
null
and this causes the price slider not to display because there are 0 items.Solution
To fix this problem, we recommende to modify the visibility method as
protected
to be able to use it without problem.For all same methods in
module-elasticsuite-catalog
:to
The patch, we made to fix this issue is the following :