0

I am trying to observe the event cms_page_prepare_save but it is now working.

Code in config.xml

<config>
<modules>
    <Custom_Test>
        <version>0.1.0</version>
    </Custom_Test>
</modules>
<global>
    <helpers>
        <test>
            <rewrite>
                <processor_requestid>Custom_Test_Helper_Processor_Requestid</processor_requestid>
            </rewrite>
        </test>
    </helpers>
    <models>
        <test>
            <rewrite>
                <processor>Custom_Test_Model_Processor</processor>
            </rewrite>
            <rewrite>
                <observer>Custom_Test_Model_Observer</observer>
            </rewrite>
        </test>
    </models>
</global>
<frontend>
    <events>
        <controller_action_predispatch>
            <observers>
                <custom_test>
                    <type>singleton</type>
                    <class>test/processor</class>
                    <method>serveResponse</method>
                </custom_test>
            </observers>
        </controller_action_predispatch>
        <cms_page_render>
            <observers>
                <custom_test_observer>
                    <type>singleton</type>
                    <class>Custom_Test_Model_Observer</class>
                    <method>addCustomData</method>
                </custom_test_observer>
            </observers>
        </cms_page_render>
    </events>
</frontend>

Above two event and observers are working fine, but below is not working at all.

<events>
   <cms_page_prepare_save>
    <observers>
       <Custom_Test_Model_Observer>
           <type>singleton</type>
           <class>test/observer</class>
           <method>saveCmsPageObserve</method>
           </Custom_Test_Model_Observer>
       </observers>
  </cms_page_prepare_save>
</events>

Tried in <admin>, <adminhtml> and <global> tags.

class Mage_Adminhtml_Cms_PageController is over written, does this have something to do with the issue. Or is there any other issue?

  • You need to add your code in <adminhtml> tag firstly. Can you add the code of your observer test/observer ? – TaKe_Da_ShAkEr Jul 12 '16 at 11:28
  • can you please share config.xml and what is observer class for cms_page_prepare_save event? – Amit Bera Jul 12 '16 at 13:09
  • @AmitBera Updated the question with config.xml code – Anshu Mishra Jul 13 '16 at 10:36
  • @TaKe_Da_ShAkEr tried in <adminhtml> tag as well, but no luck. – Anshu Mishra Jul 13 '16 at 10:37
0

Try bellow code in config.xml

<config>
<modules>
    <Custom_Test>
        <version>0.1.0</version>
    </Custom_Test>
</modules>
<global>
    <helpers>
        <test>
            <rewrite>
                <processor_requestid>Custom_Test_Helper_Processor_Requestid</processor_requestid>
            </rewrite>
        </test>
    </helpers>
    <models>
        <test>
            <rewrite>
                <processor>Custom_Test_Model_Processor</processor>
            </rewrite>
            <rewrite>
                <observer>Custom_Test_Model_Observer</observer>
            </rewrite>
        </test>
    </models>
    <events>
        <cms_page_prepare_save>
            <observers>
                <custom_test_cms_page_prepare>
                    <type>singleton</type>
                    <class>Custom_Test_Model_Observer</class>
                    <method>saveCmsPageObserve</method>
                </custom_test_cms_page_prepare>
            </observers>
        </cms_page_prepare_save>
    </events>
</global>
<frontend>
    <events>
        <controller_action_predispatch>
            <observers>
                <custom_test>
                    <type>singleton</type>
                    <class>test/processor</class>
                    <method>serveResponse</method>
                </custom_test>
            </observers>
        </controller_action_predispatch>
        <cms_page_render>
            <observers>
                <custom_test_observer>
                    <type>singleton</type>
                    <class>Custom_Test_Model_Observer</class>
                    <method>addCustomData</method>
                </custom_test_observer>
            </observers>
        </cms_page_render>
    </events>
</frontend>

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.