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

Fixed null parameter warning in Mage_Catalog_Model_Layer_Filter_Attribute #3926

Merged
merged 2 commits into from
Apr 6, 2024
Merged

Fixed null parameter warning in Mage_Catalog_Model_Layer_Filter_Attribute #3926

merged 2 commits into from
Apr 6, 2024

Conversation

fballiano
Copy link
Contributor

Fixes #3925

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Apr 6, 2024

Nope it didn't work for me for a URL of the type

/mobile-phones?core_count=41&gdiktia=168&nfcsosto=376&ram=50%2C54

or
/mobile-phones?core_count=41&gdiktia=168&nfcsosto=376&ram=50,54

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Apr 6, 2024

That's because _getOptionText returns false and the operator doesn't affect it

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Apr 6, 2024

How about this ? It should cover null and false and empty values

        $text = $this->_getOptionText($filter);
        if ($filter && !empty($text)) {
            $this->_getResource()->applyFilterToCollection($this, $filter);
            $this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
            $this->_items = [];
        }

@fballiano
Copy link
Contributor Author

right, can you check this new version?

it seems to me that $text really needs to be a string for:
$this->getLayer()->getState()->addFilter($this->_createItem($text, $filter));
to work

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Apr 6, 2024

That also works

@fballiano
Copy link
Contributor Author

if you confirm me that it works I'll merge it right away and release a 20.6

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Apr 6, 2024

Yeah I already checked it, it didn't throw the error.

@fballiano
Copy link
Contributor Author

let's consider this as a review and merge it

@fballiano fballiano merged commit deced22 into OpenMage:main Apr 6, 2024
17 checks passed
@fballiano fballiano deleted the issue3925 branch April 6, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Relates to Mage_Catalog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP Error in frontend with improper request params
2 participants