We have a custom Customer Address Attribute that contains email of an existing user in the system. If this field is populated for a customer’s address, then this address appears on the list of addresses for the customer (who’s email address is assigned). These addresses appear on product list and detail pages during add to cart. Purpose is to allow store managers to have addresses for some customers so that they can place their orders if needed.
We also need to show this address for customer when he is looking at his addresses in My Stores (Stores).
We have added a collection class that extends from Mage_Customer_Model_Resource_Address_Collection and override method: setCustomerFilter.
Below is the code for the method:
if ($customer->getId()) {
$this->addAttributeToFilter(array(
array(
'attribute' => 'parent_id',
'in' => array($customer->getId()),
),
array(
'attribute' => ‘store_manager',
'in' => array($customer->getId()),
),
));
} else {
$this->addAttributeToFilter('parent_id', '-1');
}
return $this;
Customer data is not loading, and all address for customer just got hide when this code is executed. Please suggest what I am missing.