Mirko Renzetti Posted April 15, 2014 Share Posted April 15, 2014 Salve a tutti, sto cercando di creare dei prodotti tramite webservice ma ho qualche difficoltà.Ho già letto vari post che parlano di questo argomento, ma non sono stati d'aiuto. Il problema è sempre lo stesso: si genera un errore ma non si sa quale.Tramite webservice recupero il modello del prodotto (la versione con schema=synopsis) <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <product> <id_manufacturer format="isUnsignedId"></id_manufacturer> <id_supplier format="isUnsignedId"></id_supplier> <id_category_default format="isUnsignedId"></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 format="isUnsignedId"></id_tax_rules_group> <position_in_category not_filterable="true"></position_in_category> <manufacturer_name not_filterable="true"></manufacturer_name> <quantity not_filterable="true"></quantity> <type not_filterable="true"></type> <id_shop_default format="isUnsignedId"></id_shop_default> <reference maxSize="32" format="isReference"></reference> <supplier_reference maxSize="32" format="isReference"></supplier_reference> <location maxSize="64" format="isReference"></location> <width format="isUnsignedFloat"></width> <height format="isUnsignedFloat"></height> <depth format="isUnsignedFloat"></depth> <weight format="isUnsignedFloat"></weight> <quantity_discount format="isBool"></quantity_discount> <ean13 maxSize="13" format="isEan13"></ean13> <upc maxSize="12" format="isUpc"></upc> <cache_is_pack format="isBool"></cache_is_pack> <cache_has_attachments format="isBool"></cache_has_attachments> <is_virtual format="isBool"></is_virtual> <on_sale format="isBool"></on_sale> <online_only format="isBool"></online_only> <ecotax format="isPrice"></ecotax> <minimal_quantity format="isUnsignedInt"></minimal_quantity> <price required="true" format="isPrice"></price> <wholesale_price format="isPrice"></wholesale_price> <unity format="isString"></unity> <unit_price_ratio></unit_price_ratio> <additional_shipping_cost format="isPrice"></additional_shipping_cost> <customizable format="isUnsignedInt"></customizable> <text_fields format="isUnsignedInt"></text_fields> <uploadable_files format="isUnsignedInt"></uploadable_files> <active format="isBool"></active> <redirect_type format="isString"></redirect_type> <id_product_redirected format="isUnsignedId"></id_product_redirected> <available_for_order format="isBool"></available_for_order> <available_date format="isDateFormat"></available_date> <condition format="isGenericName"></condition> <show_price format="isBool"></show_price> <indexed format="isBool"></indexed> <visibility format="isProductVisibility"></visibility> <advanced_stock_management format="isBool"></advanced_stock_management> <date_add format="isDateFormat"></date_add> <date_upd format="isDateFormat"></date_upd> <meta_description maxSize="255" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></meta_description> <meta_keywords maxSize="255" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></meta_keywords> <meta_title maxSize="128" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></meta_title> <link_rewrite required="true" maxSize="128" format="isLinkRewrite"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></link_rewrite> <name required="true" maxSize="128" format="isCatalogName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></name> <description format="isCleanHtml"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></description> <description_short format="isCleanHtml"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></description_short> <available_now maxSize="255" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></available_now> <available_later maxSize="255" format="IsGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId" ></language><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId" ></language></available_later> <associations> <categories node_type="category"> <category> <id required="true"></id> </category> </categories> <images node_type="image"> <image> <id></id> </image> </images> <combinations node_type="combinations"> <combinations> <id required="true"></id> </combinations> </combinations> <product_option_values node_type="product_options_values"> <product_options_values> <id required="true"></id> </product_options_values> </product_option_values> <product_features node_type="product_feature"> <product_feature> <id required="true"></id> <custom></custom> <id_feature_value xlink:href="http://localhost/prestashop/api/product_feature_values/" required="true"></id_feature_value> </product_feature> </product_features> <tags node_type="tag"> <tag> <id required="true"></id> </tag> </tags> <stock_availables node_type="stock_available"> <stock_available> <id required="true"></id> <id_product_attribute required="true"></id_product_attribute> </stock_available> </stock_availables> <accessories node_type="product"> <product> <id xlink:href="http://localhost/prestashop/api/product/" required="true"></id> </product> </accessories> <product_bundle node_type="products"> <products> <id required="true"></id> <quantity></quantity> </products> </product_bundle> </associations> </product> </prestashop> Ci sono comunque dei dati che pur essendo segnati come obbligatori non lo sono realmente (ad esempio l'id dei tag e tutte le entità in associations).Inserisco nel modello i dati del mio prodotto <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <product> <id_manufacturer format="isUnsignedId"></id_manufacturer> <id_supplier format="isUnsignedId">1</id_supplier> <id_category_default format="isUnsignedId"/> <new/> <cache_default_attribute/> <id_default_image not_filterable="true"/> <id_default_combination not_filterable="true"/> <id_tax_rules_group format="isUnsignedId"/> <position_in_category not_filterable="true"/> <manufacturer_name not_filterable="true"/> <quantity not_filterable="true">10</quantity> <type not_filterable="true"/> <id_shop_default format="isUnsignedId">1</id_shop_default> <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"/> <price required="true" format="isPrice">115</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"/> <available_date format="isDateFormat"/> <condition format="isGenericName"/> <show_price format="isBool"/> <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://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></meta_description> <meta_keywords maxSize="255" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></meta_keywords> <meta_title maxSize="128" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></meta_title> <link_rewrite required="true" maxSize="128" format="isLinkRewrite"><language id="2">test-product-01</language><language id="1">prodotto-di-prova-01</language></link_rewrite> <name required="true" maxSize="128" format="isCatalogName"><language id="2">Test product 01</language><language id="1">Prodotto di prova 01</language></name> <description format="isCleanHtml"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></description> <description_short format="isCleanHtml"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></description_short> <available_now maxSize="255" format="isGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></available_now> <available_later maxSize="255" format="IsGenericName"><language id="1" xlink:href="http://localhost/prestashop/api/languages/1" format="isUnsignedId"/><language id="2" xlink:href="http://localhost/prestashop/api/languages/2" format="isUnsignedId"/></available_later> <associations> <categories node_type="category"> <category><id>42</id></category></categories> <images node_type="image"></images> <combinations node_type="combinations"></combinations> <product_option_values node_type="product_options_values"></product_option_values> <product_features node_type="product_feature"></product_features> <tags node_type="tag"></tags> <stock_availables node_type="stock_available"></stock_availables> <accessories node_type="product"></accessories> <product_bundle node_type="products"></product_bundle> </associations> </product> </prestashop> Ma quello che ricevo in risposta è un bel Internal error. To see this error please display the PHP errors. ma naturalmente nessun errore è visualizzato o loggato (ho modificato tutte le impostazioni del php.ini per far visualizzare gli errori, sia sulla macchina client che server dove risiede l'istanza di Prestashop; ho provato anche con l'istanza di Prestashop sulla stessa macchina del client ma niente) Dov'è che sbaglio? Grazie a tutti per aiuto Link to comment Share on other sites More sharing options...
vekia Posted April 15, 2014 Share Posted April 15, 2014 duplicated, continue discussion here: http://www.prestashop.com/forums/topic/323733-creazione-prodotti-via-api-prestashop-v16/ Link to comment Share on other sites More sharing options...
Recommended Posts