I have added a store selection field in one of my custom modules for testimonials. In which I want to show testimonials store wise specific to that store only. I have added the field and the filter is also working alright. The problem is that in the backend in admin grid where all the testimonials are listed out, there is one column that shows stores as well. Now if there is only one store then it shows up in the field, but if a testimonial is active for more than one stores then the field is blank. The values are set in database table but on the grid it doesn't show up multiple store. Can anyone tell me what am i missing here?
1 Answer
To add a store_id field to a standard magento grid, you can use the following snippet:
$this->addColumn(
'store_id',
array(
'header' => 'Store',
'index' => 'store_id',
'type' => 'store'
)
);
This will then use the class Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Store
to render this column.
Note: I know this is not the exact answer that they are looking for but this is how Magento does this by standard
_renderFiltersBefore()