Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to include a related table in a model
 
Jaime Stuardo
Member
 
Total Posts:  45
Joined:  2010-04-02
 

Hello…

I have installed th TF_ManufacturerList extension that I want to change a little bit.

The fact is that extension shows a manufacturers list (options of an attribute) in some column of the page but I don\’t like how the link is constructed. It is based on advanced search. I want to implement it using SEO feature.

Therefore, I want to change the link, for that, I need 2 more fields to be added to the resulting array. Those fields are present in a related table (that has the store_id and a SEO alias). How can I add it to the database query?

This is the the method of the block that get the options:

protected function _loadData()
    
{
        $product 
Mage::getModel(\'catalog/product\');
        
$attributes Mage::getResourceModel(\'eav/entity_attribute_collection\')
            ->
setEntityTypeFilter($product->getResource()->getTypeId())
            ->
addFieldToFilter(\'attribute_code\'\'manufacturer\');
        
$attribute $attributes->getFirstItem()->setEntity($product->getResource());
        
$this->_data $attribute->getSource()->getAllOptions(false);
        
$this->count_data count($this->_data);
        return 
$this;
    
}

$this->_data variable is an array whose data comes from the options table. I want the 2 fields belonging to the related table to be added to that array.

Something simple as doing: SELECT a.*, b.* FROM a, b WHERE a.a_id = b.a_id, but using Magento database access is not that straight forward.

Thanks a lot in advance
Jaime

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top