Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5325 Modified criteria builder to include visibility filter #144

Merged
merged 2 commits into from
Dec 5, 2022

Conversation

denisprotassoff
Copy link
Contributor

@denisprotassoff denisprotassoff commented Nov 30, 2022

Fixes 5325.

Issue:
If product visibility is set to Catalog only, it is still displayed in search results.

In this PR:
Modified search criteria builder to add visibility filters to search queries.

/**
* @var ScopeConfigInterface
*/
private $scopeConfig;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make all properties as protected. Otherwise on extending class it will be required to define properties again.

* @param bool $isSearch
* @param bool $isFilter
*/
private function addVisibilityFilter(SearchCriteriaInterface $searchCriteria, bool $isSearch): void

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make protected, same case

Comment on lines 167 to 168
);
if ($priceRangeCalculation) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before block

Comment on lines 208 to 209
$defaultSortOrder = [];
if ($isSearch) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines 215 to 216
$categoryIdFilter = isset($args['filter']['category_id']) ? $args['filter']['category_id'] : false;
if ($categoryIdFilter) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

Comment on lines 240 to 241
$filterGroups = $searchCriteria->getFilterGroups();
foreach ($filterGroups as $filterGroup) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here and so on

Comment on lines 102 to 103
}
$searchCriteria->setRequestName($requestName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after block if scope is not closed after it.

@@ -0,0 +1,250 @@
<?php

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment in code on which lines are actually changed from original class.

@AleksandrsKondratjevs AleksandrsKondratjevs merged commit f277964 into scandipwa:master Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Not correct behavior of products visibility
2 participants