Filtering orders by service attribute not working

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
kdim95
Advanced
Posts: 191
Joined: 26 Aug 2022, 12:17

Filtering orders by service attribute not working

Post by kdim95 » 19 May 2023, 13:58

Laravel framework version: 9.52.4
Aimeos Laravel version: ~2022.10
PHP Version: 8.2.4
Environment: Linux

Hello,

Filtering orders by service attributes is not working.
I tried with "Service attribute code" and "Service attribute value".
There are no results, but I know that an order exists with the attribute.

How to reproduce:
  • Go to the orders section /admin/default/jqadm/search/order
  • Click on the magnifying glass to open the search modal
    • Select "Service attribute value"
    • Select "=="
    • Input an existing service attribute value added through the order
Result: There are no search results, but I know for a fact that there is an order with the service attribute value.

kdim95
Advanced
Posts: 191
Joined: 26 Aug 2022, 12:17

Re: Filtering orders by service attribute not working

Post by kdim95 » 19 May 2023, 22:26

I've been digging and apparently you have to put the attribute value in quotes in the input field :o.
It's getting saved like that in the database.
This is like this because the values are saved as json in the database right?
The quotes should be added to the attribute value automatically when filtering.

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Filtering orders by service attribute not working

Post by aimeos » 20 May 2023, 08:29

Yes, the data is JSON encoded and can be an array or an object too ("[...]" or "{...}") so adding quotes by default won't help.

There are only two possible options:
1.) Use a LIKE search ("%val%") which is extremely slow when the number of orders is high
2.) Remove the ability to search for product/service attributes
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kdim95
Advanced
Posts: 191
Joined: 26 Aug 2022, 12:17

Re: Filtering orders by service attribute not working

Post by kdim95 » 22 May 2023, 09:10

I think the problem might be in the backend (the "list.php" template file for the orders), perhaps I'm missing a config that adds the quotes automatically when searching for attribute values? I have attempted to search for attribute values on a clean installation of Aimeos and I get the same result there, you simply have to add the quotes if you search for attribute values. It seems counter intuitive and I have been searching for a while before actually looking at the database and SQL, finding out with surprise that the attribute is being saved with quotes and that it's being queried without any quotes.

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: Filtering orders by service attribute not working

Post by aimeos » 24 May 2023, 09:06

Like said, order product/service attribute values can also be arrays or objects ("[...]" or "{...}") and adding quotes automatically, the search won't find anything too.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kdim95
Advanced
Posts: 191
Joined: 26 Aug 2022, 12:17

Re: Filtering orders by service attribute not working

Post by kdim95 » 26 May 2023, 08:14

Perhaps a solution would be if json_decode fails on the input, the input should be enquoted?
I need to check where exactly it's being parsed.

Post Reply