I'm making an extension, that lets the user define companies and add addresses to them. The plan is to show those addresses to the customer according to the value of an attribute in the customer (eg. Company_Id). Thanks to the help of R.S I was able to create an observer (eav_collection_abstract_load_before) which is called before the customer/address collection is loaded.
Now at this point I want to add my addresses to the collection, so they're shown on the customer Addressbook page, on checkout etc.
I created a model in the same schema as the customer/address model and tried:
$companyAddress = Mage::getModel('myNamespace_MyModule/companyaddress')->load(1); $CustomerAddressCollection->addItem($companyAddress);
Here I get the error: Attempt to add invalid object
How can I merge these two collections?