GetStreet () endup in una matrice di errore di conversione stringa?
-
16-10-2019 - |
Domanda
Sto provando a chiamare tutte le informazioni del cliente dopo aver piazzato un ordine e inserto tutte queste informazioni in un database. Tutti i parametri sono di passaggio ok accanto getStreet (), che finisce come array in banca dati, solo la parola array viene inserito nella banca dati.
Ecco il mio codice:
$client = new SoapClient('http://xxxxxxxxxx', array("connection_timeout"=>120));
$aWebOrder->CustomerAddress = new CustomerAddress;
$aWebOrder->CustomerAddress->Email = $order->getCustomerEmail();
$aWebOrder->CustomerAddress->Address1 = $order->getBillingAddress()->getStreet();
$aWebOrder->CustomerAddress->City = $order->getBillingAddress()->getCity();
$aWebOrder->CustomerAddress->State = $order->getBillingAddress()->getRegion();
$aWebOrder->CustomerAddress->PostalCode = $order->getBillingAddress()->getPostcode();
$aWebOrder->CustomerAddress->CountryID = $order->getBillingAddress()->getCountry();
$params = array(
'OrderWebAPILogin' => array("login" => 'xxx', "password"=> 'xxx'),
'DbVersion' => 16,
'Order' => $aWebOrder,
'RequestOptions' => NULL
);
$result = $client->addOrder($params);
L'errore che ottengo nel file di log è:
Array alla conversione di stringhe in C: \ xampp \ htdocs \ xxx \ app \ code \ locale \ InsertOrder \ OrderExport \ modello \ export.php on line 215
La linea 215 è questa linea:
$result = $client->addOrder($params);
Soluzione
Usa $order->getBillingAddress()->getData('street')
e restituisce dati in formato stringa. Se si utilizza $order->getBillingAddress()->getStreet()
restituisce matrice che è contiene dati Street1 e STREET2. Vedere Classe Mage_Customer_Model_Address_Abstract
per ulteriori informazioni.