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

API Unable to find product by the attribute filter of the array type when the value contains "/" #611

Open
Drashanski opened this issue Jan 17, 2024 · 2 comments

Comments

@Drashanski
Copy link

Drashanski commented Jan 17, 2024

Core: 1.8.10
PIM: 1.11.7

  1. Assign an attribute of the array type to a product and set a single value - for example we'll use ac/dc.
  2. Try to find the product by Attribute Filter using this attribute and the value ac/dc.
  3. Expected result: we find the product by the simple search criteria.
  4. Reality: product not found

We see that attribute entity its stored as ["ac\/dc"] in the database due to the / needing to be escaped.

When we snoop around in atrocore\pim\app\SelectManagers\Product.php and the function convertAttributeWhere responsible for the search query, we see that the value it will look for is %"ac/dc"%

If we add a str_replace function and change the / to \\\\/ (4 dashes because of mysql like escape functionality) so that its now the [text_value][value] is %"ac\\/dc"% the product will be correctly returned. But I'm sure you can implement a better solution to the issue.

@rratsun
Copy link
Collaborator

rratsun commented Jan 17, 2024

we have created an internal issue for it

@Drashanski
Copy link
Author

Drashanski commented Jan 17, 2024

My bad, I did not know the multiple / will be combined. Post edited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants