I need get the name of category from ('catalog/product') table in Magento 1.9. How can I do it ? Main table is ('productlabels/category')
protected function _prepareCollection()
{
$collection = Mage::getModel('productlabels/category')->getCollection();
$collection->getSelect()
->joinLeft(array('category' => $collection->getTable('catalog/category')), 'main_table.id_category = category.entity_id')
->joinLeft(array('labels' => $collection->getTable('productlabels/table_labels')), 'main_table.id_label = labels.id_label');
$this->setCollection($collection);
return parent::_prepareCollection();
}
Also I have an edit form where I need to output my edit data.
protected function _prepareColumns()
{
$helper = Mage::helper('productlabels');
$this->addColumn('name', array(
'header' => $helper->__('Name'),
'index' => 'name',
));
$this->addColumn('category_page_image', array(
'header' => $helper->__('Label Image'),
'index' => 'category_page_image',
'type' => 'image',
'renderer' => 'Plumrocket_Productlabels_Block_Adminhtml_Renderer_Image',
'filter' => false,
'sortable' => false,
'align' => 'center',
));
return parent::_prepareColumns();
}
Any help would be greatly appreciated.
print_r($model);
and check index for name