0

This question already has an answer here:

I am Joining two tables by following code

$collection = Mage::getModel('commission/commission')->getCollection();
    $collection->getSelect()->join(
        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.:)

marked as duplicate by Fabian Blechschmidt, Marius, David Manners, Keyul Shah, Matthias Zeis Jul 10 '14 at 14:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

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:

$collection->getTable('customer/customer')

With

Mage::getSingleton('core/resource')->getTableName('customer/customer')
  • 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.