How can i display header only homepage in Magento? - magento

I want to display header only homepage.
How can i disable header other page?

Hi If your website having one column layout then open the 1column.phtml file and
replace this line
<?php echo $this->getChildHtml('header') ?>
with this,
<?php $page= Mage::getSingleton('cms/page')->getIdentifier();?>
<?php if($page=='home'){ ?>
<?php echo $this->getChildHtml('header') ?>
<?php } ?>

If you want remove this header using xml then follow below steps
step1:create local.xml under app/design/frontend/yourpackage/yourtemplate/layout
code of local.xml is
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="root">
<remove name="headerone"/>
</reference>
</default>
<cms_index_index >
<reference name="root">
<block type="page/html_header" name="header" as="header">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu" translate="label">
<label>Navigation Bar</label>
<block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
</block>
<block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
<label>Page Header</label>
<action method="setElementClass"><value>top-container</value></action>
</block>
</block>
</reference>
</cms_index_index>
</layout>
Step2:goto page.xml under app/design/frontend/yourpackage/yourtemplate/layout
Find <block type="page/html_header" name="header" as="header">
change it to
<block type="page/html_header" name="headerone" as="headerone">

You could do this quite easily without any code changes by adding a <remove /> line for the header block in your local.xml and then in the home page layout, adding the header block to the home page in CMS under page layout in the design tab.
Layout is quite powerful in making such a custom mod.

Related

How to call mini cart in footer in magento?

I want to call mini cart in footer.
i have to use below code in xml file
<reference name="footer">
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/topcart.phtml" before="-">
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
</reference>
or <?php echo $this->getChildHtml('top_cart') ?> in footer.phtml.
but its not working for me. please give me any idea for do it.
you name of block is footer_cart so
change
<?php echo $this->getChildHtml('top_cart') ?>
to
<?php echo $this->getChildHtml('footer_cart') ?>
other problem is you are calling the wrong file
change
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/topcart.phtml" before="-">
to
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/sidebar.phtml" before="-">

Add Banner Below Menu in Category Page

I need to add the category banner below the Breadcrumbs.
I have tried by adding new reference
<?php echo $this->getChildHtml('category_banner') ?>
in the 2columns-left.phtml
and in local.xml
<catalog_category_view>
<reference name="category_banner">
<block type="core/template" name="topbanner" template="catalog/category/category-image.phtml" before="-"></block>
</reference>
</catalog_category_view>
<catalog_category_default translate="label">
<reference name="category_banner">
<block type="core/template" name="banner" template="catalog/category/category-image.phtml"></block>
</reference>
</catalog_category_default>
But output is not coming.
Added new line inside the all layout i.e 2columns-left.phtml etc.
<?php echo $this->getChildHtml('category_banner') ?>
added below line inside your xml
<catalog_category_view>
<reference name="root">
<block type="core/template" name="category_banner" template="catalog/category/category-image.phtml" before="-"></block>
</reference>
</catalog_category_view>

Trouble displaying a custom block under the default cart block on the checkout/cart page

I have a custom block which I am trying to add below the default/template/checkout/cart.phtml on the checkout cart page.
I have block displaying using local.xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<reference name="checkout.cart">
<reference name="content">
<block type="module/checkoutextras" name="checkoutextras" as="extras" template="fracture/module/checkoutextras.phtml" after="content" />
</reference>
</reference>
</default>
</layout>
the problem is that it's appearing above the cart.phtml, basically it appears to be ignoring the after="content" in the block definition, it also doesn't move if I use after="-".
The relevant part of checkout.xml looks like this:
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
<action method="chooseTemplate"/>
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>
<block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
<label>Payment Methods Before Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
</block>
<block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
<label>Shopping Cart Form Before</label>
</block>
<block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
<label>Payment Methods After Checkout Button</label>
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
<block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
</block>
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml">
<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
</block>
</block>
</reference>
<block type="core/text_list" name="additional.product.info" translate="label">
<label>Additional Product Info</label>
</block>
</checkout_cart_index>
I must be missing something, but i've even tried after="checkout.cart", and adding the block directly to but in both cases the block won't render, it only renders if the content reference is included, but in the wrong place. How can I update local.xml so that the checkoutextras block will render below the cart?
This should work :
<?xml version="1.0"?>
<layout>
<checkout_cart_index><!-- You just need to update the layout for the cart page, so you can use the corresponding action name -->
<reference name="content"><!-- A single reference to the wrapping "content" block is enough (you want to put content below the cart, not inside) -->
<block type="module/checkoutextras" name="checkoutextras" as="extras" template="fracture/module/checkoutextras.phtml" after="-" />
</reference>
</checkout_cart_index>
</layout>

