Magento 1.7/1.8: How to Join Collection to Table

collection;join;magento-1.7magento-1.8

So, I have subscribers collection:

$subscribersCollection =  Mage::getModel('newsletter/subscriber')->getCollection();

I want to join customer collection to it by email, so I did next:

$subscribersCollection->getSelect()
     ->join(array('cus'=>'customer_entity'),'cus.email=main_table.subscriber_email');

But in this way I only join customer_entity table, but not all the customer collection.
I think about also join other customers tables. Is there any better way to join customer collection?

UPDATE:

I have tried

$customerCollection = Mage::getResourceModel('customer/customer_collection'); 
$customerCollection->getSelect()->join(array('cus'=>'newsletter_subscriber'),'cu‌​s.subscriber_email = e.email');
$customerCollection->getItems()

Now it work, thanks

Best Answer

You're going to kick yourself when I show you :-)

Create a customer collection instance and join the newsletter table on that.

Related Topic