1

even my complete module was working with default installation.


config.xml

 <?xml version="1.0"?>
    <config>
        <modules>
            <Barcatsia_Smsntf>
                <version>0.1.0</version>    <!-- Version of module -->
            </Barcatsia_Smsntf>
        </modules>
        <global>
            <blocks>
                <smsntf>
                    <class>Barcatsia_Smsntf_Block</class>  <!-- Path of the
     Block Folder, where all php files are located related to view -->
                </smsntf>
            </blocks>
            <helpers>
                <smsntf>
                    <class>Barcatsia_Smsntf_Helper</class> 
    <!-- Path of Helper Files -->
                </smsntf>
            </helpers>
    <!-- Observer event register -->
        <events>            
               <!--  <checkout_onepage_controller_success_action> -->
        <controller_action_layout_load_before>
                    <observers>
                        <Barcatsia_Smsntf_Model_Observer>
                            <type>singleton</type>
                            <class>Barcatsia_Smsntf_Model_Observer</class>
                            <method>customFunction</method>
                        </Barcatsia_Smsntf_Model_Observer>
                    </observers>
        </controller_action_layout_load_before>
               <!--  </checkout_onepage_controller_success_action> -->
            </events>
    <!-- Observer event register -->
        </global>
        <frontend>
            <routers>
                <smsntf>
                    <use>standard</use>
                    <args>
                        <module>Barcatsia_Smsntf</module>
                        <frontName>smsntf</frontName>  <!-- This is the URL
     of the module. i.e www.yourmagento.com/index.php/test will be the url of your module. -->
                    </args>
                </smsntf>
            </routers>
            <layout>  <!-- New Section Added -->
                <updates>
                    <smsntf>
                        <file>smsntf.xml</file> <!-- This is name of the layout file for this module -->
                    </smsntf>
                </updates>
            </layout>
        </frontend>
        <adminhtml>       
            <acl>
                <resources>
                    <admin>
                        <children>
                            <system>
                                <children>
                                    <config>
                                        <children>
                                            <testsection translate="title" module="smsntf">
                                                <title>SMS Notification</title>
                                            </testsection>
                                        </children>
                                    </config>
                                </children>
                            </system>
                        </children>
                    </admin>
                </resources>
            </acl>        
        </adminhtml>
    </config>

Model/observer.php

  <?php
    class Barcatsia_Smsntf_Model_Observer
    {
        public function customFunction(Varien_Event_Observer $observer)
        {
          echo "asssssssssadddddddddddddddddddddddddddddddddddddd";
        }
    }
  • Try after clearing your cache from System > Cache – Rohit Kundale Feb 2 '16 at 6:23
  • but cache is disbaled – Rahul Chaurasia Feb 2 '16 at 6:25
  • Then define model in config.xml – Rohit Kundale Feb 2 '16 at 6:25
  • can you tell me in which tag ? is it global? – Rahul Chaurasia Feb 2 '16 at 6:28
  • its still not working – Rahul Chaurasia Feb 2 '16 at 6:32
2

Update your config.xml with following code

<?xml version="1.0"?>
<config>
    <modules>
        <Barcatsia_Smsntf>
            <version>0.1.0</version>    <!-- Version of module -->
        </Barcatsia_Smsntf>
    </modules>
    <global>
        <models>
            <smsntf>
                <class>Barcatsia_Smsntf_Model</class>
            </smsntf>
        </models>

        <blocks>
            <smsntf>
                <class>Barcatsia_Smsntf_Block</class>  <!-- Path of the
 Block Folder, where all php files are located related to view -->
            </smsntf>
        </blocks>
        <helpers>
            <smsntf>
                <class>Barcatsia_Smsntf_Helper</class> 
<!-- Path of Helper Files -->
            </smsntf>
        </helpers>
<!-- Observer event register -->
    <events>            
           <!--  <checkout_onepage_controller_success_action> -->
    <controller_action_layout_load_before>
                <observers>
                    <Barcatsia_Smsntf_Model_Observer>
                        <type>singleton</type>
                        <class>Barcatsia_Smsntf_Model_Observer</class>
                        <method>customFunction</method>
                    </Barcatsia_Smsntf_Model_Observer>
                </observers>
    </controller_action_layout_load_before>
           <!--  </checkout_onepage_controller_success_action> -->
        </events>
