如果我通过以下方式加载客户:
$customer = Mage::getModel('customer/customer')
->load($customer_id);
有什么区别:
$customer -> getDefaultShippingAddress();
和
$customer -> getPrimaryShippingAddress();
提前致谢!
如果我通过以下方式加载客户:
$customer = Mage::getModel('customer/customer')
->load($customer_id);
有什么区别:
$customer -> getDefaultShippingAddress();
和
$customer -> getPrimaryShippingAddress();
提前致谢!
他们返回相同的结果
见/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();
}
什么都没有,因为 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();
}