Problems joining in Magento

Table 1
--------------
|reseller_id |
|1           |
|2           |
|3           |
|4           |
--------------

Table 2
-------------------------------
|reseller_id | merchandise_id |
|1           | 1              |
|1           | 3              |
|2           | 1              |
|2           | 4              |
|3           | 2              |
-------------------------------

select * from reseller_maps inner join reseller_merch on reseller_maps.reseller_id = reseller_merch.reseller_id;

Is giving me what I’m looking for on the database side of things. However, I’m getting an

 Call to undefined method Namespace_Class_Model_Mysql4_Reseller_Collection::joinTable() 

When trying to do $collection->joinTable() in Magento.

I’ve tried using getSelect and join():

        $collection = Mage::getSingleton('maps/reseller')->getCollection();
        $collection->getSelect()
            ->join( array( 'reseller_merch'=>$this->getTable('reseller_merch')), 'reseller_maps.reseller_id= reseller_merch.reseller_id', array('reseller_merch.*'));

and am getting:

 SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories