GraphQL select product with categories

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
matish
Posts: 12
Joined: 04 Nov 2025, 11:52

GraphQL select product with categories

Post by matish » 04 Nov 2025, 11:54

You have an example GraphSQL query here:
https://aimeos.org/docs/2024.x/admin/graphql/product/

It works, but the result does not contain any categories or images. How can I include categories and images?

Also when I tried to register using username and password, then it would not let me register, because it said that "captcha solution was wrong" while in reality it was correct.

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

Re: GraphQL select product with categories

Post by aimeos » 04 Nov 2025, 11:59

matish wrote: 04 Nov 2025, 11:54 You have an example GraphSQL query here:
https://aimeos.org/docs/2024.x/admin/graphql/product/

It works, but the result does not contain any categories or images. How can I include categories and images?
Please have a look here:
https://aimeos.org/docs/2024.x/admin/gr ... -resources
matish wrote: 04 Nov 2025, 11:54 Also when I tried to register using username and password, then it would not let me register, because it said that "captcha solution was wrong" while in reality it was correct.
Do you mean the captcha when registering in the forum?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
matish
Posts: 12
Joined: 04 Nov 2025, 11:52

Re: GraphQL select product with categories

Post by matish » 06 Nov 2025, 14:17

Do you mean the captcha when registering in the forum?
Yes, exactly. I resolve the captcha and press register. But it said that captcha was resolved incorrectly. Seems like some kind of implementation issue.

Image

Anyway I got product selections and inserts working finally. Do you know any good libraries for generating GraphQL commands? It took a while to make a simple generator, because it does not seem smart to write each command manually like this:

Code: Select all

{
  searchProducts(
    filter: "{\"==\":{\"product.code\":\"21HD007H\"}}"
    include: [
      "text"
      "product/property"
      "stock"
      "catalog"
      "media"
      "attribute"
    ]
  ) {
    items {
      id
      siteid
      type
      code
      label
      url
      dataset
      datestart
      dateend
      config
      instock
      scale
      status
      target
      boost
      mtime
      ctime
      editor
      lists {
        text {
          id
          item {
            id
            content
            type
            domain
            label
          }
        }
        catalog {
          id
          siteid
          parentid
        }
        media {
          id
          siteid
          type
        }
        attribute {
          id
          item {
            id
            type
            siteid
            domain
            code
            label
          }
        }
      }
      property {
        id
        type
        languageid
        value
      }
      stock {
        id
        type
        stocklevel
        timeframe
        dateback
      }
    }
    total
  }
}

Those kind of queries could be generated from PHP assoc arrays instead (also inluding mutation queries), but I could not find any library that would do that. Sorry if it is a stupid question, I have only like 3 days of experience in this.

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

Re: GraphQL select product with categories

Post by aimeos » 06 Nov 2025, 14:42

For PHP, there are almost no libraries for building GraphQL requests compared to Javascript, which has Apollo. The best one seems to be: https://github.com/softonic/graphql-client
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
matish
Posts: 12
Joined: 04 Nov 2025, 11:52

Re: GraphQL select product with categories

Post by matish » 06 Nov 2025, 15:09

Ok, thanks for the suggestion. I already have it. Unfortunately it does not do the query formatting. I would actually like to try HTMX instead of javascript, because there is so much javascript already that some pages are slow because of that. Unfortunately GraphQL responses do not fit, since it expects the responses to be pure HTML.

Post Reply