Search code examples
phpmagentoadminhtml

Adding block but it is not displayed


I want to place a new block in the sales -> transactions -> view. So I created a new block and add this block to the template.

web/app/design/adminhtml/default/company/layout/local.xml

<adminhtml_sales_transactions_view>
    <reference name="content">
        <block type="company_module/adminhtml_sales_transactions_error_grid" name="sales_transactions.error.grid" as="error_grid"/>
    </reference>
</adminhtml_sales_transactions_view>

web/app/code/local/company/module/Block/Adminhtml/Sales/Transactions/Error/Grid.php

class Comapny_Module_Block_Adminhtml_Sales_Transactions_Error_Grid extends Mage_Adminhtml_Block_Sales_Transactions_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('transactionErrorGrid');
        $this->setPagerVisibility(false);
        $this->setFilterVisibility(false);
    }

    ....

The class looks like web/app/code/core/Mage/Adminhtml/Block/Sales/Transactions/Detail/Grid.php.

/web/app/design/adminhtml/default/company/template/sales/transactions/detail.phtml

<?php echo $this->getChildHtml('error_grid') ?>

Why is the new block not shown?

edit:

OK, I checked the exeption.log and found this:

exception 'Mage_Core_Exception' with message 'Invalid block type: Mage_Company_Module_Block_Adminhtml_Sales_Transactions_Error_Grid' in /var/www/html/web/app/Mage.php:595
Stack trace:
#0 /var/www/html/web/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /var/www/html/web/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('company_module...', Array)
#2 /var/www/html/web/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('company_module...', 'error_grid')
#3 /var/www/html/web/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('company_module...', 'error_grid')

I debugged this and found that there is something wrong in web/app/code/core/Mage/Core/Model/Config.php in getGroupedClassName function. There magento loads the groupType from the config and this is null. So this function adds a Mage_ before my class name and this Mage-Class didn't exsist.

Any ideas how to fix this?


Solution

  • The problem was a wrong groupname in the config.xml file from the extension. After changing this the problem is solved.