简体   繁体   中英

Get customer's shipping address country in Magento

I have the customers id so when I do the following to get the other shipping information the country comes out empty. Anybody know another way to get the country or know why it is empty?

        //get shipping address
        $shippingaddress = Mage::getModel('customer/address')->load($customer->default_shipping);
        $addressdata = $shippingaddress ->getData();
        $addressdata['city'];
        $addressdata['postcode'];
        $addressdata['region'];
        $addressdata['telephone'];
        $addressdata['country'];

$addressdata = $shippingaddress ->getData();

do a var_dump($addressdata);

whatever is displayed can be used using ->getData('varName')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM