Magento : Override the Category Layout

To change the design of your template, you can edit the php layout file directly but you will see that It is not easy as you must edit several xml files. the easier way is to use the admin backend.

Magento permits you to change the Design with your custom xml content.

Click on Catalog -> Manage Categories, click on your category and into the Custom Layout Update field enter the following xml:

<reference name="left"> 
 <action method="unsetChild"><name>cart_sidebar</name></action>
 <action method="unsetChild"><name>catalog.compare.sidebar</name></action>
 <action method="unsetChild"><name>right.poll</name></action> 
 <action method="unsetChild"><name>left.reports.product.viewed</name></action>
 <action method="unsetChild"><name>left.newsletter</name></action>
 <action method="unsetChild"><name>paypal.partner.right.logo</name></action>
 <block type="checkout/cart_sidebar" before="right.permanent.callout" name="cart_sidebar" template="checkout/cart/sidebar.phtml" />
</reference>

Into this example, I have removed the unwanted block and added my block.

Note: I have commented some block into my template layout and you should adapt to your layout.

You can also add you cms block like this:

<block type="cms/block" name="steps"><action method="setBlockId"><block_id>steps</block_id></action>
 </block>

And create your Static Block with the « steps » identifier with what you want.

To identify the name of the default block, you can check the xml file into the app/design/frontend/default/<template>/layout directory.

For example into the category.xml:

        <reference name="left">
            <block type="catalog/product_compare_sidebar" after="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
            <block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml" after="cart_sidebar">
                <action method="setImgSrc"><src>images/media/sidebar-banner.jpg</src></action>
                <action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
                                <action method="setLinkUrl"><url>checkout/cart</url></action>
            </block>
        </reference>

As you can see, the catalog.compare.sidebar is defined into this file.

Sometimes Magento add a block in double and you should test on your development system before.

Voila,

You may be interrested by my Magento Module API  : Myapi_Myconf !

Nicolas Portais
Author Photographer
http://www.mystockphoto.fr

Ce contenu a été publié dans Non classé, avec comme mot(s)-clé(s) , , , , , , , , , , , , , , , , . Vous pouvez le mettre en favoris avec ce permalien.

12 Responses to Magento : Override the Category Layout

  1. http://medicpdf.com/ dit :

    you’re in reality a excellent webmaster. The web site loading speed is incredible.
    It kind of feels that you’re doing any distinctive
    trick. Furthermore, The contents are masterwork. you have performed a excellent process on this matter!

  2. http://pdfpills.com/ dit :

    It’s really a nice and helpful piece of information.
    I’m happy that you simply shared this useful info with us.
    Please keep us informed like this. Thank you for sharing.

  3. Christoffer Steenbeck dit :

    Just saved my life. Been looking all over for a simple plugin or similar to control the sidebar – but this helped me out. Thank you!

  4. ExieYStauss dit :

    Hey there just wanted to give you a quick heads up. The words
    in your content seem to be running off the screen in Safari.

    I’m not sure if this is a formatting issue or something to do with
    browser compatibility but I figured I’d post to let you know.
    The layout look great though! Hope you get the problem fixed soon. Cheers

  5. AntoniaXLevey dit :

    Hey there great blog! Does running a blog like this require a large amount of work?
    I’ve virtually no understanding of programming but I had been hoping to start my own blog in the near future.
    Anyways, if you have any ideas or tips for new blog owners please share.
    I understand this is off topic however I simply wanted to ask.
    Thank you!

  6. LizzetteAPrats dit :

    I need to to thank you for this wonderful read!!
    I definitely loved every bit of it. I’ve got you book-marked to look at new stuff you post…

  7. quest bars dit :

    If some one wishes expert view concerning running a blog after that i advise him/her to pay a visit this web site, Keep up the pleasant work.

  8. Coconut Oil dit :

    I am not sure where you’re getting your information, but good topic.
    I needs to spend some time learning more or understanding
    more. Thanks for fantastic information I was looking for this info for my mission.

  9. Coconut Oil dit :

    you’re truly a just right webmaster. The website loading speed is amazing.

    It seems that you’re doing any distinctive trick.
    In addition, The contents are masterpiece. you have performed a great activity in this matter!

  10. EnochGWede dit :

    WOW just what I was looking for. Came here
    by searching for reviews

  11. http://www.youtube.com/ dit :

    Hi there, just became aware of your blog through
    Google, and found that it is really informative. I am gonna watch
    out for brussels. I’ll be grateful if you continue this in future.
    Many people will be benefited from your writing. Cheers!

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Captcha (solve the arithmetic equation) * Time limit is exhausted. Please reload CAPTCHA.