0

Json - Woocommerce - array - Hilfe

Ich komme leider nicht weiter mit meinem Problem und brauche Hilfe 😂

Ich möchte mit einem Button die Bestellung aus Woocommerce nach Ninox reinholen und die Bestellten Produkte sollen in einer Untertabelle mit den Spalten  product_id, name , quantity übertragen werden.

Ich habe jetzt eine Tabelle "Bestellungen" und eine Untertabelle "Bestellteprodukte" mit den jeweiligen Spalten. 

Die Daten werden per API schon übertragen und in formatJson im Textfeld importiert. Jetzt müssen aus der Json die Bestelltenprodukte rausgeholt werden und in die Untertabelle übertragen werden. 

Wie mache ich das? 

Das ist die Json von den Bestellprodukten:

"line_items":[{"id":72,"name":"Wandkalender „DEIN REICH KOMME\"","product_id":4318,"variation_id":0,"quantity":3,"tax_class":"","subtotal":"62.77","subtotal_tax":"11.93","total":"62.77","total_tax":"11.93","taxes":[{"id":1,"total":"11.93","subtotal":"11.93"}],"meta_data":[{"id":627,"key":"_reduced_stock","value":"3","display_key":"_reduced_stock","display_value":"3"}],"sku":"PrNo-00182","price":20.924369666666667,"image":{"id":"4345","src":"https://www.sonneamwerk.de/wp-content/uploads/2021/11/Kalender-Bild1-e1640737367639.png"},"parent_name":null},{"id":73,"name":"Poster „Ich und mein Haus“ 30 x 40 cm - A3 30cm x 40cm, Creme","product_id":4683,"variation_id":4698,"quantity":1,"tax_class":"","subtotal":"7.56","subtotal_tax":"1.44","total":"7.56","total_tax":"1.44","taxes":[{"id":1,"total":"1.44","subtotal":"1.44"}],"meta_data":[{"id":569,"key":"format","value":"A3 30cm x 40cm","display_key":"Format","display_value":"A3 30cm x 40cm"},{"id":570,"key":"pa_farbe","value":"creme","display_key":"Farbe","display_value":"Creme"},{"id":628,"key":"_reduced_stock","value":"1","display_key":"_reduced_stock","display_value":"1"}],"sku":"PrNo-00048","price":7.563025,"image":{"id":4685,"src":"https://www.sonneamwerk.de/wp-content/uploads/2021/12/HausGelb-e1640738132719.jpg"},"parent_name":"Poster „Ich und mein Haus“ 30 x 40 cm"},{"id":74,"name":"Poster „Ich und mein Haus“ 30 x 40 cm - A3 30cm x 40cm, Pastelgrün","product_id":4683,"variation_id":4702,"quantity":1,"tax_class":"","subtotal":"7.56","subtotal_tax":"1.44","total":"7.56","total_tax":"1.44","taxes":[{"id":1,"total":"1.44","subtotal":"1.44"}],"meta_data":[{"id":580,"key":"format","value":"A3 30cm x 40cm","display_key":"Format","display_value":"A3 30cm x 40cm"},{"id":581,"key":"pa_farbe","value":"pastelgruen","display_key":"Farbe","display_value":"Pastelgrün"},{"id":629,"key":"_reduced_stock","value":"1","display_key":"_reduced_stock","display_value":"1"}],"sku":"PrNo-00048","price":7.563025,"image":{"id":4687,"src":"https://www.sonneamwerk.de/wp-content/uploads/2021/12/HausGruen.jpg"},"parent_name":"Poster „Ich und mein Haus“ 30 x 40 cm"},{"id":75,"name":"Poster „Ich und mein Haus“ 30 x 40 cm - A3 30cm x 40cm, Pastelblau","product_id":4683,"variation_id":4700,"quantity":1,"tax_class":"","subtotal":"7.56","subtotal_tax":"1.44","total":"7.56","total_tax":"1.44","taxes":[{"id":1,"total":"1.44","subtotal":"1.44"}],"meta_data":[{"id":591,"key":"format","value":"A3 30cm x 40cm","display_key":"Format","display_value":"A3 30cm x 40cm"},{"id":592,"key":"pa_farbe","value":"pastelblau","display_key":"Farbe","display_value":"Pastelblau"},{"id":630,"key":"_reduced_stock","value":"1","display_key":"_reduced_stock","display_value":"1"}],"sku":"PrNo-00048","price":7.563025,"image":{"id":4684,"src":"https://www.sonneamwerk.de/wp-content/uploads/2021/12/HausBlau.jpg"},"parent_name":"Poster „Ich und mein Haus“ 30 x 40 cm"},{"id":76,"name":"Poster „Ich und mein Haus“ 30 x 40 cm - A3 30cm x 40cm, Lichtgrau","product_id":4683,"variation_id":4699,"quantity":1,"tax_class":"","subtotal":"7.56","subtotal_tax":"1.44","total":"7.56","total_tax":"1.44","taxes":[{"id":1,"total":"1.44","subtotal":"1.44"}],"meta_data":[{"id":602,"key":"format","value":"A3 30cm x 40cm","display_key":"Format","display_value":"A3 30cm x 40cm"},{"id":603,"key":"pa_farbe","value":"lichtgrau","display_key":"Farbe","display_value":"Lichtgrau"},{"id":631,"key":"_reduced_stock","value":"1","display_key":"_reduced_stock","display_value":"1"}],"sku":"PrNo-00048","price":7.563025,"image":{"id":4686,"src":"https://www.sonneamwerk.de/wp-content/uploads/2021/12/HausGrau.jpg"},"parent_name":"Poster „Ich und mein Haus“ 30 x 40 cm"},{"id":77,"name":"Poster „Ich und mein Haus“ 30 x 40 cm - A3 30cm x 40cm, Pastelrot","product_id":4683,"variation_id":4701,"quantity":1,"tax_class":"","subtotal":"7.56","subtotal_tax":"1.44","total":"7.56","total_tax":"1.44","taxes":[{"id":1,"total":"1.44","subtotal":"1.44"}],"meta_data":[{"id":613,"key":"format","value":"A3 30cm x 40cm","display_key":"Format","display_value":"A3 30cm x 40cm"},{"id":614,"key":"pa_farbe","value":"pastelrot","display_key":"Farbe","display_value":"Pastelrot"},{"id":632,"key":"_reduced_stock","value":"1","display_key":"_reduced_stock","display_value":"1"}],"sku":"PrNo-00048","price":7.563025,"image":{"id":4689,"src":"https://www.sonneamwerk.de/wp-content/uploads/2021/12/HausRot.jpg"},"parent_name":"Poster „Ich und mein Haus“ 30 x 40 cm"}]

