I am trying to call all the customer info after placing an order and insert all these info into a database. All the parameters are passing ok beside getStreet() which ends up as array into database, Just the word array is inserted into database.

Here is my code:

$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);

The error i get into the log file is :

Array to string conversion in C:\xampp\htdocs\xxx\app\code\local\InsertOrder\OrderExport\Model\Export.php on line 215

The line 215 is this line:

 $result = $client->addOrder($params);

1 Answer 1


Use $order->getBillingAddress()->getData('street') and it returns string format data. If you use $order->getBillingAddress()->getStreet() it returns array which is contains street1 and street2 data. See Mage_Customer_Model_Address_Abstract class for further information.

  • The class also has a method defined to return the text formatted street lines: getStreetFull(). More generally you could use implode() to combine the items of an array: implode("\n", $address->getStreet()). Oct 22, 2013 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.