Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Admin > How to fetch shipping address attributes individually
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

Hi,

I’m trying to create a link under the [Add Tracking Number] button in /app/design/adminhtml/default/default/template/sales/order/shipment/create/tracking.phtml which has the individual shipping address attributes as GET variables in the URL.

I can get the link in that template block but I’m struggling to retrieve that particular order’s shipping address attributes.

I’m looking for something along the lines of these (using the attribute names from the eav_attribute table to illustrate which ones I need):

$_order->getShippingAddress()->getFirstname();
$_order->getShippingAddress()->getLastname();
$_order->getShippingAddress()->getCompany();
$_order->getShippingAddress()->getStreet();
$_order->getShippingAddress()->getRegion();
$_order->getShippingAddress()->getCity();
$_order->getShippingAddress()->getPostcode();
$_order->getShippingAddress()->getCountry_id();
$_order->getShippingAddress()->getFirstname();

In fact, I also need the Order number as displayed on the “New Shipment” page.

Had a look in the blocks there but failing to hit the nail on the head exactly.

Would appreciate your pointers, thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

The following code should work in this template:

<?php
$_order 
$this->getShipment()->getOrder();
$_shippingAddress $_order->getShippingAddress();
echo 
$_shippingAddress->getFirstname() . '<br />';
echo 
$_shippingAddress->getLastname() . '<br />';
echo 
$_shippingAddress->getCompany() . '<br />';
echo 
$_shippingAddress->getStreetFull() . '<br />';
echo 
$_shippingAddress->getRegion() . '<br />';
echo 
$_shippingAddress->getCity() . '<br />';
echo 
$_shippingAddress->getPostcode() . '<br />';
echo 
$_shippingAddress->getCountry_id() . '<br />';
?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top