Jump to content

Webservice API cannot add two or more features


Recommended Posts

Dear all,

 

I have succesfully use the API, but when I want to add a product there is one problem.
When I want to add more than one feature to a product only the last one is active.
I do not get errors, the product is insert correct, but with only one feature.

For example I ve a height and a width, only the width is set.

Hope somebody can help me to add more features.

My sent XML (I have replace my webshop URL for security reasons):

Mayby there is the fault (??)

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
 <id_manufacturer format="isUnsignedId">79</id_manufacturer>
 <id_supplier format="isUnsignedId"/>
 <id_category_default format="isUnsignedId">2</id_category_default>
 <new/>
 <cache_default_attribute/>
 <id_default_image not_filterable="true"/>
 <id_default_combination not_filterable="true"/>
 <id_tax_rules_group format="isUnsignedId"/>
 <type not_filterable="true"/>
 <id_shop_default format="isUnsignedId"/>
 <reference maxSize="32" format="isReference"/>
 <supplier_reference maxSize="32" format="isReference"/>
 <location maxSize="64" format="isReference"/>
 <width format="isUnsignedFloat"/>
 <height format="isUnsignedFloat"/>
 <depth format="isUnsignedFloat"/>
 <weight format="isUnsignedFloat"/>
 <quantity_discount format="isBool"/>
 <ean13 maxSize="13" format="isEan13"/>
 <upc maxSize="12" format="isUpc"/>
 <cache_is_pack format="isBool"/>
 <cache_has_attachments format="isBool"/>
 <is_virtual format="isBool"/>
 <on_sale format="isBool"/>
 <online_only format="isBool"/>
 <ecotax format="isPrice"/>
 <minimal_quantity format="isUnsignedInt">1</minimal_quantity>
 <price required="true" format="isPrice">818.00</price>
 <wholesale_price format="isPrice"/>
 <unity format="isString"/>
 <unit_price_ratio/>
 <additional_shipping_cost format="isPrice"/>
 <customizable format="isUnsignedInt"/>
 <text_fields format="isUnsignedInt"/>
 <uploadable_files format="isUnsignedInt"/>
 <active format="isBool">1</active>
 <redirect_type format="isString"/>
 <id_product_redirected format="isUnsignedId"/>
 <available_for_order format="isBool">1</available_for_order>
 <available_date format="isDateFormat"/>
 <condition format="isGenericName"/>
 <show_price format="isBool">1</show_price>
 <indexed format="isBool"/>
 <visibility format="isProductVisibility"/>
 <advanced_stock_management format="isBool"/>
 <date_add format="isDateFormat"/>
 <date_upd format="isDateFormat"/>
 <meta_description maxSize="255" format="isGenericName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"/><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"/></meta_description>
 <meta_keywords maxSize="255" format="isGenericName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"/><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"/></meta_keywords>
 <meta_title maxSize="128" format="isGenericName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"/><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"/></meta_title>
 <link_rewrite required="true" maxSize="128" format="isLinkRewrite"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId">184-38BKTTR-13512PLYTT</language><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId">184-38BKTTR-13512PLYTT</language></link_rewrite>
 <name required="true" maxSize="128" format="isCatalogName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId">18.4-38 BKT TR-135 12 PLY TT</language><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId">18.4-38 BKT TR-135 12 PLY TT</language></name>
 <description format="isCleanHtml"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"></language></description>
 <description_short format="isCleanHtml"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId">B467 H1750 A5145</language><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId">B467 H1750 A5145</language></description_short>
 <available_now maxSize="255" format="isGenericName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"/><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"/></available_now>
 <available_later maxSize="255" format="IsGenericName"><language id="1" xlink:href="http://www.webshop.com/api/languages/1" format="isUnsignedId"/><language id="6" xlink:href="http://www.webshop.com/api/languages/6" format="isUnsignedId"/></available_later>
<associations>
<categories node_type="category">
 <category>
 <id required="true"/>
 </category>
<category><id>2</id></category><category><id>18</id></category></categories>
<images node_type="image">
 <image>
 <id/>
 </image>
</images>
<combinations node_type="combinations">
 <combinations>
 <id required="true"/>
 </combinations>
</combinations>
<product_option_values node_type="product_options_values">
 <product_options_values>
 <id required="true"/>
 </product_options_values>
</product_option_values>
<product_features node_type="product_feature">
 <product_feature>
 <id required="true"/>
 <custom/>
 <id_feature_value xlink:href="http://www.webshop.com/api/product_feature_values/" required="true"/>
 </product_feature>
</product_features>
<tags node_type="tag">
 <tag>
 <id required="true"/>
 </tag>
</tags>
<stock_availables node_type="stock_available">
 <stock_available>
 <id required="true"/>
 <id_product_attribute required="true"/>
 </stock_available>
</stock_availables>
<accessories node_type="product">
 <product>
 <id xlink:href="http://www.webshop.com/api/product/" required="true"/>
 </product>
</accessories>
<product_bundle node_type="products">
 <products>
 <id required="true"/>
 <quantity/>
 </products>
</product_bundle>
<product_features><product_feature><id>6</id><custom>0</custom><id_feature_value>131</id_feature_value></product_feature></product_features><product_features><product_feature><id>16</id><custom>0</custom><id_feature_value>108</id_feature_value></product_feature></product_features></associations>
</product>
</prestashop>

 

 

