I'm not sure whether I understand this question.
To make it correct, you derive a custom collection from the standard
one. You either override _initSelect() and put your filter
modifications and joins there, or you put it into some public method
that can be executed for the collection in case you need a custom
filtering.
So just put it in _initSelect()
Like this:
class Namespace_Module_Model_Resource_Order_Collection extends Mage_Sales_Model_Resource_Order_Collection
{
public function _initSelect()
{
$this->getSelect()->join( array('table_alias'=>$this->getTable('module/table_name')), 'main_table.foreign_id = table_alias.primary_key', array('table_alias.*'), 'schema_name_if_different');
return parent::_initSelect();
}
}
But I highly recommend to use joinTable(), joinField, joinAttribute instead of directly working on the Zend_Db instance.
model and resource model in config.xml
Normally you define a prefix to use the models with Mage::getModel() and Mage::getSingleton(). If models write to the database, they have a resource model and a collection class. this is defined via the <resourceModel> node.
<config>
<global>
<models>
<namespace_module> <!-- prefix -->
<class>Namespace_Module_Model</class>
<!-- What happens with Mage::getModel('...')->getResourceModel() -->
<!-- What happens with Mage::getModel('...')->getCollection() -->
<resourceModel>namespace_module_resource</resourceModel>
</namespace_module>
<namespace_module_resource>
<class>Idee_ShowCart_Model_Resource</class>
</namespace_module_resource>
</models>
</global>
</config>