如果我按以下方式加载客户:
$customer = Mage::getModel('customer/customer')
->load($customer_id);
区别:
$customer -> getDefaultShippingAddress();
和
$customer -> getPrimaryShippingAddress();
提前致谢!
答案 0 :(得分:7)
他们返回相同的结果
请参阅/app/code/core/Mage/Customer/Model/Customer.php
/*
* @return Mage_Customer_Model_Address
*/
public function getPrimaryBillingAddress()
{
return $this->getPrimaryAddress('default_billing');
}
/**
* Get customer default billing address
*
* @return Mage_Customer_Model_Address
*/
public function getDefaultBillingAddress()
{
return $this->getPrimaryBillingAddress();
}
答案 1 :(得分:1)
没有,因为getDefaultShippingAddress()在内部调用getPrimaryShippingAddress()。您可以在/app/code/local/Mage/Customer/Model/Customer.php中自行检查代码
/**
* Get default customer shipping address
*
* @return Mage_Customer_Model_Address
*/
public function getPrimaryShippingAddress()
{
return $this->getPrimaryAddress('default_shipping');
}
/**
* Get default customer shipping address
*
* @return Mage_Customer_Model_Address
*/
public function getDefaultShippingAddress()
{
return $this->getPrimaryShippingAddress();
}