GraphQL: Products "Bought together", "Suggestion" not loading

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: 208
Joined: 26 Aug 2022, 12:17

GraphQL: Products "Bought together", "Suggestion" not loading

Post by kdim95 » 26 Apr 2024, 14:04

Laravel framework version: 11.3.1
Aimeos Laravel version: 2024.04
PHP Version: 8.2.17
Environment: Linux

Hello,

In the administration, when I go to a product -> products and try to add a "Bought together" product or "Suggestion" product, they are not loading when I click the dropdown or try to search. In the console I get "GraphQL query failed".

Code: Select all

{
    "errors": [
        {
            "message": "Internal server error",
            "locations": [
                {
                    "line": 2,
                    "column": 7
                }
            ],
            "path": [
                "searchProducts"
            ]
        }
    ],
    "data": {
        "searchProducts": null
    }
}
Best regards

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

Re: GraphQL: Products "Bought together", "Suggestion" not loading

Post by aimeos » 27 Apr 2024, 09:59

Thanks for the hint! The problem has been fixed in aimeos/ai-admin-jqadm:2024.04.x-dev and will be part of the next release. You can test yourself in the meantime by executing:

Code: Select all

composer req aimeos/ai-admin-jqadm:2024.04.x-dev
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: GraphQL: Products "Bought together", "Suggestion" not loading

Post by kdim95 » 28 Apr 2024, 00:19

I installed the x-dev package, problem is still not solved for me, I get the exact same error.

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

Re: GraphQL: Products "Bought together", "Suggestion" not loading

Post by aimeos » 28 Apr 2024, 08:03

Are there any hints in the Log panel?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: GraphQL: Products "Bought together", "Suggestion" not loading

Post by kdim95 » 29 Apr 2024, 13:32

Here is what I can tell you:
The error is the exact same as before.
In product.js you are filtering products by null.
This means that if you haven't typed anything in the related product search and hit the dropdown, you get GraphQL error.

I changed it locally in product.js:

From this:

Code: Select all

const filter = {
	'&&': [
		{'>': {'product.status': 0}},
		{'||': [
			{'=~': {'product.label': input}},
			{'=~': {'product.code': input}},
			{'==': {'product.id': input}}
		]}
	]
}
To this and it works, can you confirm?
It's so products are not filtered by null when there's nothing in the input.

Code: Select all

let filter = {
	'&&': [
		{'>': {'product.status': 0}}
	]
}
					
if(input) {
	filter['&&'].push({
		'||': [
			{'=~': {'product.label': input}},
			{'=~': {'product.code': input}},
			{'==': {'product.id': input}}
		]
	});
}
https://github.com/aimeos/ai-admin-jqad ... ct.js#L678

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

Re: GraphQL: Products "Bought together", "Suggestion" not loading

Post by aimeos » 30 Apr 2024, 07:36

Thanks, we've changed that now and it's available in aimeos/ai-admin-jqadm:2024.04.x-dev until a new release is tagged.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply