local.xml is not loading in magento - magento

I want to delete the recently viewed products at the category view page. I have created my local.xml in public_html/app/design/frontend/base/default/layout
I have looked at several potential solutions on the internet but nothing seems to work. I use the following code at the moment:
<default><reference<reference name="right">
<remove name="right.reports.product.viewed"/> </reference> </default>
I also have tried left, but not seems to work. Could someone help me how to succeed loading local.xml? Thank you.

The above solution even if written correctly, will remove the right side reports view from all the pages (I am hoping that this needs to be removed only from CATEGORY VIEW page).
Firstly, create local.xml file in custom theme folder. I would suggest creating custom package too like below:
/app/design/frontend/customPackage/customTheme/layout/
However, since you are using BASE
/app/design/frontend/base/default/layout/local.xml
The code must be as below:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<catalog_category_default>
<reference name="right">
<remove name="right.reports.product.viewed"/>
</reference>
</catalog_category_default>
</default>
</layout>
This will work only if the template for is set to 2columns-right.phtml
Hope this helps.
Happy Coding...

If you installed a theme try to copy local.xml file to theme's layout directory
like this "\app\design\frontend\THEME_DIR\layout\local.xml"
also you have a syntax error in your xml
it should be:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="right">
<remove name="right.reports.product.viewed"/>
</reference>
</default>

Related

Replacing header.phtml with new checkout_header.phtml in local.xml

I've copied the code from this answer but still cant change the header code, I'm only getting the standard header.phtml file.
Add custom header for Checkout pages in Magento (1.8.x)
I cant tell if magento is not reading my local.xml file (I've refreshed all caches etc) or if I'm missing something from the code. I've tried several varations of code from searches (as below) but none are working. I'm trying to do it all in local.xml, without editing other template files.
do i need to tell magento to read my new local.xml file? Should I remove the old header first?
<checkout_onepage_index>
<reference name="root">
<block type="page/html_header" name="header" as "header">
<action method="setTemplate"><template>page/html_checkout_header.phtml</template></action>
</block>
</reference>
</checkout_onepage_index>
You should use the header reference instead of defining a new block named header. This should update the existing header block by referencing it and applying the change.
<?xml version="1.0"?>
<layout version="0.1.0">
<checkout_onepage_index>
<reference name="root">
<reference name="header">
<action method="setTemplate"><template>page/html_checkout_header.phtml</template></action>
</reference>
</reference>
</checkout_onepage_index>
</layout>
Also trivial, but make sure page/html_checkout_header.phtml actually exists inside of the theme's template folder you are using.

Edit template layout in 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>

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.

How to remove 'Orders and Returns' from the footer?

I've updated a fresh Magento 1.5.0.1 installation to Magento 1.6.0.0, and now I've got a link in the footer, "Orders and Returns", that I can't figure (yet) how to remove that.
I can't remove it from the core files, I've tried the XML method but doesn't seems to work (probably my fault).
At the moment I can't even localize where the link is generated, as simple tests (like putting random words where the output should appear) never works.
Anyone got any suggestion or a solution about?
You could try:
<layout>
<default>
<reference name="return_link">
<!-- Set the template file to an empty string to prevent output -->
<action method="setTemplate">
<template></template>
</action>
</reference>
</default>
</layout>
Or in 1.7+:
<layout>
<default>
<reference name="footer_links">
<action method="removeLinkBlock">
<blockName>return_link</blockName>
</action>
</reference>
</default>
</layout>
Or, as mentioned by Rumble:
<layout>
<default>
<remove name="return_link" />
</default>
</layout>
One caveat about using remove element is that it would prevent the usage of that block name anywhere in the layout as it is converted into a global xpath selector.
Here the solution.
Since I needed to keep it theme related, I duplicated the layout sales.xml from app/design/frontend/base/default/layout/ to my theme layout folder (app/design/frontend/default/<name>/layout/) and commented out the <action> element from following snippet:
<default>
<reference name="footer_links">
<block type="sales/guest_links" name="return_link"/>
<action method="addLinkBlock"><blockName>return_link</blockName></action>
</reference>
</default>
Enjoy!
There's a really simple way to remove this link. Add the following to your theme's local.xml
<default>
<remove name="return_link"/>
</default>
There's a good introduction to using local.xml here.

Magento - rearrange welcome message, searchbox and catalog nav using local.xml

i'm trying to achieve a layout wherein the default welcome message sits on top of the search box followed by the catalog nav similar to what they have here.
i was hoping to do this through the local.xml file. so far i have this:
<?xml version="1.0" ?>
<layout>
<default>
<!-- add the local stylesheet -->
<reference name="head">
<action method="addCss"><stylesheet>css/local.css</stylesheet></action>
</reference>
<reference name="header">
<action method="unsetChild"><alias>topSearch</alias></action>
<action method="insert"><blockName>top.search</blockName><sublingName>catalog.topnav</sublingName><after>1</after></action>
</reference>
</default>
</layout>
i was able to unset the searchbox but i couldn't make it insert before the catalog nav - nothing happens. i also tried inserting it this way
<reference name="top.nav">
<action method="insert"><blockName>top.search</blockName><sublingName>catalog.topnav</sublingName><after>1</after></action>
</reference>
but it still doesn't work. what could i be doing wrong here?
i'm getting really confused here, is this kind of approach okay to do? i checked the header.phtml and saw that i only have to switch the lines for the default welcome message and searchbox and i'm done! but i guess this would mean that i would have to make a copy
of the header.phtml to my own theme. would this be a better approach?
thanks!
Make a copy of header.phtml for your own theme. As you've seen it controls the order of output and there is no magic that can make it change otherwise - except for hacking it with javascript but that's worse...
The purpose of having different folders for each theme is to allow exactly this sort of override so use it to your advantage.

Resources