[gelöst] Artikelpreise über REST-API setzen?

Hallo, kann mir jemand einen Tipp geben wie bzw. ob ich Artikelpreise über die neue REST-API setzen kann? Viele Grüße Florian

Hallo, die Artikelpreise kannst du über die mainDetails bearbeiten. Anbei ein Beispielaufruf: $client-\>call('articles/193', ApiClient::METHODE\_PUT, array( 'mainDetail' =\> array( 'prices' =\> array( array( 'customerGroupKey' =\> 'EK', 'from' =\> 1, 'to' =\> 20, 'price' =\> 50, ), array( 'customerGroupKey' =\> 'EK', 'from' =\> '21', 'price' =\> 45, ), ) ), )); Viele Grüße, Benjamin Cremer :shopware:

1 „Gefällt mir“

Super, danke das klappt. Hast du noch einen Tipp für mich wie ich einfach automatisiert Bilder zu Artikeln ins System bekomme? Ahh, hier ist es beschrieben http://forum.shopware.de/programmierung-f56/artikelbilder-setzen-t8497.html

wie schaut das aus mit pseudopreisen? hab das array einfach mal um den key pseudoprice erweitert, aber das hat keinen effekt - der pseudpreis wird nicht gesetzt: array(4) { [0]=\> array(5) { ["customerGroupKey"]=\> string(2) "EK" ["from"]=\> int(1) ["price"]=\> float(119) ["pseudoprice"]=\> float(8999) ["to"]=\> int(2) } [1]=\> array(4) { ["customerGroupKey"]=\> string(2) "EK" ["from"]=\> int(3) ["price"]=\> float(85) ["pseudoprice"]=\> float(8999) } [2]=\> array(5) { ["customerGroupKey"]=\> string(1) "H" ["from"]=\> int(1) ["price"]=\> float(212.415) ["pseudoprice"]=\> float(9888) ["to"]=\> int(2) } [3]=\> array(4) { ["customerGroupKey"]=\> string(1) "H" ["from"]=\> int(3) ["price"]=\> float(127.449) ["pseudoprice"]=\> float(9888) } }

Hallo, dürfte mit dem Schlüssel “pseudoPrice” gehen - also CamelCase. Gleiches gilt für den basePrice. Besten Gruß, Daniel

jawoll, vielen Dank

Hallo bin auch dabei Preise eines Artikels über Put Oder Post über die Rest Urls zu übergeben. Leider erhalte ich immer die Fehlermeldung: [quote]Could not decode json json_last_error: Syntaxfehler Raw: Fatal error: Call to a member function getTax() on a non-object in /var/www/jen/docs/shopware403/engine/Shopware/Components/Api/Resource/Article.php on line 72[/quote] $res = RestApiClient::GetInstance()-\>call('articles/1', RestApiClient::METHODE\_POST, array( 'mainDetail' =\> array( 'prices' =\> array( // array( // 'customerGroupKey' =\> 'EK', // 'from' =\> 1, // 'to' =\> 20, // 'price' =\> 50, // ), array( 'customerGroupKey' =\> 'EK', 'from' =\> '21', 'to' =\> 100, 'price' =\> 45, ), ) ), )); was kann man da machen? Habe dann auch noch den Fehler dass mir die Nachricht kommt Shopware kennt den Groupkey ‘E’ nicht obwohl ‘EK’ übergeben wurde.

Hallo, dem Artikel fehlt (neben einem Namen und einer Nummer für das mainDetail) eine taxId. Falls ein Update durchgeführt werden soll, muss die PUT Methode verwendet werden. Besten Gruß, dsn

Kann ich auch einen bestehenden Artikel über die Artikelnummer updaten? edit: ?useNumberAsId=true

Genau :slight_smile: