I am Joining two tables by following code

$collection = Mage::getModel('commission/commission')->getCollection();
        array('customer' => $collection->getTable('customer/customer')),
        'main_table.customer_id = customer.id');

commission/commission is my custom module and flat table. that contain customer_id.

I am getting Error like this

Can't retrieve entity config: customer/customer

I am not understanding what is happening, Please suggest anything wrong, Thanks in advance.:)


I believe this is because you're trying to get the table name from the commissions collection. Try and get the table name from the core/resource model. Simply replace:



| improve this answer | |
  • No I am not getting it properly, Same error:[ – Charlie Jul 10 '14 at 11:42
  • $collection = Mage::getModel('customer/customer')->getCollection(); $collection->getSelect()->joinLeft( array('commission' => $collection->getTable('commission/commission')), 'e.entity_id = commission.customer_id'); By above change now it say's Item (Mage_Customer_Model_Customer) with the same id "41" already exist – Charlie Jul 10 '14 at 11:43
  • how to add duplicate entity_id in collection, Now, I got to know that if entity_id already exist in collection then magento throw this error, Do you have any idea for this? – Charlie Jul 10 '14 at 12:19
  • @Charlie try grouping them on the entity_id ->group('entity_id') on your join – Dave Jul 11 '14 at 8:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.