Magento: Add Block Before Footer

I'm using GrayScale template, and I want to move the recent viewed to a block before the footer.
I need this block with a different color from footer.
So, I removed this block of page.xml:
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
And added to footer block of page.xml:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
Perfect!
But, I need this block before footer and not inside...
How can I do this???
Thanks!
Open your Page.xml file and find the following block
<block type="page/html_footer" name="footer" as="footer" template="page/htmlfooter.phtml">
It should be arond line number 100.
Inside the block paste the following code
<block type="reports/product_viewed" name="reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml">
<action method="setColumnCount"><columns>4</columns></action>
<action method="setItemLimit"><type>recently_viewed</type><limit>4</limit></action>
</block>
The block should look like this
Now open your footer.phtml file and before the footer, i.e.
<div class="footer-container">
write the following code
<?php echo $this->getChildHtml('recently_viewed') ?>
And change the child block calling like the following
Now any logged in user will be able to view their recently viewed product and yes, it is outside the footer.
You can style it according to your needs, and you can also set the column count from the block itself.
Enjoy.
Try adding this right above the 'footer' section:
<block type="core/text_list" name="review.before.footer" as="review.before.footer" translate="label">
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
</block>

Magento - Add CMS Block to One Page

I have this code in a xml layout file:
<reference name="left">
<block type="blog/blog" name="left.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/left">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
I want to add a cms static block to the blog pages using this code:
<block type="cms/block" name="brand_list">
<action method="setBlockId"><block_id>brand_list</block_id></action>
</block>
If I add it in directly after this line:
<reference name="left">
It works but it is then displayed on every page. How can I get it to show only on the blog pages?
Thanks.
Edit: Here is the entire xml file:
<layout version="0.1.0">
<default>
<reference name="footer_links">
<block type="blog/blog" name="add.blog.footer">
<block type="blog/tags" name="blog_tags" />
<action method="addFooterLink" ifconfig="blog/menu/footer"></action>
</block>
</reference>
<reference name="right">
<block type="blog/blog" name="right.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="left">
<block type="blog/blog" name="left.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/left">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="top.links">
<block type="blog/blog" name="add.blog.link">
<action method="addTopLink" ifconfig="blog/menu/top"></action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>aw_blog/css/style.css</name></action>
</reference>
</default>
<blog_index_index>
<reference name="content">
<block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
</reference>
</blog_index_index>
<blog_index_list>
<reference name="content">
<block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
</reference>
</blog_index_list>
<blog_post_view>
<reference name="content">
<block type="blog/post" name="post" template="aw_blog/post.phtml">
<block type="socialbookmarking/bookmarks" name="bookmarks" template="bookmarks/bookmarks.phtml"/>
</block>
</reference>
</blog_post_view>
<blog_cat_view>
<reference name="content">
<block type="blog/cat" name="cat" template="aw_blog/cat.phtml" />
</reference>
</blog_cat_view>
<blog_rss_index>
<block type="blog/rss" output="toHtml" name="rss.blog.new"/>
</blog_rss_index>
</layout>
if it's going inside a section then it will be applied to all pages, you want to put the and its contents inside the sections (there'll be the listing page and individual post pages - the sections should already exist in the aw_blog.xml file
It appears on all pages, because you probably put the code in the section of the layout xml. Just put into a section named after the route where it should appear.
So try:
<blog>
<reference name="left">
<block type="cms/block" name="brand_list">
<action method="setBlockId"><block_id>brand_list</block_id></action>
</block>
</reference>
</blog>
Change XML inside folder theme/layout for example page.xml add something like this to header:
<block type="page/html_header" name="header" as="header">
<!-- ... some origin code ... -->
<block type="page/html" name="custom_block" as="flashHeader" template="customer/custom_header.phtml"/>
</block>
Create file customer/custom_header.phtml with your custom html code.
Inside template page/html/header.phtml you can add something like this:
$dataCurrentPage = $this->getHelper('cms/page')->getPage()->getData();
$page_id = (isset($dataCurrentPage['identifier'])) ? $dataCurrentPage['identifier'] : null;
if ($page_id == 'home' ) { echo this->getChildHtml('flashHeader') }
Flash banner will be show only on homepage.
You can definitely use the custom layout update to place your own static block on left without any coding.
You need to create a static block and then put its reference into custom layout update
<reference name="left">
<block type="cms/block" name="my_left_block" before="-">
<action method="setBlockId"><block_id>my_left_block</block_id></action>
</block>
to view an example follow the link below
https://lampjs.wordpress.com/2015/07/06/magento-add-static-cms-block-to-category-page-on-left/

Resources