Tipp: ChatGPT zum Erzeugen von SQL Datenbank Kommandos für Shopware 6

Hi,

falls es jemanden interessiert:

Ich habe eben einen GPT unter ChatGPT gebaut, dem ich testweise die Definitionen der folgenden Datenbanktabellen aus Shopware 6 gefüttert habe:

  • product
  • product_translation
  • product_visibility
  • category
  • category_visibility

Man kann nun Fragen zu diesen Datenbanken stellen und die Ergebnisse sehen ganz gut aus.

Ist nur eine Spielerei, aber vielleicht gefällt es Euch ja.

Hier ist der Link zum GPT:
https://chat.openai.com/g/g-gLjpW5Nvo-mysql-shopware-6-assistant

Viel Spass

Jens

P.S.:

Hier eine Beispielinteraktion:
How can I find the category id based on a category name?

GPT
To find the category ID based on a category name in Shopware 6, you would use the category and category_translation tables. The category table contains the category data, and the category_translation table contains the names and descriptions of the categories in various languages. Here's an SQL statement for this purpose:

SELECT c.id
FROM category c
INNER JOIN category_translation ct ON c.id = ct.category_id
WHERE ct.name = 'Your Category Name';

Replace 'Your Category Name' with the actual name of the category you're looking for. This query will return the IDs of categories that match the given name.

If your Shopware setup involves multiple languages and the same category name exists in more than one language, this query might return multiple category IDs. In such cases, you might need to add an additional condition to specify the language.

Anmerkung:
Die Antwort ist eigentlich zu kompliziert, weil die category_id ja eigentlich schon in der category_translation Table steht. Aber funktionieren tut es.

WARNUNG:
Bitte traut den Ausgaben des GPTs nicht. Immer ein Datenbank Backup machen !!!