0

New to Magento.

Can any one guide me how to define a default layout for category pages.

Tried local.xml in my theme folder but not working.

Here is my xml file :-

<!-- Default handle, loaded on most pages -->
<default>

    <reference name="head">

        <!-- Remove Magento's default assets -->
        <action method="removeItem">
            <type>skin_css</type>
            <name>css/print.css</name>
        </action>
        <action method="removeItem">
            <type>skin_css</type>
            <name>css/styles-ie.css</name>
        </action>
        <action method="removeItem">
            <type>skin_css</type>
            <name>css/styles.css</name>
        </action>
        <action method="removeItem">
            <type>skin_css</type>
            <name>css/widgets.css</name>
        </action>
        <action method="removeItem">
            <type>skin_js</type>
            <name>js/ie6.js</name>
        </action>
        <action method="removeItem">
            <type>js</type>
            <name>lib/ds-sleight.js</name>
        </action>
        <action method="removeItem">
            <type>js</type>
            <name>varien/menu.js</name>
        </action>

        <!-- Add our assets -->
        <action method="addCss">
            <stylesheet>css/font-awesome.css</stylesheet>
        </action>
        <action method="addCss">
            <stylesheet>css/jquery-ui.css</stylesheet>
        </action>
        <action method="addCss">
            <stylesheet>dist/css/style.css</stylesheet>
        </action>
        <action method="addCss">
            <stylesheet>css/ddSlick.css</stylesheet>
        </action>
        <action method="addCss">
            <stylesheet>css/parsjewellers.css</stylesheet>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>js/jquery-1.11.1.min.js</name>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>js/jquery-ui.js</name>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>js/ddSlick_jquery.dropdown.js</name>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>dist/js/script.js</name>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>js/my_site.js</name>
        </action>

        <!-- Add additioanl child blocks -->
        <block type="core/template" name="boilerplate.head.meta" template="boilerplate/page/html/head/meta.phtml"/>
        <block type="core/template" name="boilerplate.head.ie8" template="boilerplate/page/html/head/ie8.phtml"/>

    </reference>

    <reference name="header">
        <block type="directory/currency" name="custom_currency_selector" template="currency/currency.phtml"/>
    </reference>

    <reference name="right">
        <remove name="paypal.partner.right.logo" />
        <remove name="right.permanent.callout" />
        <remove name="right.poll" />
        <remove name="cart_sidebar" />
        <remove name="catalog.compare.sidebar" />
    </reference>

    <reference name="left">
        <remove name="currency" />
        <remove name="left.permanent.callout" />
        <remove name="tags_popular" />
        <remove name="left.newsletter" />
    </reference>

</default>

<catalog_category_default>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</catalog_category_default>


<print>

    <reference name="head">

        <!-- Add our assets -->
        <action method="addCss">
            <stylesheet>css/style.css</stylesheet>
        </action>
        <action method="addItem">
            <type>skin_js</type>
            <name>js/script-ck.js</name>
        </action>

    </reference>

</print>

Any help would be highly appreciated.

Thanks

1

First of all, the file name is local.xml, not loacal.xml

and here's an example how to change layout of category page:

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <catalog_category_default>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
    </catalog_category_default>
    <catalog_category_layered>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
    </catalog_category_layered>
</layout>

Layout update above will change regular category layout template and layout template of category with layered navigation to 2columns-right.phtml.

  • Thanks that fixed it. Sorry for the typo. Yes it was overwritten by catalog_category_layered handle. – tousif Jun 2 '14 at 12:52
0

Are you using layered navigation? It is possible that it's be overwritten by the catalog_category_layered layout handle.

  • Try changing your layout handle to catalog_category_layered – Mike O'Loughlin Jun 2 '14 at 12:51
0
<catalog_category_default>
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
    </reference>
</catalog_category_default>

That looks right to me. Two things though:

In your question you spelled it "loacal.xml" which isn't right. If that's your actual filename, it should be local.xml.

Alternatively: if your cache is turned on it needs refreshed to update the changes. I would suggest turning caching off entirely until you're done working on your shop, it'll save you a lot of "why isn't this working?!"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.