und das ist meine Befehl im Button:

let me := this;
let response := do as server
        http("GET", "https://www.sonneamwerk.de/wp-json/wc/v3/orders/" + ID + "?" +
        "&consumer_key=????&consumer_secret=????", {
            'Content-Type': "application/json"
        }, {})
    end;
if response.error then
    alert(text(response.error))
else
    let conten := parseJSON(Text);
    Firmenname := response.result.billing.company;
    Name := response.result.billing.last_name;
    Vorname := response.result.billing.first_name;
    'Straße' := response.result.billing.address_1;
    PLZ := response.result.billing.postcode;
    Ort := response.result.billing.city;
    'E-Mail' := response.result.billing.email;
    Telefon := response.result.billing.phone;
    'Versand Firmenname' := response.result.shipping.company;
    'Versand Name' := response.result.shipping.last_name;
    'Versand Vorname' := response.result.shipping.first_name;
    'Versand Straße' := response.result.shipping.address_1;
    'Versand PLZ' := response.result.shipping.postcode;
    'Versand Ort' := response.result.shipping.city;
    'Text 2' := text(response.result.line_items)
end;
let bestell := (create Bestellteprodukte);
bestell.(Bestellungen := me);

Antwort

null

Content aside

  • vor 10 MonatenZuletzt aktiv
  • 42Ansichten
  • 1 Folge bereits