我尝试通过 Web 服务添加产品,但收到以下错误代码:
RETURN HTTP BODY
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
</error>
</errors>
</prestashop>
我正在搜索 2 天,但什么也没有。请问有人可以帮我吗?我的代码如下。
define('DEBUG', true);
define('_PS_DEBUG_SQL_', true);
define('PS_SHOP_PATH', 'http://mywebsiteinlocalhost.gr/dev...shop/trunk/src/');
define('PS_WS_AUTH_KEY', 'CBYB5G5UVRA7FCN7JK2WZ625DFWG8SK3');
require_once ('./PSWebServiceLibrary.php');
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$opt = array('resource' => 'products');
$xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/products?schema=synopsis'));
$resources = $xml->children()->children();
unset($resources->position_in_category);
unset($resources->manufacturer_name);
$resources->price = '1000';
$resources->active = '1';
$resources->quantity = '50';
$resources->link_rewrite = 'blabla';
$resources->name->language[0][0] = 'blabla';
$resources->description->language[0][0] = '<p>blabla</p>';
$resources->description_short->language[0][0] = 'blabla';
$resources->associations = '';
$opt = array('resource' => 'products');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);