I have created a custom entity table vaibhav_customtabs_product_entity, where I have following columns.

product_id (entity_id from 'catalog_product_entity')

Now my question is how do I join catalog_product_entity & vaibhav_customtabs_product_entity tables, based on the product entity id. So that, I can fetch the attribute value from my custom entity. Also from both the entity.

2 Answers 2

$collection = Mage::getModel('catalog/product')->getCollection(); 

                        array('cust' => $collection->getTable('vaibhav/customtabs')),
                        'cust.product_id' = 'main_table.entity_id'); 



return $this;

I'm assuming vaibhav/customtabs is you folder structure module_name

Here is a very good reference on how this works with Magento and using a flat and an EAV table. About 1/2 down you will see about 'Validating Your Bind'. In this case, that's your issue. I could write everything in here, but this reference should give you what you looking for. Good Luck and let us know how it turns out!


  • Hi @Anthony this article is about Joining of a flat table with EAV. But I am joining 2 EAV tables. I have gone through the article. It doesn't work out. Commented Mar 6, 2016 at 5:32
  • Can I have you skype id so that I can discuss with you directly. Commented Mar 6, 2016 at 5:33
  • I've edited the code a little on what I would do. Let me know if this works. Commented Mar 6, 2016 at 5:50
  • Thanks, I made some changes and it is working for me now. But the thing is I am not able to add filter here is my code $collection = Mage::getModel('vaibhav_customtabs/product')->getCollection() ->addAttributeToSelect(array('title','description')) ->addFieldToFilter('product_id', array('eq' => '1')); $collection->getSelect()->joinLeft( array('core'=> 'catalog_product_entity'), 'core.entity_id = e.product_id', array('core.sku')); Commented Mar 6, 2016 at 6:17
  • Error Fatal error: Call to a member function getBackend() when I am adding the filter. And product_id = entity_id of product Commented Mar 6, 2016 at 6:20

you can join

$collection = Mage::getModel('catalog/product')->getCollection();
            array('cust' => 'vaibhav_customtabs_product_entity'),
            'cust.product_id' = 'main_table.entity_id');
  • Hi @QaisarSatti, I tried the same above code, also I tried to change main_table with catalog_product_entity. But it is giving error. Commented Mar 5, 2016 at 21:29
  • What's the error? Commented Mar 5, 2016 at 22:08
  • Parse error: syntax error, unexpected '=' in ---- last line @AnthonyCicchelli Commented Mar 6, 2016 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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