1

I've been trying to develop a new module which will modify the admin html pages of a magento control panel but I'm having difficulty getting it to work. To debug I've rolled the module back to some really simple code to just write to the system.log file when the product edit page loads... and this still isnt working so I think I've got a problem with the observer actually firing. Can you see any problems?

app/etc/modules/tww_RemoveProductTabs.xml

<?xml version="1.0"?>
<config>
    <modules>
        <tww_RemoveProductTabs>
            <active>true</active>
            <codePool>local</codePool>
        </tww_RemoveProductTabs>
    </modules>
</config>

app/code/local/tww/RemoveProductTabs/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <tww_RemoveProductTabs>
            <version>0.1.0</version>
        </tww_RemoveProductTabs>
    </modules>
    <global>
        <models>
            <tww_RemoveProductTabs>
                <class>tww_RemoveProductTabs_Model</class>
            </tww_RemoveProductTabs>
        </models>
        <events>
            <adminhtml_block_html_before>
                <observers>
                    <tww_RemoveProductTabs>
                        <class>tww_RemoveProductTabs/observer</class>
                        <method>removeTabs</method>
                        <type>singleton</type>
                    </tww_RemoveProductTabs>
                </observers>
            </adminhtml_block_html_before>
        </events>
    </global>
</config>

app/code/local/tww/RemoveProductTabs/Model/Observer.php

<?php
    class tww_RemoveProductTabs_Model_Observer
    {
        public function removeTabs(Varien_Event_Observer $observer)
        {
            Mage::log("Observer triggered");
        }
    }
?>
  • still not working? – Abdul Dec 1 '15 at 5:17
  • Hi Adbul, I'm still having trouble getting this working. – Adam92 Dec 6 '15 at 19:38
0

You have to properly close the tww_RemoveProductTabs node:

<tww_RemoveProductTabs>
    <class>tww_RemoveProductTabs/observer</class>
    <method>removeTabs</method>
    <type>singleton</type>
</tww_RemoveProductTabs>  // you have to properly close `tww_RemoveProductTabs`
  • Hi 7ochem, I have corrected this close but it is still not writing to the log - I've also updated by question. Thanks! – Adam92 Dec 1 '15 at 9:17
  • Are you sure that logs are turned on? If so, turn on Developer Mode and check what happens. – SeStro Dec 1 '15 at 21:18
  • The logs are definitely turned on. I've run through the use case with developer mode on and I cant see any difference. Any ideas? Thanks! – Adam92 Dec 6 '15 at 19:47

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.