0

i add button in custom module in system configuration. I got error:

Fatal error: Class 'Weo_Productlist_Block_Adminhtml_System_Config_Button' not found in /var/www/projects/pooja/testmagento/app/code/core/Mage/Core/Model/Layout.php on line 590

file: config.xml

    <?xml version="1.0"?>
<config>
    <modules>
        <Weo_Productlist>
            <version>0.1.0</version>
        </Weo_Productlist>
    </modules>
    <global>
        <models>
            <weo_productlist>
                <class>Weo_Productlist_Model</class>
            </weo_productlist>
        </models>
        <blocks>
            <weo_productlist>
                <class>Weo_Productlist_Block</class>
            </weo_productlist>
        </blocks>
        <helpers>
            <weo_productlist>
                <class>Weo_Productlist_Helper</class>
            </weo_productlist>
        </helpers>
<!-- Remove this section if your module does not require any event observers 
        <events>
            <{event_name}>
                <observers>
                    <{namespace}_{module}_{event_name}>
                        <type>model</type>
                        <class>{namespace}_{module}/observer</class>
                        <method>{methodName}</method>
                    </{namespace}_{module}_{event_name}>
                </observers>
            </{event_name}>
        </events>-->
     </global>
    <frontend>
        <routers>
            <productlist>
                <use>standard</use>
                <args>
                    <module>Weo_Productlist</module>
                    <frontName>productlist</frontName>
                </args>
            </productlist>
        </routers>
     </frontend>
    <admin>
         <routers>
            <adminhtml>
                <args>
                    <modules>
                        <productlist after="Mage_Adminhtml">Weo_Productlist</productlist>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
     <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <weo_productlist translate="title" module="weo_productlist">
                                        <title>Weo Productlist</title>
                                    </weo_productlist>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

file: system.xml

    <?xml version="1.0"?>
<config>
    <tabs>
        <weo_productlist translate="label" module="weo_productlist">
            <label>Weo</label>
            <sort_order>300</sort_order>
        </weo_productlist>
    </tabs>
    <sections>
        <weo_productlist translate="label" module="weo_productlist">
            <label>Product List</label>
            <tab>weo_productlist</tab>
            <sort_order>1</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <general translate="label">
                    <label>General</label>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <enabled translate="label">
                            <label>Enable Module</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </enabled>
<!--                        <debug translate="label">
                            <depends><enabled>1</enabled></depends>
                            <label>Debug</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>0</show_in_website>
                            <show_in_store>0</show_in_store>
                        </debug> -->
            <module_btn translate="label">
                <depends><enabled>1</enabled></depends>
                <label>Product Button</label>
                <frontend_type>button</frontend_type>
                <frontend_model>weo_productlist/adminhtml_system_config_button</frontend_model>
                <sort_order>2</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>1</show_in_store>
            </module_btn>
                    </fields>
                </general>
            </groups>
        </weo_productlist>
    </sections>
</config>

file: button.php

   <?php
class Weo_Productlist_Block_Adminhtml_System_Config_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
{
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
    {       
        $html = parent::_getElementHtml($element);
        $this->setElement($element);

    $url = $this->getUrl('catalog/product'); //

        $html = $this->getLayout()->createBlock('adminhtml/widget_button')
                    ->setType('button')
                    ->setClass('scalable')
                    ->setLabel('Run Now !')
                    ->setOnClick("setLocation('$url')")
                    ->toHtml();
        return $html;
    }
}

Thanks in advance.

  • if your block file name is button.php try changing it to Button.php – Piyush Oct 25 '17 at 8:47
  • What is the path for your button.php? – Yiorgos Moschovitis Oct 25 '17 at 8:48
  • /app/code/local/Weo/Productlist/Block/adminhtml/system/config @YiorgosMoschovitis – pooja Oct 25 '17 at 8:48
  • i changed button.php to Button.php, but error still @Piyush – pooja Oct 25 '17 at 8:50
  • @pooja as per your given path all the sub-folder(under Block folder) name should be capitalized – Piyush Oct 25 '17 at 8:51

Your Answer

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

Browse other questions tagged or ask your own question.