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

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.

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

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.

Related

How do I add a new block to my layout in magento 1.9?

I have a beginner question on layouts ...After reading a lot about layouts, i am more confused than where i started. I want to add a banner block that will be displayed on my home page and a few other pages. I decided that it cannot be a part of the header.
I want to add this right below the header. I am trying to create my layout via bootstrap. I see in some themes that this is done inside the cms.xml file and i am not sure why i need to edit that. Clearly, i am confused..
Any help would be appreciated.
Go to your theme
app/design/frontend/Your-Package/Your-Theme/layout/local.xml
add below code:
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index>
<reference name="content">
<block type="core/template" name="banner" before="-" template="banner/banner.phtml" />
</reference>
</cms_index_index>
</layout>
add banner.phtml file to
app/design/frontend/Your-Package/Your-Theme/template/banner/banner.phtml
add your banner in above file
To add a block to any other page replace <cms_index_index> with <routname_controllername_actionname> For example, <catalog_product_view>.

How to remove or hide breadcrumbs for a particular page in magento

I am trying to hide the (Home > Catalog Advanced Search > Results) breadcrumbs alone in magento during the advanced search results. I don't want to navigate through the breadcrumbs in result page. Anybody help me to make this possible.
Try using
<remove name="breadcrumbs" />
Within specific handle of your layout xml file.
For example
<catalog_category_default>
<remove name="breadcrumbs" />
</catalog_category_default>
Or try using that within the cms page layout form in backend under CMS->Pages.
You can do by the admin:
CMS-> Pages:
Page Information
Design:
Custom Design
Custom Layout Update XML: <remove name="breadcrumbs" />
Magento 2 Code to remove breadcrumbs for CMS Page
<referenceContainer name="page.top">
<referenceBlock name="breadcrumbs" remove="true" />
</referenceContainer>
You can remove breadcrumbs in various ways in Magento.
For example if you want remove from a specific action like (Home > Catalog Advanced Search > Results) you just update catalogsearch_advanced_result in catalogsearch.xml file from your theme with:
<catalogsearch_advanced_result translate="label">
<remove name="breadcrumbs" />
</catalogsearch_advanced_result>
If you want to remove from all dynamic pages add this
<default>
<remove name="breadcrumbs" />
</default>
If you want to remove from a CMS page, you just configure from admin panel. Go to
system->configuration and then web->Show Breadcrumbs for CMS Pages.
Refresh your cache and check.
For Magento 2.1
Goto Admin->Store->General->Web->Default Pages->Show Breadcrumbs for CMS Pages
Select Option No for breadcrumbs
For Magento2 Remove from specific CMS page. Add following on Design >>Layout section of you CMS page
<referenceContainer name="page.top">
<referenceBlock name="breadcrumbs" remove="true"/>
</referenceContainer>
Edit catalogsearch.xml in /app/design/frontend/base/default/layout/
Add <remove name="breadcrumbs" /> within
<catalogsearch_advanced_result translate="label">
<label>Advanced Search Result</label>
<update handle="page_two_columns_right" />
<remove name="breadcrumbs" />
</catalogsearch_advanced_result>
Refresh and check... Breadcrumbs will be removed in advanced search result alone.
In layout update xml, per cms page:
<reference name="root">
<remove name="breadcrumbs"/>
</reference>

Add a static block to one page checkout in Magento via local.xml

I would like to add a CMS static block (basket_shipping_message) just above the available shipping methods in my Magento checkout. I can edit the phtml file but would rather do it via my local.xml file.
The following code doesen't seem to be working, any ideas?
<checkout_onepage_index>
<reference name="content">
<reference name="shipping_method">
<block type="cms/block" name="basket_shipping_message" before="available">
<action method="setBlockId"><block_id>basket_shipping_message</block_id></action>
</block>
</reference>
</reference>
</checkout_onepage_index>
Did you call in your phtml template getChildHtml('basket_shipping_message');? That should do it. Without that magento does not render the block

Magento change default column layout

Ok I've checked everywhere including here and everyone's answers is exactly what I have written down so I have no idea why it's not working.
I cleared Magento's cache besides the configuration..
This is what I have in my local.xml file:
<layout>
<default>
<!-- Remove callouts and rarely used stuff -->
<remove name="right.poll" />
<remove name="right.permanent.callout" />
<remove name="left.permanent.callout" />
<!-- Add the local stylesheet -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</default>
</layout>
I deleted the other css stuff I had written since my only concern is the root reference.
My directories look like:
simplistic
layout
local.xml
template
page
html
footer.phtml
header.phtml
etc (all other layout subthings)
1column.phtml
What exactly am I doing wrong? It's still using the 2 column layout when I'm trying to make it use the 1 column..
EDIT:
For anyone curious on the page, here is the page:
http://magento.neofill.com/magento/
You would think after editing local.xml in the default, that would affect all pages right? I don't get what I'm doing wrong. I keep searching and everything is exactly the way I have it. It should be working but if you view the source code, you'll see that it's using the 2 column layout here:
<div class="main-container col2-right-layout">

ColorBox integration in Magento

I want to add ColorBox jQuery in my Magento website. Is there an specific method for this?
Or do I have to make the changes in .phtml files?
To add new javascript library on all your pages use layouts. Create new layout file yourmodule.xml and put there code
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/colorbox.js</name><params/></action>
<action method="addItem"><type>skin_css</type><name>js/colorbox.css</name></action>
</reference>
</default>

Resources