亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我想通過代碼在 Prestashop 上添加 x 個客戶,但有額外的字段

我想通過代碼在 Prestashop 上添加 x 個客戶,但有額外的字段

PHP
楊__羊羊 2021-06-30 13:58:10
我正在嘗試使用代碼添加客戶,但 PrestaShop 給了我一個錯誤。我使用 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();}錯誤:(1/1) ContextErrorException 警告:preg_match() 期望參數 2 為字符串,給定數組在 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 回答

  • 1 回答
  • 0 關注
  • 174 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號