Here I want a Billing and Shopping addresses according to order_id. I receive a order data in my order object but it will give me just one record according to entity id.I want both address of order(billing and shipping).How to get the record through parent id instead of entity id.

 protected $order;

public function __construct(
\Magento\Sales\Model\Order\Address $order
) {
$this->order = $order;

public function orderlist($orderid) {
$order = $this->order->load($orderid);        
$billingAddress = $this->order->getData();

echo "<pre>";

  • what parentId do you mean? – Philipp Sander Aug 4 '17 at 10:20
  • database field. – vishnu salunke Aug 4 '17 at 10:21
  • parentid of order, address, .... ? I don't know what parentid you mean to which entity. order and address don't have parentids, that's why I'm asking – Philipp Sander Aug 4 '17 at 10:45
  • just use getParentId() instead of entity_id – Rohan Hapani Aug 4 '17 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.