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

Selected filter with a special html character can't be removed #1978

Closed
Melleschepers opened this issue Oct 30, 2020 · 2 comments
Closed

Selected filter with a special html character can't be removed #1978

Melleschepers opened this issue Oct 30, 2020 · 2 comments
Assignees
Labels

Comments

@Melleschepers
Copy link

Melleschepers commented Oct 30, 2020

Preconditions

Magento Version : CE

ElasticSuite Version : 2.9.3

Environment : Developer / Production

Steps to reproduce

  1. Give an attribute (for example 'material') an option with a name with an special character, like "Polyester & Nylon" or "Polyester's"
  2. Apply 2 filters on a category page (one of them need to be the option with the special character). So for example apply the filters: (material = "Polyester & Nylon) & (material = Cotton).
  3. Remove the filter with the special character. So remove the material = "Polyester & Nylon" filter.

Expected result

  1. The filter with the special character is no longer applied. So only the material = Cotton filter is applied

Actual result

  1. Both filters stay applied. (material = Polyester & Nylon) & (material = Cotton).

Cause

When comparing the arrays (

$resetValue = array_diff($this->getApplyValue(), [$this->getLabel()]);
)

.. special characters in $this->getLabel() are converted to html entities. In the function $this->getApplyValue() the special characters are not converted. So comparing them doesn't work.. And so it doesn't give the right "remove url".

@rbayet rbayet self-assigned this Nov 13, 2020
@rbayet rbayet added the bug label Nov 13, 2020
@rbayet
Copy link
Collaborator

rbayet commented Nov 17, 2020

It's logically no longer necessary to escape the label for the layer state since it's done in the layer/state.phtml template since 2.3.3 (see https://github.com/magento/magento2/blob/2.3.3/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml vs https://github.com/magento/magento2/blob/2.3.2/app/code/Magento/LayeredNavigation/view/frontend/templates/layer/state.phtml).
This was done for #1211 in #1271.

But our 2.8.x releases cover up to 2.3.4, so I'll probably fix this in two different ways.

rbayet added a commit that referenced this issue Nov 17, 2020
…rs_prevent_removal

Fixes #1978 Remove extra escaping preventing filter removal
@rbayet rbayet closed this as completed in e54d1fb Nov 17, 2020
@rbayet rbayet reopened this Nov 17, 2020
rbayet added a commit to rbayet/elasticsuite that referenced this issue Nov 18, 2020
current filter item value and applied values.
rbayet added a commit that referenced this issue Nov 18, 2020
…rs_prevent_removal_2_8_x

Fixes #1978 Do not rely on escaped value to compare
@rbayet
Copy link
Collaborator

rbayet commented Nov 18, 2020

Fixed by #1997 in 2.9.x, 2.10.x
Fixed by #1999 in 2.8.x

@rbayet rbayet closed this as completed Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants