2016-05-20 9 views
2

Wie kann ich die Liste der Kategorien, in denen ein Produkt Mitglied ist, mit dem Magento v2.0 SOAP Web Service?Erhalten Sie Produkt Kategorie IDs von Magento v2.0 SOAP API

Unter http://devdocs.magento.com/guides/v2.0/soap/bk-soap.html habe ich eine Liste von Diensten gefunden.

Mit der catalogProductRepositoryV1 kann ich eine Liste oder ein einzelnes Produkt anfordern, aber es enthält nicht die Kategorien. zB:

Anfrage:

POST http://domain/soap/default?services=catalogProductRepositoryV1 HTTP/1.1 
Content-Type: application/soap+xml; charset=utf-8; action="catalogProductRepositoryV1Get" 
Host: domain 
Content-Length: 382 
Expect: 100-continue 
Accept-Encoding: gzip, deflate 

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> 
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <catalogProductRepositoryV1GetRequest xmlns="http://domain/soap/default?services=catalogProductRepositoryV1"> 
      <sku xmlns="">24-MB01</sku> 
     </catalogProductRepositoryV1GetRequest> 
    </s:Body> 
</s:Envelope> 

Antwort:

HTTP/1.1 200 OK 
Date: Fri, 20 May 2016 12:21:46 GMT 
Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 PHP/5.6.21 
X-Powered-By: PHP/5.6.21 
Set-Cookie: PHPSESSID=89fdd89a6caeb8be424b9531c69d6c69; expires=Fri, 20-May-2016 13:21:47 GMT; Max-Age=3600; path=/; domain=domain; HttpOnly 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Content-Length: 5547 
X-Content-Type-Options: nosniff 
X-XSS-Protection: 1; mode=block 
Connection: close 
Content-Type: application/soap+xml; charset=utf-8 

<?xml version="1.0" encoding="UTF-8"?> 
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://domain/soap/default?services=catalogProductRepositoryV1"> 
    <env:Body> 
     <ns1:catalogProductRepositoryV1GetResponse> 
      <result> 
       <id>1</id> 
       <sku>24-MB01</sku> 
       <name>Joust Duffle Bag</name> 
       <attributeSetId>15</attributeSetId> 
       <price>34</price> 
       <status>1</status> 
       <visibility>4</visibility> 
       <typeId>simple</typeId> 
       <createdAt>2016-01-22 16:28:25</createdAt> 
       <updatedAt>2016-04-20 09:51:54</updatedAt> 
       <extensionAttributes/> 
       <productLinks> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-MB03</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-MB05</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-MB06</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-MB02</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-UB02</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-WB03</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-WB07</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
        <item> 
         <sku>24-MB01</sku> 
         <linkType>upsell</linkType> 
         <linkedProductSku>24-WB04</linkedProductSku> 
         <linkedProductType>simple</linkedProductType> 
         <position/> 
         <extensionAttributes/> 
        </item> 
       </productLinks> 
       <options/> 
       <mediaGalleryEntries> 
        <item> 
         <id>1</id> 
         <mediaType>image</mediaType> 
         <label>Image</label> 
         <position>1</position> 
         <disabled>false</disabled> 
         <types> 
          <item>image</item> 
          <item>small_image</item> 
          <item>thumbnail</item> 
         </types> 
         <file>/m/b/mb01-blue-0.jpg</file> 
        </item> 
       </mediaGalleryEntries> 
       <tierPrices/> 
       <customAttributes> 
        <item> 
         <attributeCode>description</attributeCode> 
         <value>&lt;p&gt;The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.&lt;/p&gt;&#13; 