My return XML

 

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
 <id><![CDATA[472]]></id>
 <id_manufacturer xlink:href="http://www.webshop.com/api/manufacturers/79"><![CDATA[79]]></id_manufacturer>
 <id_supplier></id_supplier>
 <id_category_default xlink:href="http://www.webshop.com/api/categories/2"><![CDATA[2]]></id_category_default>
 <new></new>
 <cache_default_attribute></cache_default_attribute>
 <id_default_image not_filterable="true"></id_default_image>
 <id_default_combination not_filterable="true"></id_default_combination>
 <id_tax_rules_group></id_tax_rules_group>
 <position_in_category not_filterable="true"><![CDATA[1]]></position_in_category>
 <manufacturer_name not_filterable="true"><![CDATA[bKT]]></manufacturer_name>
 <quantity not_filterable="true"></quantity>
 <type not_filterable="true"><![CDATA[simple]]></type>
 <id_shop_default><![CDATA[1]]></id_shop_default>
 <reference></reference>
 <supplier_reference></supplier_reference>
 <location></location>
 <width></width>
 <height></height>
 <depth></depth>
 <weight></weight>
 <quantity_discount></quantity_discount>
 <ean13></ean13>
 <upc></upc>
 <cache_is_pack></cache_is_pack>
 <cache_has_attachments></cache_has_attachments>
 <is_virtual></is_virtual>
 <on_sale></on_sale>
 <online_only></online_only>
 <ecotax></ecotax>
 <minimal_quantity><![CDATA[1]]></minimal_quantity>
 <price><![CDATA[818.00]]></price>
 <wholesale_price></wholesale_price>
 <unity></unity>
 <unit_price_ratio></unit_price_ratio>
 <additional_shipping_cost></additional_shipping_cost>
 <customizable></customizable>
 <text_fields></text_fields>
 <uploadable_files></uploadable_files>
 <active><![CDATA[1]]></active>
 <redirect_type></redirect_type>
 <id_product_redirected></id_product_redirected>
 <available_for_order><![CDATA[1]]></available_for_order>
 <available_date></available_date>
 <condition><![CDATA[new]]></condition>
 <show_price><![CDATA[1]]></show_price>
 <indexed></indexed>
 <visibility><![CDATA[both]]></visibility>
 <advanced_stock_management></advanced_stock_management>
 <date_add><![CDATA[2014-01-17 12:47:32]]></date_add>
 <date_upd><![CDATA[2014-01-17 12:47:32]]></date_upd>
 <meta_description><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></meta_description>
 <meta_keywords><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></meta_keywords>
 <meta_title><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></meta_title>
 <link_rewrite><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[184-38BKTTR-13512PLYTT]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[184-38BKTTR-13512PLYTT]]></language></link_rewrite>
 <name><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[18.4-38 BKT TR-135 12 PLY TT]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[18.4-38 BKT TR-135 12 PLY TT]]></language></name>
 <description><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></description>
 <description_short><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[b467 H1750 A5145]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[b467 H1750 A5145]]></language></description_short>
 <available_now><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></available_now>
 <available_later><language id="1" xlink:href="http://www.webshop.com/api/languages/1"><![CDATA[]]></language><language id="6" xlink:href="http://www.webshop.com/api/languages/6"><![CDATA[]]></language></available_later>
<associations>
<categories node_type="category">
 <category xlink:href="http://www.webshop.com/api/categories/2">
 <id><![CDATA[2]]></id>
 </category>
 <category xlink:href="http://www.webshop.com/api/categories/18">
 <id><![CDATA[18]]></id>
 </category>
</categories>
<images node_type="image"/>
<combinations node_type="combinations"/>
<product_option_values node_type="product_options_values"/>
<product_features node_type="product_feature">
 <product_feature xlink:href="http://www.webshop.com/api/product_features/16">
 <id><![CDATA[16]]></id>
 <custom><![CDATA[0]]></custom>
 <id_feature_value xlink:href="http://www.webshop.com/api/product_feature_values/108"><![CDATA[108]]></id_feature_value>
 </product_feature>
</product_features>
<tags node_type="tag">
 <tag xlink:href="http://www.webshop.com/api/tags/0">
 <id><![CDATA[0]]></id>
 </tag>
</tags>
<stock_availables node_type="stock_available">
 <stock_available xlink:href="http://www.webshop.com/api/stock_availables/859">
 <id><![CDATA[859]]></id>
 <id_product_attribute><![CDATA[0]]></id_product_attribute>
 </stock_available>
</stock_availables>
<accessories node_type="product"/>
<product_bundle node_type="products"/>
</associations>
</product>
</prestashop>

 

 

Link to comment
Share on other sites

  • 1 month later...

[solved]

You have a problem in your XML... You have two product_features node so i think that the behavior is normal ;) I hope this is the cause of your problem, don't forget to pass your subject in resolved if it is the case.

<product_features>
    <product_feature>
    <id>6</id>
    <custom>0</custom>
    <id_feature_value>131</id_feature_value>
    </product_feature>
</product_features>
<product_features>

    <product_feature><id>16</id><custom>0</custom><id_feature_value>108</id_feature_value</product_feature>
</product_features>


 

Link to comment
Share on other sites

×
×
  • Create New...