Magento 1 page layout - magento

I wanted to change the layout of only one page, which is the category page. I edited the catalog.xml line 187 from 2-columns-right to 1-column but it edited my product page. My question is how can I edit only the category page (where shows all products within a category, see image attached)

You should never modify core files in place, and it is best practice to avoid overriding and customizing core layout files in custom themes. Rather, you should use the local.xml layout file. There is a great tutorial on layout XML customization at MageBase.com.
local.xml is being merged into the compiled layout configuration DOM last among all layout XML files, giving its directives a certain authority over others. You should try the following content:
<?xml version-"1.0"?>
<layout>
<catalog_category_view>
<reference name="root">
<action method="setTemplate">
<template>page/2columns-right.phtml</template>
</action>
</reference>
</catalog_category_view>
</layout>
Remember to clear/disable the layout XML cache while developing.

Related

Magento: Order detail page is not showing

Order details page isn't showing any data, left bar , header , footer are present on the page. I enabled error log but there isn't error.
If I change theme to other theme, I can see details but when I change it to hellowired theme, nothing is there.
I don't understand whats wrong going on, what I'm supposing is some other person played with code or changed something which is causing this issue, and now I'm totally unable to understand where to proceed from.
Its simply complicated. Without any error how can I reach at that point in Magento where there are so many files in it with vast and complicated structure.
Any help would act as pain relief :P. Is there anyone who can suggest anything.
If it's working with default theme, that means your custom theme "helloweird" may have something wrong in the layout files.
If you are referring to the checkout page you should look in the file
app/design/frontend/helloweird/helloweird/layout/checkout.xml .
If you are referring to account order history details then you should look in the customer.xml
The path to the layout folder of your theme may differ.
You will not receive errors if the layout xml files have something wrong.
first of all you have to check checkout.xml FROM app/design/frontend/YOUR_PACKAGE/YOUR_THEME/layout
if it's contain checkout_onepage_success block if not then you have to copy these block from base
<checkout_onepage_success translate="label">
<label>One Page Checkout Success</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
<reference name="content">
<block type="checkout/onepage_success" name="checkout.success" template="checkout/success.phtml"/>
</reference>
</checkout_onepage_success>
let me know if you have still problem

Order of CSS files. Load module's CSS before theme's CSS

How can I change the order of CSS files to load module's CSS before theme's CSS? Here are some code examples:
Theme's CSS file (loaded on all pages) added in theme's local.xml:
<default>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/theme.css</name>
</action>
</reference>
</default>
Extension's CSS file (loaded only on category pages) added in module's XML layout file:
<catalog_category_layered>
<reference name="head">
<action method="addItem">
<type>skin_css</type>
<name>css/extension.css</name>
</action>
</reference>
</catalog_category_layered>
This is the order of loaded CSS files which I get on the category page, extension's CSS is loaded after theme's CSS:
/default/mytheme/css/styles.css
/default/mytheme/css/theme.css
/default/mytheme/css/extension.css
What I'm trying to achieve: extension's CSS is loaded before theme's CSS.
How can I force this order of CSS files:
/default/mytheme/css/styles.css
/default/mytheme/css/extension.css
/default/mytheme/css/theme.css
I've noticed that if I have many extensions installed, CSS of some extensions loads before theme's CSS and CSS of some other extensions loads after theme's CSS. I assume that it has something to do with the order of modules in Magento, but I don't understand how I can affect the order of CSS (or JavaScript) files on the frontend.
There's two things here that I'll elaborate on first: 1) the order in which layout XML files are loaded and 2) the order which layout handles are processed.
1 - Layout xml files are loaded in the order which the extensions are loaded. Extensions are loaded alphabetically (as the server reads the files in app/etc/extensions), however when there is module dependencies, the module which is depended on by another module, will be loaded first. Magento actually loops through all these XML files twice in order to achieve this. First time to read all the extensions, and second time to load them by order of dependencies/then all the remaining get loaded in alphabetical order. local.xml however is a special case, and always is loaded last so that its instructions take priority over any extension's layout instructions.
Now I know what you're thinking at this point "if local.xml is loaded last, why is the extension's CSS file being loaded afterwards?" Well that's due to the following...
2 - The order in which layout handles are processed. This is what's getting you in this particular case. Despite the fact that local.xml is loaded after your extension's layout file, it is because the extension is targeting the 'catalog_category_layered' layout handle. This layout handle, gets processed after the layout handle 'default'. It is because of this, that you're getting stuck with extension's the CSS file being loaded after your theme's CSS file.
So what's the solution? Quite simple, although somewhat annoying. In your local.xml file, you just need to target this layout handle and first remove your theme's CSS file, then add it back in again.
This should do the trick for you:
<catalog_category_layered>
<reference name="head">
<action method="removeItem">
<type>skin_css</type>
<name>css/theme.css</name>
</action>
<action method="addItem">
<type>skin_css</type>
<name>css/theme.css</name>
</action>
</reference>
</catalog_category_layered>
Your site will process these instructions after the extension's instructions, within this layout handle. Therefore, your CSS file will be loaded afterwards as well.
Maybe this helps
Theme Precedence / Priority

Magento - updating catalog.xml

I'm trying to update a magento theme (the theme name is blank_seo), and i'm trying to change the product page default template to 3 columns. I've tried updating the app/design/frontend/default/blank_seo/layout/catalog.xml file. but so far nothing is working.
The only solution that i've found is manually changing the 'Page Layout' dropbox to 3 columns. If anyone has a simpler/quicker way of doing this (or a reason why my editing of catalog.xml doesn't work), I'd be extremely thankful!
Just looking at the code I have, I have been able to do this without any issue, which part of the catalog.xml file are you changing? It should be the <catalog_product_view> element like so:
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/1column-productview.phtml</template></action>
</reference>
....
</catalog_product_view>
I have a custom template set up in my system for the product page, as you can see.
Also, make sure you refresh your cache and check your logs to ensure you are not missing any errors.

Is there any way to remove the yui reset.css from Magento 1.6?

I'm working on a Magento theme in version 1.6.1 and for some reason the default installation has a bunch of yui scripts and stylesheets loading last in the <head>. One of these is the yui reset.css which should be loaded as the first stylesheet, not the last, and it's overriding all kinds of styles.
I can't for the life of me find where these includes are happening. I know that it's related to the getCssJsHtml() function but I don't see it being added anywhere.
You can do it through your theme layout.
Just add the local.xml file to your theme's layout dir with the following content:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="head">
<action method="removeItem"><type>skin_css</type><name>css/reset.css</name></action>
</reference>
</default>
</layout>

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