I am trying to get list of all billing addresses of all orders along with other information. Rest is working fine.
This is the function:
public function getHtml()
{
$_orders = $this->order->getOrders();
foreach ($_orders as $order){
$itemName = '';
$itemQty = '';
$customerName = '';
$billingAddress = '';
$OrderId = $order->getEntityId();
$customerName= $order->getCustomerName();
$billingAddress = $order->getBillingAddress();
$OrderItems = $order->getAllItems();
foreach ($OrderItems as $item) {
$itemQty.= $item->getQtyOrdered().'<br />';
$itemName.= $item->getName().'<br />';
}
echo $OrderId;
echo $customerName;
echo $itemName;
echo $itemQty
echo $billingAddress;
}
Problem is when I do
$billingAddress = $order->getBillingAddress();
Get this: 1 exception(s): Exception #0 (Exception): Recoverable Error: Object of class Magento\Sales\Model\Order\Address could not be converted to string in..remote file path and line number
and when
$billingAddress = $order->getBillingAddress()->getStreet();
Get this: 1 exception(s): Exception #0 (Exception): Notice: Array to string conversion in remote file path and line number