我正在嘗試使用代碼添加客戶(hù),但 PrestaShop 給了我一個(gè)錯(cuò)誤。我使用 PHP 和 XML$XMLRQString = '<?xml version="1.0" encoding="utf-8"?>'. '<x:Winmax4GetEntitiesRQ xmlns:x="urn:Winmax4GetEntitiesRQ">'. '</x:Winmax4GetEntitiesRQ >'; $Params=array( 'CompanyCode'=>'', 'UserLogin'=>'', 'UserPassword'=>'', 'Winmax4GetEntitiesRQXML'=> $XMLRQString ); $return = $client->GetEntities($Params); $XMLRSString = new SimpleXMLElement($return->GetEntitiesResult);foreach ($XMLRSString->Entities->Entity as $entity){ $default_lang= Configuration::get('PS_LANG_DEFAULT'); $customer=new Customer(); $customer->email= $entity->Email; $customer->lastname= $entity->EntityType; $customer->firstname= [$default_lang => $entity->Name]; $customer->contribuinte= $entity->TaxPayerID; $customer->passwd= $entity->TaxPayerID; $customer->active = 1; $customer->add();}錯(cuò)誤:(1/1) ContextErrorException 警告:preg_match() 期望參數(shù) 2 為字符串,給定數(shù)組在 Validate.php 第 172 行在 ValidateCore::isCustomerName(array(object(SimpleXMLElement))) 在 ObjectModel.php 第 1149 行在 ObjectModelCore->validateField('firstname', array(object(SimpleXMLElement))) 在 ObjectModel.php 第 981 行在 ObjectModelCore->validateFields() 在 ObjectModel.php 第 284 行在 ObjectModelCore->getFields() 在 ObjectModel.php 第 551 行在 ObjectModelCore->add(true, true) 在 Customer.php 第 264 行在 create_clients.php 第 66 行中的 CustomerCore->add()
- 1 回答
- 0 關(guān)注
- 173 瀏覽
添加回答
舉報(bào)
0/150
提交
取消