I create custom header in cart page like this

<checkout_cart_index> 
    <reference name="root"> 
        <block type="page/html_header" name="header" as="header">
            <action method="setTemplate"><template>page/html/cartheader.phtml</template></action> 
        </block>          
    </reference>

    <reference name="footer">
        <block type="cms/block" name="Shopping Cart" before="footer_links">
            <action method="setBlockId"><block_id>shoppingcart</block_id></action>
        </block>        
    </reference>

</checkout_cart_index>

then i see my log files it shows below error what is problem on it's

2016-05-06T05:35:51+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'Invalid block type: Mage_Page_Block_Header' in /var/www/html/domain/app/Mage.php:595 Stack trace: #0 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...') #1 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('page/header', Array) #2 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('page/header', 'header') #3 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('page/header', 'header') #4 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element)) #5 /var/www/html/domain/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) #6 /var/www/html/domain/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks() #7 /var/www/html/domain/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() #8 /var/www/html/domain/app/code/core/Mage/Checkout/controllers/OnepageController.php(212): Mage_Core_Controller_Varien_Action->loadLayout() #9 /var/www/html/domain/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->indexAction() #10 /var/www/html/domain/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index') #11 /var/www/html/domain/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #12 /var/www/html/domain/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #13 /var/www/html/domain/app/Mage.php(684): Mage_Core_Model_App->run(Array) #14 /var/www/html/domain/index.php(83): Mage::run('', 'store') #15 {main}

Block type is page/html_header not page/header

Change below code

       <reference name="header"> 
            <block type="page/header" name="header">
                <action method="setTemplate"><template>page/html/cartheader.phtml</template></action> 
            </block>
            <remove name="navigation-link"/>
            <remove name="cms_footer_links"/>            
        </reference>

to:

   <reference name="header">            
        <action method="setTemplate"><template>page/html/cartheader.phtml</template></action>            
        <remove name="navigation-link"/>
        <remove name="cms_footer_links"/>            
    </reference>
  • Still same error – Magento 2 May 6 '16 at 6:06
  • Update answer please check it will surely work – Prashant Valanda May 6 '16 at 6:18
  • No Luck Same Error – Magento 2 May 6 '16 at 6:24
  • It is working for me may be there is other issue.Clear cache and check it. – Prashant Valanda May 6 '16 at 6:32

Try this code

<reference name="header">
    <block type="page/header" name="header">
        <action method="setTemplate"><template>page/html/cartheader.phtml</template></action> 
    </block> 
</reference>

try this with root reference

<checkout_cart_index> 
              <reference name="root">
  <block type="core/template" name="header" as="header" template="page/html/cartheader.phtml"/>
</reference>

        <reference name="footer">
            <block type="cms/block" name="Shopping Cart" before="footer_links">
                <action method="setBlockId"><block_id>shoppingcart</block_id></action>
            </block>        
        </reference>

    </checkout_cart_index>

other solution is

copy app/code/core/Mage/Page/Block/Html/Header.php

to app/code/local/Mage/Page/Block/Html/Header.php

change template in construct

public function _construct()
    {
      $currentUrl = Mage::getUrl('*/*/*', array('_current' => true));
  if (strpos($currentUrl,'checkout/cart') == true) {
        $this->setTemplate('page/html/cartheader.phtml');
  } else { $this->setTemplate('page/html/header.phtml'); }
    }
  • Still same i have a doubt it relatedt to header error or what – Magento 2 May 6 '16 at 7:53
  • did you check error log and remove the cache folder – Qaisar Satti May 6 '16 at 7:56
  • Yes Still same only \ – Magento 2 May 6 '16 at 7:56
  • update the code try that.. – Qaisar Satti May 6 '16 at 7:59
  • No luck same error – Magento 2 May 6 '16 at 9:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.