0

I need to report order numbers and matching delivery addresses from Magento 1 orders data.

I have no idea where, or how to query for this report.

I have found answers to this question such as : "enter:

$order->getBillingAddress()->getStreet(1);
$order->getBillingAddress()->getStreet(2);"

But I have no idea WHERE to enter that code!?!? or how to execute it....

Might be a silly question - but we all have to start somewhere ...

0

If you have the increment ID for the order (the one that shows when viewing an order, right at the top), you can load it as follows, where $orderId is set to whatever that ID is:

$orderId = "E00047487";
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);

Now to get the billing address information, just use the code that you've provided in your question, or alternatively something like this:

$billingStreet  = $order->getBillingAddress()->getData('street');
$billingStreet1 = $billingStreet[0];
$billingStreet2 = $billingStreet[1];
$billingStreet3 = $billingStreet[2];

This pulls all of the billing street information into an array, and each part of it can be accessed like above (how you'd access an array typically)

Your Answer

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

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