的Prestashop Web服务添加地址
问题描述:
林有问题通过使用的PrestaShop 1.6.0.14和PSWebServiceLibrary 的WebServices 林创造新ADDRES这里是我的代码:的Prestashop Web服务添加地址
try
{
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$xml = $webService->get(array('url' => 'http://raj-dla-ogrodu.pl/api/addresses?schema=blank'));
$resources = $xml->children()->children();
$infos = array(
'id_customer' => '50',
'id_country' => '14',
'id_state' => '0',
'alias' => 'Allegro',
'id_manufacturer' => '0',
'id_supplier' => '0',
'id_warehouse' => '0',
'deleted' => '0',
'lastname' => 'test',
'firstname' => 'test',
'address1' => 'Klient',
'address2' => '111',
'postcode' => $transakcje->RecipientZip,
'city' => 'test',
'phone_mobile' => $transakcje->RecipientPhone,
'phone' => $transakcje->RecipientPhone,
);
foreach ($resources as $nodeKey => $node)
{
$resources->$nodeKey = $infos[$nodeKey];
}
$opt = array('resource' => 'customers');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);
}
catch (PrestaShopWebserviceException $ex)
{
}
即时得到的是错误响应的错误。任何线索我做错了什么?
答
你应该$opt = array('resource' => 'addresses');
更换线
$opt = array('resource' => 'customers');
尝试从浏览器'url'如果是带几个参数正确。 – 2015-04-06 10:19:49