为了通过 REST API 将带有某些信息的客户下达的订单从 WooCommerce REST API 存储到 Exact Online 仪表板。我曾将PHP 客户端库用于 Exact Online。
虽然存在一个问题——在将数据存储到 Exact Online 之后,无法访问数组中的特定字段。具体来说,当使用
/api/v1/{division}/bulk/CRM/Accounts?
$filter=ID eq Email eq'nishanth@gmail.com'&$select=ID,Email
或者
$url = "https://start.exactonline.de/api/v1/" + mandant.number + "/crm/Accounts?
$filter=Email eq '" + orderitem.email + "'&$select=ID,Code";
在这里,您将看到以下代码
$customer = [
'address' => 'No.22/N, 91 Cross, XYZ Street, ABC Road',
'address2' => 'DEF',
'city' => 'GHI',
'customerid' => '999',
'country' => 'DE',
'name' => 'Nishanth',
'zipcode' => '123456'
];
// Create a new account
$account->AddressLine1 = $customer['address'];
$account->AddressLine2 = $customer['address2'];
$account->City = $customer['city'];
$account->Code = $customer['customerid'];
$account->Country = $customer['country'];
$account->IsSales = 'true';
$account->Name = $customer['name'];
$account->Postcode = $customer['zipcode'];
$account->Email = 'nishanth@gmail.com';
$account->Status = 'C';
$account->save();
这是用Email ID过滤后得到的结果
echo '<pre>'; print_r($account->filter("Email eq 'nishanth@gmail.com'"));
[attributes:protected] => Array
(
[Accountant] =>
[AddressLine1] => No.22/N, 91 Cross, XYZ Street, ABC Road
[AddressLine2] => DEF
[City] => GHI
[Code] => 1000
[ConsolidationScenario] => 6
[Country] => DE
[CountryName] => Germany
[Created] => /Date(1555764341137)/
[Creator] => 5bbfbd93-52f1-4f4b-b34e-fd213e479f8e
[CreatorFullName] => Nishanth
[Division] => 54810
[Email] => nishanth@gmail.com
[ID] => bb124287-647c-4267-bd60-004efa1302aa
[LogoThumbnailUrl] => https://start.exactonline.de//docs/images/placeholder_account_myeol.png
[LogoUrl] => https://start.exactonline.de//docs/images/placeholder_account_myeol.png
[Modified] => /Date(1555764341137)/
[Modifier] => 5bbfbd93-52f1-4f4b-b34e-fd213e479f8e
[ModifierFullName] => Nishanth
[Name] => Nishanth Jay
[Postcode] => 123456
)
利用以下内置功能,例如,
public function find()
{
$result = $this->connection()->get($this->url);
return new self($this->connection(), $result);
}
public function findWithSelect($select = '')
{
$result = $this->connection()->get($this->url, [
'$select' => $select
]);
return new self($this->connection(), $result);
}
尽管使用以下内置函数调用:
$Accounts->filter("Email eq 'nishanth@gmail.com'")[0]->findWithSelect('ID');
$checkAccount = $Accounts->filter("Email eq 'nishanth@gmail.com'");
$checkAccount[0]->find('ID');
$checkAccount[0]->findWithSelect('Code');
上面的内置库导致
[attributes:protected] => Array
(
)
我应该如何访问数组中的特定属性?
同样,CurrentDivision
通过调用$getCurrentDivision->findWithSelect('CurrentDivision');
或使用$getDivision->CurrentDivision;
为什么在检索数组后不能使用相同的功能?