11

I have a widget setup on all category pages via backend -> CMS - > Widgets

Now when I use this method I select a block for category pages and the block shows up nicely. It is at the bottom of all other information in the left column.

But how do I move the block up to top? (above layered etc) ...

The alternative is to use local.xml, that I do not prefer + it also then shows up on ALL my websites that use the same theme.

  • 3
    Perhaps try using the custom layout updates field in the category to add the block and use before="" or after="" to position it. – Rick Kuipers Jan 23 '13 at 8:33
12

The problem is that Magento doesn't have widget container on top of left column. You can create such a container in two steps:

  1. Create you widget block container in local.xml file:

    <layout>
       <!-- category pages with layered navigation -->
       <catalog_category_layered>
            <update handle="custom_top_container" />
       </catalog_category_layered>
       <!-- category pages without layered navigation -->
       <catalog_category_default>
            <update handle="custom_top_container" />
       </catalog_category_default>
       <!-- custom block container on that page -->
       <custom_top_container>
            <reference name="left">
               <block name="left_top" type="core/text_list" before="-" translate="label">
                    <label>Left Column Top</label>
               </block>
            <reference>
       </custom_top_container>
    </layout>
    

    In the following example catalog_category_default and catalog_category_layered are the handles for category pages and custom_top_container handle is included into these pages by update layout instruction. The new left_top block is a type of Mage_Core_Block_Text_List, that shows concatenated output of child blocks assigned to it, so it will be empty if no widget is added to it. Now when layout is ready to the widget configuration, check the next step.

  2. Create widget.xml file in etc directory of your theme (if you wan't preserve this configuration from theme you are extending, then you need to copy it from that theme into yours). This widget.xml should contain additional information for Magento to know which widgets supports your newly created container:

    <widgets>
        <[widget_id]>
            <supported_blocks>
                <left_column_top>
                    <block_name>left_top</block_name>
                </left_column_top>
             </supported_blocks>
        </[widget_id]>
    </widgets>
    

    This configuration file lets Magento know which blocks can be used for retrieving of possible container in the admin panel.

Sow you can go in the admin panel and choose your Left Column Top container for widget layout update.

|improve this answer|||||
  • Thanks Ivan. And myabe the best way - if we are editing local.xml anyways - is to also iimmediately call the CMS block (only a small image that was meant for the top left) – snh_nl Feb 10 '13 at 14:32
2

You could try calling in that block using

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('BLOCK_ID_HERE')->toHtml() ?>

Insert the above code into:

frontend/default/YOURTHEME/template/catalog/navigation/sidebar.phtml

above the code that displays the catalog menu.

To keep it from displaying in across websites use different themes per website.

|improve this answer|||||

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.