Edit template layout in Magento - magento

I'm trying to edit the right sidebar of the homepage of a site based on Magento. When I edit the Layout Update XML field in the Custom design part of the homepage, I see this code:
<reference name="right">
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
<action method="unsetChild"><name>right.newsletter</name></action>
<action method="unsetChild"><name>cart_sidebar</name></action>
<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page"/>
</reference>
But I can't find where would be the layout specified in the block tag. When I remove the whole code, the sidebar is still displaying but with the Compare Sidebar Widet on top of the rest of teh sidebar.
I'm new to Magento and a little bit lost. Thank for your help.

use this
<remove name="catalog.compare.sidebar"/>
in default
like this
<default>
<reference name="right">
<remove name="catalog.compare.sidebar"/>
</reference>
</default>
it will work

The best way to accomplish is to create local.xml file under your themes layout section and paste this code. So you do not need to search in all the files.
<layout version="0.1.0">
<default>
<!-- remove compare sidebar -->
<remove name="catalog.compare.sidebar"/>
</default>
</layout>

Related

Magento Category Custom Design Page Layout not changing

I have turned off caching, but not matter what I do when I edit Admin -> Catalog -> Categories. Then click on the Custom Design and edit Page Layout, and layout from 1 - 3 columns.
None of the changes show up. I've tried this for the Default Site and specific site per category with no updates reflecting the front-end. I can edit the Custom Layout Update area and use something like:
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
Or I can edit the local.xml file and force all categories to be a specific layout:
<catalog_category_default>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</catalog_category_default>
<catalog_category_layered>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</catalog_category_layered>
However I need the Page Layout options to work. Maybe this has something to do with the layout in local.xml that add / removed things from the left and right side? As a note in the CMS Pages area, I can successfully change the Page Layout.
I found out the issue. I relied on another theme which forced the catalog_category_default to always render 2 columns. This was because update handle sets the applied variable to 1 which ignores admin page layout changes.
Here is what it is doing:
<catalog_category_default>
<update handle="page_two_columns_left"/>
...
</catalog_category_default>
So the only way I could override it was from my own XML update, but it still did not let me update the page layout from the admin.
<catalog_category_default>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</catalog_category_default>
So the fix was to set the applied variable to 0.
<catalog_category_default>
<reference name="root">
<action method="setIsHandle"><applied>0</applied></action>
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</catalog_category_default>
This lets me use the Category Layout from the Custom Design tab in the Category Admin
I found this out by locating the handle and reviewing what variables it set. So here was the definition of page_two_columns_left:
<page_two_columns_left translate="label">
<label>All Two-Column Layout Pages (Left Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
<action method="setLayoutCode"><name>two_columns_left</name></action>
</reference>
</page_two_columns_left>
Instead of using the reference code to change the layout, do so in admin control panel:
Go to categories / custom design
Find the page layout selection and change to 2 columns with either left or right bar.
Alternative solution:
use the layout update:
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
In this way the page layout is changed regardless of the is_handle value

how to change the design of product view page to 2columns-right in magento

I want to change the design of my product view page to 2columns-right. For that I changed in app/design/frontend/default/mytheme/catalog.xml to 2columns-right.
The code is
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
After clearing the cache also,design is not changing it is still in 2columns-left panel.
In admin also, set no to apply to products,then also it is not changing.
If anyone have any idea to change the design in 2columns-left for detail page, then please help me.
Thanks!
Try like this
<catalog_product_view>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
</catalog_product_view>
create a local.xml file in layout directory and put this code inside it
<layout>
<catalog_product_view>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
</catalog_product_view>
</layout>

Magento layered navigation 1column template not appearing

I am trying to display layered navigation in 1column template for catalog pages. Followed this answer:
Magento layered nav positioning on one column layout
but with no results. I am building for the first a custom theme so maybe I unintentionally broke something somewhere but have no clue where to start looking.
So far I added to local.xml
<layout>
<default>
<reference name="left">
<action method="unsetChild"><name>catalog.leftnav</name></action>
</reference>
<reference name="category.products">
<action method="insert"><child>catalog.leftnav</child></action>
</reference>
</default>
</layout>
tried also to put it between ...
<layout>
<catalog_category_layered>
[...]
</catalog_category_layered>
</layout>
... but no results as well.
And added to my_theme/catalog/category/view.phtml
<?php echo $this->getChildHtml('catalog.leftnav') ?>
but no visible results.
I am using Magento 1.8 CE and have onepage checkout by IWD and Strategery infinite scroll plugins installed.
You can simply add the layered nav block like below in catalog_category_default handler catalog.xml of your theme.
<catalog_category_default translate="label">
<reference name="content">
<block type="catalog/layer_view" name="catalog.contentnav" template="catalog/layer/view.phtml"/>
</reference>
</catalog_category_default>
After that refresh the cache and check.

Change homepage to 1column.phtml in local.xml in new theme in Magento

I am new to Magento. I want to develop theme in it. I start to create it by create CSS, JavaScript and add this files to it and it work. I want to change template file for home page to 1column.phtml that is located in
my_theme/default/template/page/1column.phtml
Here is my code in local.xml file
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!--default layout-->
<default>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/style.css</name></action>
</reference>
</default>
<cms_index_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/script.js</name></action>
</reference>
</cms_index_index>
</layout>
But the result is used 3column.phtml as it default.
How can I set 1column.phtml to my Magento homepage?
you can simply do it without changing any core files:
Login to admin panel
Navigate to CMS->Pages
Go to the Page named Home Page, click on it.
On left hand panel go to the "Design " Tab
Under Page layout column, choose 1 column
Save
Please check the following image for more info:
When you edit any of the xml files you want to refresh the cache. This can be done by logging in to the admin and clicking system > cache management, then selecting all, and choosing refresh.
Alternatively you could disable all those caches while the project is in development. Same place, just a different option chosen.
EDIT
How about if you ignore the layout.xml and instead go to the magento admin to CMS>CMS Pages choose the home cms page, then go to design tab and put in the following
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
<remove name="left" />
<remove name="right" />
</reference>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/script.js</name></action>
</reference>

Magento - layout template location change of reviews link (summary_short.phtml) on Catalog page

I've made a simple custom module that places the reviews on the Product page (instead of linking to the a new page as is the default).
Everything on the Product page is working perfectly. The link on the Catalog page is not. This still links to the "review page" instead of the Product page like it should. This is because I cannot seem to trigger a layout template location change for the summary_short.phtml in my custom xml layout file.
Here is my layout file contents:
<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<default>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>css/reviews.css</name></action>
</reference>
</default>
<!-- This works great -->
<catalog_product_view>
<reference name="content">
<reference name="product.info">
...
<action method="addReviewSummaryTemplate"><type>default</type><template>productpagereviews/review/helper/summary.phtml</template></action>
<action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
</reference>
</reference>
</catalog_product_view>
<!-- Below does not work at all -->
<catalog_category_default>
<reference name="content">
<reference name="product_list">
<action method="addReviewSummaryTemplate"><type>default</type><template>productpagereviews/review/helper/summary.phtml</template></action>
<action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
</reference>
</reference>
</catalog_category_default>
</layout>
I hate answering my own question AFTER I ask it - dang it! Regardless, I'm going to post the answer so others can know if they have trouble.
It turns out I needed a different main handle. The correct one was this catalog_category_layered. I still left the "default" tag there as I'm not exactly sure why this one works and catalog_category_default doesn't. If anyone can answer that, I'd be grateful!
The complete (chunk of) code would be as below:
<catalog_category_layered>
<reference name="product_list">
<action method="addReviewSummaryTemplate"><type>short</type><template>productpagereviews/review/helper/summary_short.phtml</template></action>
</reference>
</catalog_category_layered>
Now everything works as exactly as intended! Time for some more testing....
This may help answer your question about why one worked and not the other: http://kb.magenting.com/content/13/60/en/magento-is-anchor-option-in-category-properties.html
Essentially, *catalog_category_layered* is used when you have the category option "Is Anchor" enabled.

Resources