Question

I'm very new to Magento and I'm trying to add a new tab to the customer view of Magento backend.

I have made a new extension/module for it. Here are some extracts of my etc/config.xml:

<global>
    <blocks>
        <showidea>
            <class>Whatever_Extendcustomer_Block</class>
        </showidea>
    </blocks>
    <!-- ... -->
</global>
<adminhtml>
    <layout>
        <updates>
            <showidea>
                <file>whatever_extendcustomer.xml</file>
            </showidea>
        </updates>
    </layout>
</adminhtml>

And here the contents of the whatever_extendcustomer.xml file:

<adminhtml_customer_edit>
    <reference name="customer_edit_tabs">
        <action method="addTab">
            <name>extendcustomer_showidea</name>
            <block>extendcustomer/adminhtml_customer_showidea</block>
        </action>
    </reference>
</adminhtml_customer_edit>

Of course this block is existing and it extends the Mage_Adminhtml_Block_Template and implements Mage_Adminhtml_Block_Widget_Tab_Interface.

When I go to details of a customer I get now the error: Wrong tab configuration. In Magento's error log stands:

exception 'Mage_Core_Exception' with message 'Invalid Blocktype: Mage_Extendcustomer_Block_Adminhtml_Customer_Showidea' in /var/www/vhosts/whatever/htdocs/app/Mage.php:594

And I think this is the problem, because Mage_Extendcustomer is wrong. It should be Whatever_ ... but I don't know why it is prepending the Mage_ instead of my Whatever_ namespace.

I hope someone can give me the clue! Thanks.

Was it helpful?

Solution

You should use showidea instead of extendcustomer in your layout file :

<adminhtml_customer_edit>
    <reference name="customer_edit_tabs">
        <action method="addTab">
            <name>extendcustomer_showidea</name>
            <block>showidea/adminhtml_customer_showidea</block>
        </action>
    </reference>
</adminhtml_customer_edit>

Because it's what you've defined in the blocks config :

<blocks>
    <showidea>
        <class>Whatever_Extendcustomer_Block</class>
    </showidea>
</blocks>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top