php-prestashop类';产品';找不到

php-prestashop类';产品';找不到,php,web-services,prestashop,prestashop-1.6,Php,Web Services,Prestashop,Prestashop 1.6,我正在使用php编写一个Web服务,并且正在使用PrestashopWebService库()。这是我的代码: define('DEBUG', true); define('PS_SHOP_PATH', 'http://xxxxx.com/'); define('PS_WS_AUTH_KEY', 'xxxxx'); require_once ('PSWebServiceLibrary.php'); $webService = new PrestaShopWebservice(PS_SH

我正在使用php编写一个Web服务,并且正在使用PrestashopWebService库()。这是我的代码:

    define('DEBUG', true);
define('PS_SHOP_PATH', 'http://xxxxx.com/');
define('PS_WS_AUTH_KEY', 'xxxxx');
require_once ('PSWebServiceLibrary.php');

$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$xml = $webService->get(array('url' => PS_SHOP_PATH .'/api/customers?schema=synopsis'));

$customer = array();
$product = array();

/*if (strlen($_POST('c_email'))>0)
    $customer['email'] = Tools::getValue('c_email');
else
    $customer['email'] = 'admin@yoursite.com';
*/
$customer['email'] ="navid.abutorab@gmail.com";
$customer['firstname'] = "navid";
$customer['lastname'] ="abutorab";
$customer['address1'] = "adres";
$customer['city'] = "citye";
$customer['phone'] = "09360544841";

$id['country'] = '165';
$id['lang'] = '1';
$id['currency'] = '1';
$id['carrier'] = '3';

$product['quantity'] ="1";
$id_product="10104";
$product['id'] = $id_product;
echo Product::getPriceStatic($product['id']) . "-----";
$product['price'] = Product::getPriceStatic($product['id']);
$product['name'] = Product::getProductName($product['id']);

$product['total'] = $product['price'] * $product['quantity'];

$xml->customer->firstname = $customer['firstname'];
$xml->customer->lastname = $customer['lastname'];
$xml->customer->email = $customer['email'];
$xml->customer->newsletter = '1';
$xml->customer->optin = '1';
$xml->customer->active = '1';


$opt = array('resource' => 'customers');
$opt['postXml'] = $xml->asXML();
$xml = $webService->add($opt);



// ID of created customer
$id['customer'] = $xml->customer->id;
当我运行页面时,出现以下错误:

Class 'Product' not found in /home/xxxxx/public_html/test/test.php on line 37
第37行是这一行:

$product['price'] = Product::getPriceStatic($product['id']);

我应该包括哪些内容才能使其正常工作

尝试在web服务代码的开头添加以下行

require_once(dirname(__FILE__).'/../../config/config.inc.php');

注意:请根据您的文件路径调整路径。您只需要包含“config.inc.php”文件。

您正在开发模块吗?如果您想使用PrestaShop类,您必须在PrestaShop环境中“工作”。@sarcom,不,我不是为模块开发的,我正在为我的应用程序开发api。我对prestashop环境不是很熟悉,我怎样才能包含这些类?你不能。。。您必须使用xmls和APIcalls@sarcom我正在使用库、xml和api,但该类不起作用。您能给我举个例子吗?您不能使用Product类,因为您不在PrestaShop环境中:)。您必须重新调用API才能像检索xml一样检索产品。例如,
$product=$webService->get(数组('resource'=>'product','id'=>$id\u product))