&lt;ul&gt;&#13; 
&lt;li&gt;Dual top handles.&lt;/li&gt;&#13; 
&lt;li&gt;Adjustable shoulder strap.&lt;/li&gt;&#13; 
&lt;li&gt;Full-length zipper.&lt;/li&gt;&#13; 
&lt;li&gt;L 29" x W 13" x H 11".&lt;/li&gt;&#13; 
&lt;/ul&gt;</value> 
        </item> 
        <item> 
         <attributeCode>meta_title</attributeCode> 
         <value>Joust Duffle Bag</value> 
        </item> 
        <item> 
         <attributeCode>meta_keyword</attributeCode> 
         <value>Joust Duffle Bag</value> 
        </item> 
        <item> 
         <attributeCode>meta_description</attributeCode> 
         <value>Joust Duffle Bag &lt;p&gt;The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places t</value> 
        </item> 
        <item> 
         <attributeCode>image</attributeCode> 
         <value>/m/b/mb01-blue-0.jpg</value> 
        </item> 
        <item> 
         <attributeCode>small_image</attributeCode> 
         <value>/m/b/mb01-blue-0.jpg</value> 
        </item> 
        <item> 
         <attributeCode>thumbnail</attributeCode> 
         <value>/m/b/mb01-blue-0.jpg</value> 
        </item> 
        <item> 
         <attributeCode>category_ids</attributeCode> 
         <value> 
          <xsd:string>3</xsd:string> 
          <xsd:string>4</xsd:string> 
         </value> 
        </item> 
        <item> 
         <attributeCode>options_container</attributeCode> 
         <value>container2</value> 
        </item> 
        <item> 
         <attributeCode>required_options</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>has_options</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>image_label</attributeCode> 
         <value>Image</value> 
        </item> 
        <item> 
         <attributeCode>small_image_label</attributeCode> 
         <value>Image</value> 
        </item> 
        <item> 
         <attributeCode>thumbnail_label</attributeCode> 
         <value>Image</value> 
        </item> 
        <item> 
         <attributeCode>msrp_display_actual_price_type</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>url_key</attributeCode> 
         <value>joust-duffle-bag</value> 
        </item> 
        <item> 
         <attributeCode>tax_class_id</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>activity</attributeCode> 
         <value>11,19,21,22</value> 
        </item> 
        <item> 
         <attributeCode>style_bags</attributeCode> 
         <value>25,26,29</value> 
        </item> 
        <item> 
         <attributeCode>material</attributeCode> 
         <value>37,38</value> 
        </item> 
        <item> 
         <attributeCode>strap_bags</attributeCode> 
         <value>61,62,63,64,65,66</value> 
        </item> 
        <item> 
         <attributeCode>features_bags</attributeCode> 
         <value>74,76,79</value> 
        </item> 
        <item> 
         <attributeCode>eco_collection</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>performance_fabric</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>erin_recommends</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>new</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>sale</attributeCode> 
         <value>0</value> 
        </item> 
        <item> 
         <attributeCode>eboekhouden_grootboekrekening</attributeCode> 
         <value>8000</value> 
        </item> 
        <item> 
         <attributeCode>eboekhouden_costcenter</attributeCode> 
         <value>0</value> 
        </item> 
       </customAttributes> 
      </result> 
     </ns1:catalogProductRepositoryV1GetResponse> 
    </env:Body> 
</env:Envelope> 

Antwort

4

im Detail SOAP Produkt Rufen Sie also catalogProductRepositoryV1 Sie Category_ids als ein Element in Custom Tag

<customAttributes> 
... 
<item> 
    <attributeCode>category_ids</attributeCode> 
    <value> 
     <xsd:string>3</xsd:string> 
     <xsd:string>4</xsd:string> 
    </value> 
</item> 
... 
</customAttributes> 
finden

als Sie die Kategorien laden müssen, wenn Sie möchten ny Informationen dazu von catalogCategoryRepositoryV1

+0

so war es in der Antwort die ganze Zeit .. seufzen. und ich sehe jetzt, warum ich es vorher nicht gesehen habe. Wenn Sie das 'catalogProductRepositoryV1GetListRequest' verwenden, erhalten Sie nicht die customAttribute category_ids .. –

+0

in List API gibt es nur Standardwerte, category_ids sind in Product Detail API –