tinkesh
tinkesh

Reputation: 313

How to show the store name in the grid in the Magento

I have my custom module in the admin. I have listed the values from the database in the grid. The values are store specific, so every row have the store_id. While listing the value, i also want to display the store name and website name in the row. How can i fetch the store_name and website name in the grid. e.g i have the store_id 5 inserted in the row.

I want the output like

Location Value Store

xyz xyz English

Upvotes: 0

Views: 3218

Answers (2)

Amit Kumar
Amit Kumar

Reputation: 1782

So you have store_id and you want to display the store name right ?

So use below code to get the store name

$storeId = 5;
$storeName = Mage::getModel('core/store')->load($storeId)->getName();

Upvotes: 0

Mufaddal
Mufaddal

Reputation: 5381

If you put below code in your module grid file then you are able to display Store name in your grid, here's a code

$this->addColumn(’store_id’, array( 
‘header’ => Mage::helper(’sales’)->__(’Website’), 
‘index’ => ‘store_id’, 
‘type’ => ‘store’, 
‘width’ => ‘100px’, 
‘store_view’=> true, 
‘display_deleted’ => true, 
)); 

Further Information you can refer this Link

Upvotes: 2

Related Questions