Social Icons

twitterfacebookgoogle pluslinkedinemail

Friday, 7 June 2013

add yesno field in admin grid

this is way to add dropdown / select field in magento admin grid

file path : app\code\local\Module_Name\Company_Name\Block\Adminhtml\block_name\Grid.php


$yesnoOptions = array('0' => 'No','1' => 'Yes','' => 'No');

 $this->addColumn('is_vendor', array(
           'header'    => Mage::helper('customer')->__('Is Vendor'),
           'index'     => 'is_vendor',
'type'      => 'options',
'options'   => $yesnoOptions,
       ));

4 comments :

  1. I think you can also make use of this:

    Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(

    ReplyDelete
    Replies
    1. no, you can't

      Delete
    2. yes, you can!

      Delete
  2. You can use this...
    Mage::getModel('adminhtml/system_config_source_yesno')->toArray()

    ReplyDelete

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement