Add custom header for Checkout pages in Magento (1.8.x)

混江龙づ霸主 提交于 2019-12-05 08:02:37

问题


I am trying to add a customised header to my Checkout pages, I have figured out removing the header from the page is basically adding a node in the /layout/checkout.xml file, could anyone explain how to basically a new altered header that only applies to all the Checkout pages.

Current default/layout/checkout.xml

 <default>
   <remove name="footer"> <!-- removes the footer from checkout -->
... // all other xml data..
</default>

pseudocode for my theme

if (a CHECKOUT PAGE) {
  use 'custom checkout header'
else
  use the standard default header.

回答1:


In your local.xml file add the below code to add a custom header to the checkout page

<checkout_onepage_index>
    <reference name="root">
      <block type="page/html_header" name="header" as="header" template="page/html/your_new_header_file_name.phtml"/>
    </reference>
</checkout_onepage_index>

Now create a new_header.phtml in app/design/frontend/default/default/template/page/html and add the custom header contents in this file. Now update your new header file name in the above template field.

You can replace default/default with your_package_name/your_theme_name




回答2:


You will have to add something like

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

in your page template files (1column.phtml, 2columns-left.phtml, etc)

Also try changing

<reference name="root">

to

<reference name="head">

if it is still not working.



来源:https://stackoverflow.com/questions/22451587/add-custom-header-for-checkout-pages-in-magento-1-8-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!