I am Adding Custom Section in System->Config Tab.

I need to add Button as Field and its related action which I need to perform. But I cannot find on google for button all example provide other field option but hard to get button example.

Other Section Working fine but I am not able to add button and related action (filepath) which call on click.

  <goldprice translate="label"> 
    <comment>Gold Price per 1gm</comment> 
  <run translate="label">

My Config File Like Below

<?xml version="1.0"?>
      <admin_system_config_changed_section_gold> <!-- identifier of the event we want to catch -->

And Customfiled.php like below

class LetsNurture_CustomGrid_Block_Adminhtml_System_Config_Customfield extends Mage_Adminhtml_Block_System_Config_Form_Field
    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
        $url = $this->getUrl('catalog/product'); //

        $html = $this->getLayout()->createBlock('adminhtml/widget_button')
                    ->setLabel('Run Now !')

        return $html;

But it gives me Warning like this "failed to open stream: No such file or directory"

Thanks, Yogesh


<frontend_model> path goes to to Blocks (instead of Models).

Incidentally, even though it’s named a model class but we have to create it as a Magento Block class since this is how the other built in front end model classes are implemented.

As well as, it is used for template output so it’s appropriate to create a block class for this.




Create Customfield.php under .../NAMESPACE/MODULENAME/Block/Adminhtml/System/Config/ with the following content:

class NAMESPACE_MODULENAME_Block_Adminhtml_System_Config_Customfield extends Mage_Adminhtml_Block_System_Config_Form_Field

    protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
        $html = parent::_getElementHtml($element);
       //Write your custom html here
        return $html;

Hope this help you

  • getting this error Warning: include(Mage/LetsNurture/CustomGrid/Block/Adminhtml/System/Config/Customfield.php): failed to open stream: No such file or directory ( I dont know why its searching in core even this placed in local)
    – Yogesh
    Oct 21 '15 at 10:06
  • Please add following under global tag in config.xml: <blocks> <Mymodule> <class>Mynamespace_Mymodule_Block</class> </Mymodule> </blocks>
    – Keyur Shah
    Oct 21 '15 at 10:16
  • I have Added that But Even this is happening
    – Yogesh
    Oct 21 '15 at 10:25
  • Is your cimpilation is disbaled ? If not then disbale it and try,,And have you clear your cache ?
    – Keyur Shah
    Oct 21 '15 at 10:29
  • Thanks for Help, I will Try and reply because by now working on other.
    – Yogesh
    Oct 21 '15 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.