alpires2000 Posted December 14, 2014 Share Posted December 14, 2014 Amigos, estou precisando muito de uma ajuda, já testei vários códigos e nenhum funcionou, eu tenho que adicionar produtos pelo webservice do prestashop mas somente estou recebendo erro 500. Estou usando o prestashop 1.6 Vejam um exemplo do meu código: <?phpdefine('DEBUG', true);define('_PS_DEBUG_SQL_', true);define('PS_SHOP_PATH', 'http://127.0.0.1/ps');define('PS_WS_AUTH_KEY', 'minha_key'); require_once('PSWebServiceLibrary.php');$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $xml_product = $webService->get(array('resource' => 'products?schema=blank')); $resources_product = $xml_product->children()->children(); $resources_product->id_manufacturer ='1';$resources_product->id_supplier ='1';$resources_product->id_category_default ='27';$resources_product->cache_default_attribute;$resources_product->id_default_image;$resources_product->id_default_combination;$resources_product->id_tax_rules_group; $resources_product->manufacturer_name; $resources_product->type;$resources_product->id_shop_default;$resources_product->reference='SKUID45';$resources_product->supplier_reference;$resources_product->location;$resources_product->width;$resources_product->height; $resources_product->depth; $resources_product->weight;$resources_product->quantity_discount; $resources_product->ean13;$resources_product->upc;$resources_product->cache_is_pack;$resources_product->cache_has_attachments;$resources_product->is_virtual;$resources_product->on_sale;$resources_product->online_only;$resources_product->ecotax;$resources_product->minimal_quantity;$resources_product->price='20.00';$resources_product->wholesale_price;$resources_product->unity;$resources_product->unit_price_ratio; $resources_product->additional_shipping_cost;$resources_product->customizable;$resources_product->text_fields;$resources_product->uploadable_files;$resources_product->active='1';$resources_product->redirect_type;$resources_product->id_product_redirected;$resources_product->available_for_order;$resources_product->available_date; $resources_product->condition ='new'; $resources_product->show_price; $resources_product->indexed ='1';$resources_product->visibility = 'both';$resources_product->advanced_stock_management;$resources_product->date_add;$resources_product->date_upd;$resources_product->meta_description->language ='Product Meta Description';$resources_product->meta_keywords->language='Product Meta keywords';$resources_product->meta_title->language='Product Meta Title';$resources_product->link_rewrite->language='product-url-key'; $resources_product->name->language='Product Name'; $resources_product->description->language='Product Description';$resources_product->description_short->language='Product Short Description ';$resources_product->available_now->language='30/10/14'; $resources_product->available_later->language;$resources_product->associations->categories->addChild('category')->addChild('id', 27);$xml_product = $webService->add(array('resource' => 'products', 'postXml' => $xml_product->asXML())); ?> Será que alguém poderia me ajudar a resolver esse problema ? Grato Alexandre Link to comment Share on other sites More sharing options...
selectshop.at Posted December 14, 2014 Share Posted December 14, 2014 (edited) Máquina local ou server em producao ? Módulo curl está ativado ? Direitos de escrita corretamente configurados ? Erro 500 sao erros do servidor. vc. já consultou os logs de erro do mesmo ? Edited December 14, 2014 by selectshop.at (see edit history) Link to comment Share on other sites More sharing options...
alpires2000 Posted December 14, 2014 Author Share Posted December 14, 2014 Então, estou tentando em um server local, o problema é que eu consigo adicionar categoria, ou seja, para categoria funciona bem. Eu acredito que seja algum campo de produtos que devo estar passando incorretamente. Link to comment Share on other sites More sharing options...
selectshop.at Posted December 15, 2014 Share Posted December 15, 2014 (edited) Existe um tópico com o mesmo problem já faz um tempo atrás. Deverá analisar o tráfico e os logs de erro do seu XAMPP (ou servidor) http://www.prestashop.com/forums/topic/366050-edit-product-with-web-service-prestashop-16/?do=findComment&comment=1852956 Como usar o servico webservice: http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service http://doc.prestashop.com/display/PS16/Web+service+one-page+documentation Parametros do webservice: http://doc.prestashop.com/display/PS16/Webservice+Parameters Exemplos: http://doc.prestashop.com/download/attachments/720902/CRUD%20Tutorial%20EN.pdf Edited December 15, 2014 by selectshop.at (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now