0

I'm fairly new to Magento (1) and was wondering how I can add a small template file (containing Clerk search filters) to the top of the left sidebar within the 2columns-left template for a specific page. I've got it to show up on the correct page, but it just overlaps with everything.

This is the code:

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalogsearch_result_index>
        <reference name="left">
            <block type="core/template" name="filters" output="toHtml" template="clerk/filters.phtml"/>
        </reference>
    </catalogsearch_result_index>
</layout>

This is not a custom block, nor do I think it is necessary to create one (or is it best I do?), just to show the filters. But how can I render this at the top of the left bar, before any other content and make it not overlap with the rest of the content within the left sidebar?

Many thanks

  • do you want to create this filter manually or magento default filter? – Mujahidh Jan 10 '17 at 8:26
  • @mujas Preferably the default Magento filters, since they're used on a regular category page. (the idea is to make the clerk search result page look as much as the regular category page) – Nico V Jan 10 '17 at 8:35
1

Use a local.xml file approach. You can create your own template phtml file in page/html.File name filters.phtml

Call this file in your local.xml file.

<reference name="left">
<block type="core/template" name="filters" template="page/html/filters.phtml"/>
</reference>

I suggest this links for your reading

0

First check if you have created your phtml correctly, to do this try to display your phtml in frontend like this:

<?php echo Mage::app()->getLayout()->createBlock('core/template')->setTemplate('clerk/filters.phtml')->toHtml(); ?> 

if you block is displayed call it in local.xml like this:

<catalogsearch_result_index> //check if your layout handle is correct
        <reference name="left">
            <block type="core/template" name="filters" template="clerk/filters.phtml"/>
        </reference>
</catalogsearch_result_index>

Then it should work!

0

if you just need to add your default template before certain block you can use before attribute in block node, so far i got this working for my default magento1.9 theme, in which left should be like left_first, notice the before attribute:

 <layout version="0.1.0">
    <catalogsearch_result_index>
        <reference name="left_first">
            <block type="core/template" name="filters" before="catalog.leftnav.state.renderers" template="test/test.phtml"/>
        </reference>
    </catalogsearch_result_index>
</layout>

but if you need to craft custom dynamic filter block you need to add custom layered navigation block renderer

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.