Shopware 4.2 API Varianten

Tag, Beim Versuch über die API in 4.2 ein Variantenartikel anzulegen, bekomme ich folgenden Fehler: [code] Errormesage: An exception occurred while executing ‘INSERT INTO s_article_configurator_option_relations (article_id, option_id) VALUES (?, ?)’ with params [1, 1]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘1-1’ for key ‘article_id’

[/code] Die Struktur meines Artikels ist wie folgt : Dannach kommen noch 3 Varianten mit Größen S, XL und XXL und jeweils schwarz, also keine Duplikate. Wenn das Array varaints raus ist, geht alles PRoblemlos durch, es muss also an variants und configuratorOptions liegen. configuratorSet wird ohne variants ebenfalls sauber angelegt und auch images Array mit entsprechenden configurator Zuordnungen. Wäre um jeden Hinweis echt dankbar! Gruß Edin

Hallo, dieses Verhalten haben wir eventuell sogar schon gefixt mit dem Ticket http://jira.shopware.de/?ticket=SW-7925 Hier können Sie den Fix einsehen: https://github.com/ShopwareAG/shopware- … b5a#diff-0 Die Änderungen der ersten Datei reichen. Vg, Marcel

1 „Gefällt mir“

Hi Marcel, danke für die Antwort. Heisst dass, ich soll dann Core anpassen, oder gibt es bald ein Update hierfür ? Bzw. wenn das nächste Update kommt wird es auf jeden Fall dabei sein, so dass ich ruhig Core überschreiben darf ? Gruß Edin

Nebenbei noch ne Frage: wenn ich ein Varianten Attribut importieren will bekomme ich folgenden Fehler: Failed to parse time string (86% Nylon / 14% Elasthan) at position 0 (8): Unexpected character irgendein CHarakter ist wohl hier unpassend: “86% Nylon / 14% Elasthan”, nur mich wunderts warum da ein Time String geparst wird, wenn ich ein einfaches Textfeld als Attribut habe? Liegt es etwas am %-Zeichen, wird da etwas automatisch dadurch angestossen ? Der Fix hat übrigens funktioniert, danke! Gruß Edin

Hello, Edin Thank you for reporting this issue. It seems that you are trying to save a string value into a datetime type database column. Even if you configured a particular article attribute to be of a string compatible type in the backend, the query will always fail, resulting in the error you are experiencing. As a possible solution, you can use a different attribute field to store that particular information. Alternatively, you could modify the ‘s_articles_attributes’ in your database to meet your needs. However, this could break existing functionality, and is not recommended nor officially supported. Hope this solves your problem :slight_smile: Best regards, Tiago

1 „Gefällt mir“

oh ok… so the types of fields are set to some defaults for whatever reason? I see attr17 is of type date. but why ? :slight_smile: i can use another one, but acutally i need as much fields as possible. Thnx for your replay.

Zum attr17: Das ist aus der Hierarchie von Shopware so entstanden. Ich meine gelesen zu haben das die das in 4.2.1 ändern möchten da es jetzt keinen Sinn mehr macht. Aber Nagel mich darauf nicht fest. In der DB kannst es ja ändern.

ok. ich werd denk ich aber einfach 17 überspringen, der satz “could break existing functionality” macht mir da aber doch n wenig angst :slight_smile:

da du wohl in die s_aricel_attribute schreibst solltest du dir vorher anschauen was für ein Wert die Felder haben. Manche sind Varchar(255) und manche Varchar(20). Das könnte später zu Problemen führen.

1 „Gefällt mir“

ouh, das ist n guter Hinweis, dank dir!