# \[GELÖST\] Varianten über Plugin anlegen

**URL:** <https://forum.shopware.com/t/gelost-varianten-uber-plugin-anlegen/11413>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [5. Februar 2013 um 17:35 UTC](https://forum.shopware.com/t/gelost-varianten-uber-plugin-anlegen/11413 "2013-02-05T17:35:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwoerdehoff](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pwoerdehoff](https://forum.shopware.com/u/pwoerdehoff)\
**Post date:** [5. Februar 2013 um 17:35 UTC](https://forum.shopware.com/t/gelost-varianten-uber-plugin-anlegen/11413/1 "2013-02-05T17:35:24Z")

</div>

Hey, ich möchte Varianten zu einem Artikel hinzufügen. Allerdings weißt ich nicht genau welche Parameter ich übergeben muss (Wie kann man das sehen? Ich habe in den Tutorials nichts gefunden 😕 ) Der Artikel wird wie folgt erstellt, was auch wunderbar funktioniert: ` $articleResource = \Shopware\Components\Api\Manager::getResource('Article'); $createParams = array( "mainnumber"=\>"MS654867", "group1" =\> "Sphaere", "option1" =\> "3", "group2" =\> "Basiskurve", "option2" =\> "8", ); $articleResource-\>create($createParams); $updateParams = array( 'configuratorSet' =\> array( 'groups' =\> array( array( 'name' =\> 'Sphaere', 'options' =\> array( array('name' =\> 1), array('name' =\> 2), array('name' =\> 3), array('name' =\> 4), array('name' =\> 5), array('name' =\> 6), array('name' =\> 7), ) ), array( 'name' =\> 'Basiskurve', 'options' =\> array( array('name' =\> 8), array('name' =\> 9), array('name' =\> 10), array('name' =\> 11), array('name' =\> 12), array('name' =\> 13), array('name' =\> 14), ) ), ) ) ); $articleResource-\>update($createParams); ` Und so versuche ich eine Variante hinzuzufügen… : ` $variants = array( 'variants' =\> array( array( 'number' =\> 'MS654867.1', 'configuratorOptions' =\> array( array( 'group' =\> 'Sphaere', 'option' =\> '3' ), array( 'group' =\> 'Basiskurve', 'option' =\> '8' ) ), 'inStock' =\> '3', ) ) ); $sArticle = $articleResource-\>getOneByNumber('MS654867'); $id = $sArticle['id']; $articleResource-\>update($id, $variants); ` Wenn ich letzteres ausführe, passiert nichts. Keine Fehlermeldung, keine Exception der Aufruf geht einfach sauber durch, allerdings ohne dabei eine Variante zu erstellen 😕 Weiß jemand was ich falsch mache?

---

<div class="post-metadata">

**Author:** ![pwoerdehoff](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pwoerdehoff](https://forum.shopware.com/u/pwoerdehoff)\
**Post date:** [6. Februar 2013 um 11:58 UTC](https://forum.shopware.com/t/gelost-varianten-uber-plugin-anlegen/11413/2 "2013-02-06T11:58:31Z")

</div>

Hey, hier die Lösung (die Parameter waren einfach nicht vollständig): ` $variants = array( 'variants' =\> array( array( 'isMain' =\> false, 'number' =\> 'TEST000111', 'inStock' =\> 15, 'addtionaltext' =\> 'L / Schwarz', 'configuratorOptions' =\> array( array('group' =\> 'Sphaere', 'option' =\> '1'), array('group' =\> 'Basiskurve', 'option' =\> '9'), ), 'prices' =\> array( array( 'customerGroupKey' =\> 'EK', 'price' =\> 999, ), ) ), array( 'isMain' =\> false, 'number' =\> 'TEST000111.1', 'inStock' =\> 15, 'addtionaltext' =\> 'S / Schwarz', 'configuratorOptions' =\> array( array('group' =\> 'Sphaere', 'option' =\> '1'), array('group' =\> 'Basiskurve', 'option' =\> '9'), ), 'prices' =\> array( array( 'customerGroupKey' =\> 'EK', 'price' =\> 888, ), ) ), ) ); `
