fix: Only retrieve attributes from filter template when filter template is selected#60
Open
jansentjeu wants to merge 3 commits into
Open
fix: Only retrieve attributes from filter template when filter template is selected#60jansentjeu wants to merge 3 commits into
jansentjeu wants to merge 3 commits into
Conversation
bramstroker
requested changes
May 16, 2026
ahuininga-orisha
requested changes
May 21, 2026
| } | ||
|
|
||
| foreach ($result as $filterTemplateAttribute) { | ||
| if (!isset($allAttributes[$filterTemplateAttribute['AttributeId']])) { |
Collaborator
There was a problem hiding this comment.
$allAttributes is conditionally defined but unconditionally accessed, it may not be initialised
|
|
||
| $attributes = []; | ||
| try { | ||
| $response = $this->doRequest(sprintf('filtertemplate/%s/attribute', $filterTemplate), $store); |
Collaborator
There was a problem hiding this comment.
filterTemplate can be null but is used directly in sprintf.
The method should either require a non-null int or add an early guard:
if ($filterTemplate === null) {
return [];
}
| private function executeBackendApiRequest(Store $store): array | ||
| { | ||
| $filterTemplate = $this->request->getParam('filter_template') ? | ||
| (int)$this->request->getParam('filter_template') : |
Collaborator
There was a problem hiding this comment.
This calls getParam() twice. Prefer a single assignment:
$rawFilterTemplate = $this->request->getParam('filter_template');
$filterTemplate = $rawFilterTemplate !== null && $rawFilterTemplate !== '' ? (int)$rawFilterTemplate : null;
ahuininga-orisha
requested changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, all attributes are retrieved via the backend API in the attribute landing pages admin functionality. This should be based on the selected filter template.
Customers select filters that are not included in the filter template, causing landing pages to break.
With this fix, only all filters from the selected filter template are retrieved.