Editable List Item Field Using System Xml

Add field in your system xml file like below

<product_additem translate="label">
                            <label>Media Source</label>
                            <comment>Add Item</comment>

Now you need to create a file to render html that is frontend_model.create file with Additem.php in your module adminhtml folder path.and write below code in it.

class <Namespace>_<Module>_Block_Adminhtml_System_Config_Form_Field_Additem extends Mage_Adminhtml_Block_System_Config_Form_Field_Regexceptions
    public function __construct()
        $this->addColumn('title', array(
            'label' => Mage::helper('adminhtml')->__('Title '),
            'style' => 'width:120px',
        $this->addColumn('link', array(
            'label' => Mage::helper('adminhtml')->__('Link'),
            'style' => 'width:120px',
        $this->addColumn('image', array(
            'label' => Mage::helper('adminhtml')->__('Media'),
            'style' => 'width:120px',
        $this->addColumn('content', array(
            'label' => Mage::helper('adminhtml')->__('Content'),
            'style' => 'width:220px',
        $this->_addAfter = false;
        $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Item');
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
        $html = $this->_toHtml();
        $this->_arrayRowsCache = null; // doh, the object is used as singleton!
        $html ='<div id="myeditableitem">'.$html.'</div>';
	return $html;

Now you have a editable field for your configuration setting like below images.



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s