Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - Default vs. Primary Shipping Address

Tags:

magento

If I load a customer in the following way:

$customer = Mage::getModel('customer/customer')
    ->load($customer_id);

Whats the difference between:

$customer -> getDefaultShippingAddress();

and

$customer -> getPrimaryShippingAddress();

Thanks in advance!

like image 262
marius2k12 Avatar asked Feb 18 '23 20:02

marius2k12


2 Answers

They return the same result

See /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();
}
like image 87
Renon Stewart Avatar answered Feb 26 '23 21:02

Renon Stewart


Nothing because getDefaultShippingAddress() calls internally getPrimaryShippingAddress(). You can check the code yourself in /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();
}
like image 36
Niborb Avatar answered Feb 26 '23 21:02

Niborb