hola a todos
porfavor no logro realizar lo sigte, necesito recorrer un xml que me entrega un servicio web y despues guardar esos datos como un nuevo producto en MAGENTO, ambas cosas las he logrado por separado:
-consultar y listar en variables los datos del servicio web
-enviar datos de prueba solo textos a MAGENTO con su API SOAP
el PROBLEMOTA es cuando quice unir ambos procesos para que funcionara automaticamente con los datos del servicio web. me saca este error
Código:
Fatal error: Uncaught SoapFault exception: [1] Internal Error. Please see log for details. in C:\xampp\htdocs\CrearProduct.php:93 Stack trace: #0 C:\xampp\htdocs\CrearProduct.php(93): SoapClient->__call('call', Array) #1 C:\xampp\htdocs\CrearProduct.php(93): SoapClient->call('255327c95fd5bed...', 'catalog_product...', Array) #2 {main} thrown in C:\xampp\htdocs\CrearProduct.php on line 93
agradezco a quien pueda ayudarme a ver el error porfavor.
este es el codigo que estoy usando:
Código:
<?php
//ejemplo de consulta al servicio web ALICE por inventario
$xml = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<request>
<type>Product</type>
<filters>
<filter>
<field>classid</field>
<like>class_899m</like>
</filter>
<filter>
<field>currency</field>
<like>cop</like>
</filter>
<filter>
<field>name</field>
<like>until%</like>
</filter>
</filters>
</request>
EOD;
$url = "http://se2.dyndns.org/alicerest/get.php";
$data = array('request'=>$xml);
$options = array
(
'http' => array
(
'header'=>"Content-type: application/x-www-form-urlencoded\r\n",
'method'=>'POST',
'content'=>http_build_query($data)
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$xmlresp=simplexml_load_string($result) or die ("message");
//recorrer el xmlresp
foreach($xmlresp->products->product as $item)
{
$whenmod= $item->whenmod;
$sku= $item->sku;
$name= $item->name;
$release= $item->release;
$released= $item->released;
$enable= $item->enable;
$online= $item->online;
$sellnew= $item->sellnew;
$sellused= $item->sellused;
$platform= $item->platform;
$category= $item->category;
$categoryid= $item->categoryid;
$box= $item->box;
$publisher= $item->publisher;
$genre= $item->genre;
$upc= $item->upc;
//pasar informacion a MAGENTO
$client = new SoapClient('http://02b2816.netsolhost.com/playntrade/index.php/api/soap/?wsdl');
// datos de conexion con el servicio web de magento
$session = $client->login('playoscar', 'playtrade55');
// get attribute set
$attributeSets = $client->call($session, 'product_attribute_set.list');
$attributeSet = current($attributeSets);
$resultado = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
'categories' => array(2),
'websites' => array(1),
'name' => $name,
'description' => 'descripcion del videojuego',
'short_description' => 'pequeña descripcion del producto',
'status' => $online,
'visibility' => '4',
'special_from_date' => $release,
'price' => $sellnew,
'tax_class_id' => '1',
'meta_title' => 'Product meta title',
'meta_keyword' => $name,
'meta_description' => $name,
'category_ids' => '16',
'sku' => $sku,
'custom_design' => 'ma_petsyshop',
'custom_layout_update' => '1 column',
'options_container' => 'Block after Info Column',
'qty' => '2',
'manage_stock' => 'yes',
'use_config_min_qty' => '1'
)));
}
?>