Magento get chosen shipping and billing method address fields

Bob van Luijt picture Bob van Luijt · Nov 26, 2012 · Viewed 11.7k times · Source

How can I get the choosen shipping and billing fields during checkout? (I want to show them in sidebars)

I use this in shipping.phtml but ofcourse that's just for the current 'address' (and I want to use it in methods.phtml and other pages)

$this->getAddress()->getFirstname()

So I assumed that this would work out...

Mage::getSingleton('checkout/session')->getShippingAddress()->getFirstname()

But it didn't, anybody has a tip?

Addition: This one was helping me a lot, but I'm stuck :-S How do I get the shipping method the user has chosen during checkout?

Answer

user487772 picture user487772 · Nov 26, 2012

Shipping and billing addresses are children of quote object. So something like this shall work:

Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getFirstname();