I have a magento 1.9.2.4 with multistore (3 websites), and it has configured global accounts.
I need to filter the customer addresses by website.
For example, let's say the countries are France, Germany and UK.
If a customer with a french shipping address logs in the german website, I need that the french address is not available in the german website (or the Uk website).
If a customer with a german shipping address logs in the UK website, it shouldn't have available the german address in the UK website (or french).
But I have no clue where I should begin with this....
EDIT:
In system > configuration > SALES > Shipping Methods > Ship to Applicable Countries I have set Specific Countries
option and selected a different country by website.
Now, customers can't ship to a different country, but I need to not list at all the addresses from another countries and the other countries addresses are still there.
EDIT 2: I'm still searching, and I've tracked this code in app/design/frontend/rwd/myproject/template/opc/onepage/billing.phtml
<?php if ($this->customerHasAddresses()): ?>
<li class="wide">
<label for="billing-address-select" class="notice"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
<div class="input-box">
<?php echo $this->getAddressesHtmlSelect('billing') ?>
</div>
</li>
<?php endif; ?>
and getAddressesHtmlSelect leads me to:
public function getAddressesHtmlSelect($type)
{
if ($this->isCustomerLoggedIn()) {
$options = array();
foreach ($this->getCustomer()->getAddresses() as $address) {
$options[] = array(
'value' => $address->getId(),
'label' => $address->format('oneline')
);
}
$addressId = $this->getAddress()->getCustomerAddressId();
if (empty($addressId)) {
if ($type=='billing') {
$address = $this->getCustomer()->getPrimaryBillingAddress();
} else {
$address = $this->getCustomer()->getPrimaryShippingAddress();
}
if ($address) {
$addressId = $address->getId();
}
}
$select = $this->getLayout()->createBlock('core/html_select')
->setName($type.'_address_id')
->setId($type.'-address-select')
->setClass('address-select')
->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
->setValue($addressId)
->setOptions($options);
$select->addOption('', Mage::helper('checkout')->__('New Address'));
return $select->getHtml();
}
return '';
}