Observer doesn't workCan't set an observer on customer_loginRewrite Credit Memo API in Magento CE 1.9Collection items don't trigger product load event observers or backend models, but can they?Override Adminhtml importexport dataflow Profile Controllerhow to override a Core Customer Model in a local module in magento 1.9.2Magento 1: use of observers and missing native core setter?Simple Observer not firing on eventMy observer not workMagento1 createBlock method returns “bool(false)” in livehostClass observer in config.xml doesn't work

Can compressed videos be decoded back to their uncompresed original format?

Avoiding the "not like other girls" trope?

Why do I get negative height?

Was the Stack Exchange "Happy April Fools" page fitting with the '90's code?

Could the museum Saturn V's be refitted for one more flight?

Forgetting the musical notes while performing in concert

files created then deleted at every second in tmp directory

What do you call someone who asks many questions?

Am I breaking OOP practice with this architecture?

My ex-girlfriend uses my Apple ID to log in to her iPad. Do I have to give her my Apple ID password to reset it?

Was the old ablative pronoun "med" or "mēd"?

How to travel to Japan while expressing milk?

How do I exit BASH while loop using modulus operator?

How badly should I try to prevent a user from XSSing themselves?

Knowledge-based authentication using Domain-driven Design in C#

Did 'Cinema Songs' exist during Hiranyakshipu's time?

Why were 5.25" floppy drives cheaper than 8"?

Does the Idaho Potato Commission associate potato skins with healthy eating?

What's the meaning of "Sollensaussagen"?

Is there a hemisphere-neutral way of specifying a season?

How to find if SQL server backup is encrypted with TDE without restoring the backup

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

How can I prove that a state of equilibrium is unstable?

Finding the error in an argument



Observer doesn't work


Can't set an observer on customer_loginRewrite Credit Memo API in Magento CE 1.9Collection items don't trigger product load event observers or backend models, but can they?Override Adminhtml importexport dataflow Profile Controllerhow to override a Core Customer Model in a local module in magento 1.9.2Magento 1: use of observers and missing native core setter?Simple Observer not firing on eventMy observer not workMagento1 createBlock method returns “bool(false)” in livehostClass observer in config.xml doesn't work













0















I tried a few iterations and for whatever reason I can't add cookies or even execute any code from my observer, as it's not giving anything even if my observer has dies in it. I have my module visible on the list and enabled, there are no exceptions in the exception.log.



This is my xml file where observer define




app/code/local/MyProject/Cookie123/etc/config.xml




<?xml version="1.0"?>
<config>
<modules>
<MyProject_Cookie123>
<version>1.0.0</version>
</MyProject_Cookie123>
</modules>
<global>
<models>
<Cookie123>
<class>MyProject_Cookie123_Model</class>
</Cookie123>
</models>
<events>
<customer_login>
<observers>
<MyProject_Cookie123>
<type>model</type>
<class>MyProject_Cookie123_Model_Observer</class>
<method>customerLogin</method>
</MyProject_Cookie123>
</observers>
</customer_login>
<customer_logout>
<observers>
<MyProject_Cookie123>
<type>model</type>
<class>MyProject_Cookie123_Model_Observer</class>
<method>customerLogout</method>
</MyProject_Cookie123>
</observers>
</customer_logout>
<controller_front_send_response_before>
<observers>
<MyProject_Cookie123>
<type>model</type>
<class>MyProject_Cookie123_Model_Observer</class>
<method>sendResponse</method>
</MyProject_Cookie123>
</observers>
</controller_front_send_response_before>
</events>
</global>
</config>


This is my Observer file:-




app/code/local/MyProject/Cookie123/Model/Observer.php




<?php

class MyProject_Cookie123_Model_Observer


public function customerLogin($observer)

Mage::getModel('core/cookie')->set('testing_auth', 1);


public function customerLogout($observer)

Mage::getModel('core/cookie')->delete('testing_auth');


public function sendResponse($observer)

Mage::getModel('core/cookie')->set('test_123', 1);

$cartItems = Mage::helper('checkout/cart')->getItemsQty();
if ($cartItems > 0)
Mage::getModel('core/cookie')->set('testing_cart', 1);
else
if (Mage::getModel('core/cookie')->get('testing_cart'))
Mage::getModel('core/cookie')->delete('testing_cart');














share|improve this question









New contributor




MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0















    I tried a few iterations and for whatever reason I can't add cookies or even execute any code from my observer, as it's not giving anything even if my observer has dies in it. I have my module visible on the list and enabled, there are no exceptions in the exception.log.



    This is my xml file where observer define




    app/code/local/MyProject/Cookie123/etc/config.xml




    <?xml version="1.0"?>
    <config>
    <modules>
    <MyProject_Cookie123>
    <version>1.0.0</version>
    </MyProject_Cookie123>
    </modules>
    <global>
    <models>
    <Cookie123>
    <class>MyProject_Cookie123_Model</class>
    </Cookie123>
    </models>
    <events>
    <customer_login>
    <observers>
    <MyProject_Cookie123>
    <type>model</type>
    <class>MyProject_Cookie123_Model_Observer</class>
    <method>customerLogin</method>
    </MyProject_Cookie123>
    </observers>
    </customer_login>
    <customer_logout>
    <observers>
    <MyProject_Cookie123>
    <type>model</type>
    <class>MyProject_Cookie123_Model_Observer</class>
    <method>customerLogout</method>
    </MyProject_Cookie123>
    </observers>
    </customer_logout>
    <controller_front_send_response_before>
    <observers>
    <MyProject_Cookie123>
    <type>model</type>
    <class>MyProject_Cookie123_Model_Observer</class>
    <method>sendResponse</method>
    </MyProject_Cookie123>
    </observers>
    </controller_front_send_response_before>
    </events>
    </global>
    </config>


    This is my Observer file:-




    app/code/local/MyProject/Cookie123/Model/Observer.php




    <?php

    class MyProject_Cookie123_Model_Observer


    public function customerLogin($observer)

    Mage::getModel('core/cookie')->set('testing_auth', 1);


    public function customerLogout($observer)

    Mage::getModel('core/cookie')->delete('testing_auth');


    public function sendResponse($observer)

    Mage::getModel('core/cookie')->set('test_123', 1);

    $cartItems = Mage::helper('checkout/cart')->getItemsQty();
    if ($cartItems > 0)
    Mage::getModel('core/cookie')->set('testing_cart', 1);
    else
    if (Mage::getModel('core/cookie')->get('testing_cart'))
    Mage::getModel('core/cookie')->delete('testing_cart');














    share|improve this question









    New contributor




    MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      I tried a few iterations and for whatever reason I can't add cookies or even execute any code from my observer, as it's not giving anything even if my observer has dies in it. I have my module visible on the list and enabled, there are no exceptions in the exception.log.



      This is my xml file where observer define




      app/code/local/MyProject/Cookie123/etc/config.xml




      <?xml version="1.0"?>
      <config>
      <modules>
      <MyProject_Cookie123>
      <version>1.0.0</version>
      </MyProject_Cookie123>
      </modules>
      <global>
      <models>
      <Cookie123>
      <class>MyProject_Cookie123_Model</class>
      </Cookie123>
      </models>
      <events>
      <customer_login>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>customerLogin</method>
      </MyProject_Cookie123>
      </observers>
      </customer_login>
      <customer_logout>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>customerLogout</method>
      </MyProject_Cookie123>
      </observers>
      </customer_logout>
      <controller_front_send_response_before>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>sendResponse</method>
      </MyProject_Cookie123>
      </observers>
      </controller_front_send_response_before>
      </events>
      </global>
      </config>


      This is my Observer file:-




      app/code/local/MyProject/Cookie123/Model/Observer.php




      <?php

      class MyProject_Cookie123_Model_Observer


      public function customerLogin($observer)

      Mage::getModel('core/cookie')->set('testing_auth', 1);


      public function customerLogout($observer)

      Mage::getModel('core/cookie')->delete('testing_auth');


      public function sendResponse($observer)

      Mage::getModel('core/cookie')->set('test_123', 1);

      $cartItems = Mage::helper('checkout/cart')->getItemsQty();
      if ($cartItems > 0)
      Mage::getModel('core/cookie')->set('testing_cart', 1);
      else
      if (Mage::getModel('core/cookie')->get('testing_cart'))
      Mage::getModel('core/cookie')->delete('testing_cart');














      share|improve this question









      New contributor




      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I tried a few iterations and for whatever reason I can't add cookies or even execute any code from my observer, as it's not giving anything even if my observer has dies in it. I have my module visible on the list and enabled, there are no exceptions in the exception.log.



      This is my xml file where observer define




      app/code/local/MyProject/Cookie123/etc/config.xml




      <?xml version="1.0"?>
      <config>
      <modules>
      <MyProject_Cookie123>
      <version>1.0.0</version>
      </MyProject_Cookie123>
      </modules>
      <global>
      <models>
      <Cookie123>
      <class>MyProject_Cookie123_Model</class>
      </Cookie123>
      </models>
      <events>
      <customer_login>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>customerLogin</method>
      </MyProject_Cookie123>
      </observers>
      </customer_login>
      <customer_logout>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>customerLogout</method>
      </MyProject_Cookie123>
      </observers>
      </customer_logout>
      <controller_front_send_response_before>
      <observers>
      <MyProject_Cookie123>
      <type>model</type>
      <class>MyProject_Cookie123_Model_Observer</class>
      <method>sendResponse</method>
      </MyProject_Cookie123>
      </observers>
      </controller_front_send_response_before>
      </events>
      </global>
      </config>


      This is my Observer file:-




      app/code/local/MyProject/Cookie123/Model/Observer.php




      <?php

      class MyProject_Cookie123_Model_Observer


      public function customerLogin($observer)

      Mage::getModel('core/cookie')->set('testing_auth', 1);


      public function customerLogout($observer)

      Mage::getModel('core/cookie')->delete('testing_auth');


      public function sendResponse($observer)

      Mage::getModel('core/cookie')->set('test_123', 1);

      $cartItems = Mage::helper('checkout/cart')->getItemsQty();
      if ($cartItems > 0)
      Mage::getModel('core/cookie')->set('testing_cart', 1);
      else
      if (Mage::getModel('core/cookie')->get('testing_cart'))
      Mage::getModel('core/cookie')->delete('testing_cart');











      magento-1.9 event-observer configuration






      share|improve this question









      New contributor




      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 18 hours ago









      Magento_Bhurio

      335110




      335110






      New contributor




      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 18 hours ago









      MarcinWolnyMarcinWolny

      1056




      1056




      New contributor




      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      MarcinWolny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          1














          change your config to following move your events to frontend tag & gave unique event ids:-
          app/code/local/MyProject/Cookie123/etc/config.xml



          <?xml version="1.0"?>
          <config>
          <modules>
          <MyProject_Cookie123>
          <version>1.0.0</version>
          </MyProject_Cookie123>
          </modules>
          <global>
          <models>
          <Cookie123>
          <class>MyProject_Cookie123_Model</class>
          </Cookie123>
          </models>

          </global>
          <frontend>
          <events>
          <customer_login>
          <observers>
          <myproject_cookie123_customerlogin>
          <type>model</type>
          <class>MyProject_Cookie123_Model_Observer</class>
          <method>customerLogin</method>
          </myproject_cookie123_customerlogin>
          </observers>
          </customer_login>
          <customer_logout>
          <observers>
          <myproject_cookie123_customerlogout>
          <type>model</type>
          <class>MyProject_Cookie123_Model_Observer</class>
          <method>customerLogout</method>
          </myproject_cookie123_customerlogout>
          </observers>
          </customer_logout>
          <controller_front_send_response_before>
          <observers>
          <myproject_cookie123_sendresponse>
          <type>model</type>
          <class>MyProject_Cookie123_Model_Observer</class>
          <method>sendResponse</method>
          </myproject_cookie123_sendresponse>
          </observers>
          </controller_front_send_response_before>
          </events>
          </frontend>
          </config>





          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            MarcinWolny is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268332%2fobserver-doesnt-work%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            change your config to following move your events to frontend tag & gave unique event ids:-
            app/code/local/MyProject/Cookie123/etc/config.xml



            <?xml version="1.0"?>
            <config>
            <modules>
            <MyProject_Cookie123>
            <version>1.0.0</version>
            </MyProject_Cookie123>
            </modules>
            <global>
            <models>
            <Cookie123>
            <class>MyProject_Cookie123_Model</class>
            </Cookie123>
            </models>

            </global>
            <frontend>
            <events>
            <customer_login>
            <observers>
            <myproject_cookie123_customerlogin>
            <type>model</type>
            <class>MyProject_Cookie123_Model_Observer</class>
            <method>customerLogin</method>
            </myproject_cookie123_customerlogin>
            </observers>
            </customer_login>
            <customer_logout>
            <observers>
            <myproject_cookie123_customerlogout>
            <type>model</type>
            <class>MyProject_Cookie123_Model_Observer</class>
            <method>customerLogout</method>
            </myproject_cookie123_customerlogout>
            </observers>
            </customer_logout>
            <controller_front_send_response_before>
            <observers>
            <myproject_cookie123_sendresponse>
            <type>model</type>
            <class>MyProject_Cookie123_Model_Observer</class>
            <method>sendResponse</method>
            </myproject_cookie123_sendresponse>
            </observers>
            </controller_front_send_response_before>
            </events>
            </frontend>
            </config>





            share|improve this answer



























              1














              change your config to following move your events to frontend tag & gave unique event ids:-
              app/code/local/MyProject/Cookie123/etc/config.xml



              <?xml version="1.0"?>
              <config>
              <modules>
              <MyProject_Cookie123>
              <version>1.0.0</version>
              </MyProject_Cookie123>
              </modules>
              <global>
              <models>
              <Cookie123>
              <class>MyProject_Cookie123_Model</class>
              </Cookie123>
              </models>

              </global>
              <frontend>
              <events>
              <customer_login>
              <observers>
              <myproject_cookie123_customerlogin>
              <type>model</type>
              <class>MyProject_Cookie123_Model_Observer</class>
              <method>customerLogin</method>
              </myproject_cookie123_customerlogin>
              </observers>
              </customer_login>
              <customer_logout>
              <observers>
              <myproject_cookie123_customerlogout>
              <type>model</type>
              <class>MyProject_Cookie123_Model_Observer</class>
              <method>customerLogout</method>
              </myproject_cookie123_customerlogout>
              </observers>
              </customer_logout>
              <controller_front_send_response_before>
              <observers>
              <myproject_cookie123_sendresponse>
              <type>model</type>
              <class>MyProject_Cookie123_Model_Observer</class>
              <method>sendResponse</method>
              </myproject_cookie123_sendresponse>
              </observers>
              </controller_front_send_response_before>
              </events>
              </frontend>
              </config>





              share|improve this answer

























                1












                1








                1







                change your config to following move your events to frontend tag & gave unique event ids:-
                app/code/local/MyProject/Cookie123/etc/config.xml



                <?xml version="1.0"?>
                <config>
                <modules>
                <MyProject_Cookie123>
                <version>1.0.0</version>
                </MyProject_Cookie123>
                </modules>
                <global>
                <models>
                <Cookie123>
                <class>MyProject_Cookie123_Model</class>
                </Cookie123>
                </models>

                </global>
                <frontend>
                <events>
                <customer_login>
                <observers>
                <myproject_cookie123_customerlogin>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>customerLogin</method>
                </myproject_cookie123_customerlogin>
                </observers>
                </customer_login>
                <customer_logout>
                <observers>
                <myproject_cookie123_customerlogout>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>customerLogout</method>
                </myproject_cookie123_customerlogout>
                </observers>
                </customer_logout>
                <controller_front_send_response_before>
                <observers>
                <myproject_cookie123_sendresponse>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>sendResponse</method>
                </myproject_cookie123_sendresponse>
                </observers>
                </controller_front_send_response_before>
                </events>
                </frontend>
                </config>





                share|improve this answer













                change your config to following move your events to frontend tag & gave unique event ids:-
                app/code/local/MyProject/Cookie123/etc/config.xml



                <?xml version="1.0"?>
                <config>
                <modules>
                <MyProject_Cookie123>
                <version>1.0.0</version>
                </MyProject_Cookie123>
                </modules>
                <global>
                <models>
                <Cookie123>
                <class>MyProject_Cookie123_Model</class>
                </Cookie123>
                </models>

                </global>
                <frontend>
                <events>
                <customer_login>
                <observers>
                <myproject_cookie123_customerlogin>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>customerLogin</method>
                </myproject_cookie123_customerlogin>
                </observers>
                </customer_login>
                <customer_logout>
                <observers>
                <myproject_cookie123_customerlogout>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>customerLogout</method>
                </myproject_cookie123_customerlogout>
                </observers>
                </customer_logout>
                <controller_front_send_response_before>
                <observers>
                <myproject_cookie123_sendresponse>
                <type>model</type>
                <class>MyProject_Cookie123_Model_Observer</class>
                <method>sendResponse</method>
                </myproject_cookie123_sendresponse>
                </observers>
                </controller_front_send_response_before>
                </events>
                </frontend>
                </config>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 18 hours ago









                Hassan Ali ShahzadHassan Ali Shahzad

                655317




                655317




















                    MarcinWolny is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    MarcinWolny is a new contributor. Be nice, and check out our Code of Conduct.












                    MarcinWolny is a new contributor. Be nice, and check out our Code of Conduct.











                    MarcinWolny is a new contributor. Be nice, and check out our Code of Conduct.














                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268332%2fobserver-doesnt-work%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?