0

for my magento backend I need a link which is consiting of different customer informations. So I want to get the specific Inforamions out of the backend but I don't know how. I've already looked into the adminhtml/.../template/sales/order/view/info.phtml and found the following line:

<?php echo $this->htmlEscape($_order->getCustomerName()) ?>

This is fine, but I need diffenent variables for Customer Name, - Street, -Postcode, City to build up a link like that: www.domain.de/category&name=CustomerName&Street=CustomerStreet& .... How can I get these variables? Thanks a lot for every answer!!

BerndK
  • 1
  • 1
  • 2
  • I believe I answered your question with sample code in my answer to this question: http://stackoverflow.com/questions/14743362 – Krista K Feb 08 '13 at 20:46

1 Answers1

0

Customers can theoretically have many addresses. If you need the one supplied as the billing address with the order, use

$address = $order->getBillingAddress()

This will return an object of the Mage_Sales_Model_Order_Address type, whose properties you can access via

$address->getCity()
$address->getStreet()

etc.

Otherwise you can fetch the customer's default billing address by calling

$address = $order->getCustomer()->getPrimaryBillingAddress()

You can access to the entire customer address collection as well:

$customerAddresses = $customer->getAddressesCollection()
Oleg Ishenko
  • 2,243
  • 1
  • 15
  • 16