Jump to content
  • 0

[gelöst] Webservice Products


BRANDSTORE.TIROL

Question

HI,

 

weiß zufällig jemand von euch, wie ich über das POST für Products die verfügbare Menge mitgeben kann?

<quantity> wird ja nicht zugelassen

 

<?xml version="1.0" encoding="UTF-8" ?>
<prestashop>
    <product>
        <id_manufacturer>1</id_manufacturer>
        <id_category_default>19</id_category_default>
        <reference>Art.Nr.: 145 4191 | Farbe: 1907/10</reference>
        <state>1</state>
        <price>183.250000</price>
        <active>0</active>
        <link_rewrite>
            <language id="1">TESTAPI</language>
        </link_rewrite>
        <name>
            <language id="1">TESTAPI</language>
           </name>
        <associations>
          <categories nodeType="category" api="categories">
              <category>
                  <id>2</id>
              </category>
          </categories>
        </associations>
    </product>
</prestashop>

 

 

danke

tom

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

es sollte ja über die stock_availables gehen

 

<prestashop>
    <stock_available>
    <id_product>38</id_product>
    <id_product_attribute>0</id_product_attribute>
    <id_shop>1</id_shop>
    <id_shop_group>0</id_shop_group>
    <quantity>222</quantity>
    </stock_available>
</prestashop>

 

da kommt die Meldung: Method POST is not allowed for the resource stock_availables

die API sagt

<stock_availables xlink:href="https://myshop/api/stock_availables" get="true" put="true" post="true" delete="true" head="true"></stock_availables>

 

ist das ein Bug?

 

Link to comment
Share on other sites

  • 0

Hi Whiley... das geht über die Combination

Produkt anlegen

prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product>
        <id_manufacturer>1</id_manufacturer>
        <id_category_default>19</id_category_default>
        <id_tax_rules_group>1</id_tax_rules_group>
        <reference>Art.Nr.: 145 4191 | Farbe: 1907/10</reference>
        <state>1</state>
        <price>183.250000</price>
        <active>0</active>
        <link_rewrite>
            <language id="1">TESTAPI</language>
        </link_rewrite>
        <name>
            <language id="1">TESTAPI</language>
           </name>
        <associations>
          <categories nodeType="category" api="categories">
              <category>
                  <id>19</id>
              </category>
          </categories>
        </associations>
    </product>
</prestashop>

-> liefert die ProduktId zurück -> 47

------------
Varianten anlegen
mit der ProduktId von oben
product_option_value = Werte einer Eigenschaft, z.B. XL=31

COMBINATIONS anlegen
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <combination>
      <id_product>47</id_product>
      <minimal_quantity>1</minimal_quantity>
        <associations>
            <product_option_values nodeType="product_option_value" api="product_option_values">
                <product_option_value>
                    <id>31</id>
                </product_option_value>
            </product_option_values>
       </associations>
    </combination>
</prestashop>

-> liefert die COMBINATIONS zurück -> 105

POST: https://xxxxxx.at/api/combination
-> liefert COMBINATIONS ID -> damit die passende "https://xxxxx.at/api/stock_availables/" suchen (Feld: id_product_attribute)

------------

PUT
-> mit der Produkt ID die ID des stock_available suchen: (https://xxxxx.at/api/stock_availables) -> 168
diese Felder <id_product>47</id_product> und <id_product_attribute>105</id_product_attribute> kommen aus der Abfrage
 
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <stock_available>
      <id>173</id>
      <id_product>47</id_product>
      <id_product_attribute>105</id_product_attribute>
      <id_shop>1</id_shop>
      <id_shop_group>0</id_shop_group>
      <quantity>9</quantity>
      <depends_on_stock>0</depends_on_stock>
      <out_of_stock>0</out_of_stock>
    </stock_available>
</prestashop>

------------

Funktioniert einwandfrei

 

lg

tom

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...