Open
Description
Preconditions and environment
- 2.4.6-p11
- Magento 2 EE
Steps to reproduce
- Create a product collection using a productCollectionFactory
- Create Multiple Filters Using filterBuilder on different product attributes
- Create a filter group using a filterGroupBuilder and the previously created filters.
- Create a Search Criteria using SearchCriteriaBuilder with the previously created group of filters.
- Use the FilterProcessor Class and the process function to filter this collection using the search Criteria
- It will fail
{
$filters = [];
$data = "black"
$filters[] = $this->filterBuilder
->setField('description')
->setValue($data)
->setConditionType('eq')
->create();
$filters[] = $this->filterBuilder
->setField('color')
->setValue($data)
->setConditionType('eq')
->create();
$filters[] = $this->filterBuilder
->setField('country_of_manufacture')
->setValue($data)
->setConditionType('eq')
->create();
// Create a filter group with OR logic
$filterGroup = $this->filterGroupBuilder
->setFilters($filters)
->create();
// Build search criteria
$searchCriteria = $this->searchCriteriaBuilder
->setFilterGroups([$filterGroup])
->create();
$this->collection = $this->productCollectionFactory->create();
$this->collection->addAttributeToSelect('*');
// Apply the search criteria to the collection
$this->filterProcessor->process($searchCriteria, $this->collection);
$this->collection->load();
return $this->collection->getFirstItem();
}
Expected result
Get the products from the collection with the correct filters.
Actual result
Cannot access offset of type string on string at /var/www/src/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php:373
It seems that in the addAttributeToFilter function from module eav the condition parameter from the function is never used and actually replaced by the attribute array passed in the function.
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Ready for Confirmation