Put a banner on top of two column cms page in magento - magento

I created a new CMS with 2column layout and now want to put full width or 1 column banner on top of 2 columns.
I tried
<reference name="root">
<block type="cms/block" name="my_banner" as="my_banner" template="path/to/my_banner.phtml" />
</reference>
in Layout Update XML but nothing happened. Any help will be appreciated!
As per #richtea response I updated the CMS page layout settings like the screenshot given below but didn't worked
http://screencast.com/t/CiidoSRgkNs

You are requesting the page to add a CMS block, but referencing a PHTML template. You can either:
Insert a CMS block, use the below and create a block in your admin panel with identifier my_banner.
<reference name="root">
<block type="cms/block" name="my_banner">
<action method="setBlockId"><block_id>my_banner</block_id></action>
</block>
</reference>
Or insert a template file as follows
<reference name="root">
<block type="core/template" name="my_banner" as="my_banner" template="path/to/my_banner.phtml" />
</reference>

Related

how to add custom page layout pages magento

I have custom layout page
I have added the following code to app/code/core/Mega/page/etc/config.xml
<shop_overview module="page" translate="label">
<label>Shop OverView Page</label>
<template>page/shop_overview.phtml</template>
<layout_handle>shop_overview</layout_handle>
</shop_overview>
This show the "Shop Over View Page" on admin panel in page layout drop-down
I want to remove product list from category for this page layout only.
I tried the following but it is not working.
<shop_overview translate="label">
<label>All One-Column Layout Pages</label>
<reference name="root">
<action method="setTemplate">
<template>page/shop_overview.phtml</template>
</action>
<action method="setIsHandle"><applied>1</applied></action>
</reference>
<reference name="category.products">
<remove name="product_list" />
</reference>
</shop_overview>
Instead of this you can assign static block to this category by changing display mode to Static Block Only.
And then creating and selecting that block for that category.
Reference Link: http://leveluptuts.com/tutorials/magento-community-tutorials/19-how-add-static-block-category-page

how to insert my custom template file in list page using xml without using getChild html and not rewrite list.phtml

This is how i tried. bud didn't get answer. what my template will do is each product image will have a like button. i have done with view.phtml but not in list.phtml. Pls friends broadcast your knowledge.
<reference name="content">
<block type="productlike/most" name="productlike" before="-">
<action method="setTemplate" ifconfig="section_1/group_1/enabled"><template>productlike/like.phtml</template>
</action>
</block>
</reference>

magento change block not working properly

I am using magento 1.7
on my product page I have added related product on right sidebar.
there are other block also displayed on sidebar these are
-related product
-recently viewed product
-mycart
-paypal logo
Now I want related product to get displayed after mycart and paypal logo, right now it is displayed on top of right bar
I have used before and after but that is not working.
These is my code
paypal.xml
<reference name="right">
<block type="paypal/logo" name="paypal.partner.right.logo" after="cart_sidebar" template="paypal/partner/logo.phtml"/>
</reference>
catalog.xml
<reference name="right">
<block type="catalog/product_list_related" name="catalog.product.related" after="paypal.partner.right.logo" template="catalog/product/list/related.phtml"/>
</reference>
checkout.xml
<reference name="right">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.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>
how can I put mycart and paypal logo on top of right bar.
First you need to create or update your local.xml file IF you do not have a local.xml file you can create one in
app->frontend->[Package Name]->[Theme Name]->layout->local.xml
Once this is created you can copy exactly what I have in this post into that file for a start of how to use one.
DO ALL UPDATES THROUGH A LOCAL.XML file not through catalog.xml or checkout.xml !! This will make upgrades significantly easier later down the road. Additionally, you will be able to quickly see all changes you have made to your site in one file. This way I can see what you are actually updating.
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<reference name="right">
<!-- <action method="unsetChild"><alias>catalog.product.related</alias></action> -->
<block type="catalog/product_list_related" name="catalog.product.related" after="-" template="catalog/product/list/related.phtml"/>
</reference>
</default>
</layout>
If you end up with two try uncommenting my action method.. I can't remember if you have to declare it in separate reference or within there because I didn't test this but give it a try

Add block using Custom Layout Updates to category

I am trying use the Custom Layout Update field of a category to add something to the left sidebar for just this category but can't quite get it to work. I had it working before so I know I can do it but then my client accidentally deleted the category.
This works, so I know I have the ability to add something - but I don't want a static block:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-">
<action method="setBlockId"><block_id>designer_sidebar</block_id></action>
</block>
</reference>
I want to include a phtml file from my theme folder and trying this, but can't get it to output anything:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-" template="catalog/category/view_sidebar.phtml" />
</reference>
<reference name="left">
<block type="core/template" name="Designer Sidebar" template="catalog/category/view_sidebar.phtml"/>
</reference>

Adding image in Magento via update layout

I'm trying to figure out how to add images, etc. to the left sidebar portion of a 2 column with left sidebar page in Magento using the layout update in the cms ->page->design portion of the admin area.
Is it possible to do this from the update layout xml area? If not, could you explain how to create a module (or whatever else would be required).
Thanks.
If you look in base/default/layout/catalog.xml, you will see an example of using a template with an image placeholder that can be specified in your Update Layout XML area:
<reference name="left">
<block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml">
<action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>
<action method="setLinkUrl"><url>checkout/cart</url></action>
</block>
</reference>
So, in your Update Layout XML, you would write something like:
<reference name="left.permanent.callout"> <!-- match this to the block name from above -->
<action method="setImgSrc"><src>images/media/my_file_name.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Some text here</alt></action>
<action method="setLinkUrl"><url>your/path</url></action>
</reference>
You can adapt that by taking a copy of the template file left_col.phtml and making changes as you wish.

Resources