2015-04-04 54 views
0

林有問題通過使用的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) 
        { 
        } 

即時得到的是錯誤響應的錯誤。任何線索我做錯了什麼?

+0

更換線$opt = array('resource' => 'customers');嘗試從瀏覽器'url'如果是帶幾個參數正確。 – 2015-04-06 10:19:49

回答

0

你應該$opt = array('resource' => 'addresses');