<!-- Observer event register -->
    </global>
    <frontend>
        <routers>
            <smsntf>
                <use>standard</use>
                <args>
                    <module>Barcatsia_Smsntf</module>
                    <frontName>smsntf</frontName>  <!-- This is the URL
 of the module. i.e www.yourmagento.com/index.php/test will be the url of your module. -->
                </args>
            </smsntf>
        </routers>
        <layout>  <!-- New Section Added -->
            <updates>
                <smsntf>
                    <file>smsntf.xml</file> <!-- This is name of the layout file for this module -->
                </smsntf>
            </updates>
        </layout>
    </frontend>
    <adminhtml>       
        <acl>
            <resources>
                <admin>
                    <children>
                        <system>
                            <children>
                                <config>
                                    <children>
                                        <testsection translate="title" module="smsntf">
                                            <title>SMS Notification</title>
                                        </testsection>
                                    </children>
                                </config>
                            </children>
                        </system>
                    </children>
                </admin>
            </resources>
        </acl>        
    </adminhtml>
</config>

Rename your observer file from observer.php to Observer.php

Also disable your compilation from System > Tools > Compilation

Hope it helps you

  • sorry but it did not working – Rahul Chaurasia Feb 2 '16 at 6:34
  • check Moving your observer from global tag to frontend. – Rohit Kundale Feb 2 '16 at 6:37
  • only observer? i mean not event ? – Rahul Chaurasia Feb 2 '16 at 6:39
  • well i did it but still not working. its making me mad code was working on default installtion – Rahul Chaurasia Feb 2 '16 at 6:39
  • I mean your event code. Is there any error in error log? – Rohit Kundale Feb 2 '16 at 6:40
0

Try below code

<?xml version="1.0"?>
    <config>
        <modules>
            <Barcatsia_Smsntf>
                <version>0.1.0</version>    <!-- Version of module -->
            </Barcatsia_Smsntf>
        </modules>
        <global>
            <models>
                <smsntf>
                    <class>Barcatsia_Smsntf_Model</class>
                </smsntf>
            </models>
            <blocks>
                <smsntf>
                    <class>Barcatsia_Smsntf_Block</class>  <!-- Path of the
     Block Folder, where all php files are located related to view -->
                </smsntf>
            </blocks>
            <helpers>
                <smsntf>
                    <class>Barcatsia_Smsntf_Helper</class> 
    <!-- Path of Helper Files -->
                </smsntf>
            </helpers>
    <!-- Observer event register -->
        <events>            
               <!--  <checkout_onepage_controller_success_action> -->
        <controller_action_layout_load_before>
                    <observers>
                        <Barcatsia_Smsntf_Model_Observer>
                            <type>singleton</type>
                            <class>Barcatsia_Smsntf_Model_Observer</class>
                            <method>customFunction</method>
                        </Barcatsia_Smsntf_Model_Observer>
                    </observers>
        </controller_action_layout_load_before>
               <!--  </checkout_onepage_controller_success_action> -->
            </events>
    <!-- Observer event register -->
        </global>
        <frontend>
        <events>
            <checkout_onepage_controller_success_action>
                <observers>
                    <hooksystem_order_success>
                    <type>singleton</type>
                    <class>hooksystem/observer</class>
                    <method>hookToOrderSaveEvent</method>
                    </hooksystem_order_success>
                </observers>
            </checkout_onepage_controller_success_action>
        </events>

            <routers>
                <smsntf>
                    <use>standard</use>
                    <args>
                        <module>Barcatsia_Smsntf</module>
                        <frontName>smsntf</frontName>  <!-- This is the URL
     of the module. i.e www.yourmagento.com/index.php/test will be the url of your module. -->
                    </args>
                </smsntf>
            </routers>
            <layout>  <!-- New Section Added -->
                <updates>
                    <smsntf>
                        <file>smsntf.xml</file> <!-- This is name of the layout file for this module -->
                    </smsntf>
                </updates>
            </layout>
        </frontend>
        <adminhtml>       
            <acl>
                <resources>
                    <admin>
                        <children>
                            <system>
                                <children>
                                    <config>
                                        <children>
                                            <testsection translate="title" module="smsntf">
                                                <title>SMS Notification</title>
                                            </testsection>
                                        </children>
                                    </config>
                                </children>
                            </system>
                        </children>
                    </admin>
                </resources>
            </acl>        
        </adminhtml>
    </config>

Only add models section under the global section

<models>
                <smsntf>
                    <class>Barcatsia_Smsntf_Model</class>
                </smsntf>
            </models>
0

Try the below code it is working for me.

config.xml

<controller_action_layout_load_before>
            <observers>
                <barcatsia_bmsntf_model_observer>
                    <type>singleton</type>
                    <class>bmsntf/observer</class>
                    <method>customFunction</method>
                </barcatsia_bmsntf_model_observer>
            </observers>
</controller_action_layout_load_before>

Observer.php

public function customFunction(Varien_Event_Observer $observer)
{
echo "Do what you want";
exit;

}

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.