1

I'm quite puzzled by this one. I'm fairly new to the Magento architecture, so forgive me if this is a simple issue. I've got my caches disabled.

I'm on Magento 1.7.0.2, and I've created a vertical category navigation to sit in my left sidebar on all pages. I then tried to add a layout update to local.xml. Nothing happened. I checked the valudation on the xml - no errors.

Here's the update I'm trying:

<reference name="left">        
    <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/vert_nav.phtml" />
</reference>

Next, I tried placed it in catalog.xml, and sure enough, it appeared in the right spot on the home page. When I click through to the category pages, however, it disappears. I assume this means that catalog.xml is not in play on category pages? Is there another xml for this?

1

To make it appear in category pages you should place it under catalog_category_default for both (Anchor) and (Non Anchor) categories it should look like

     <catalog_category_default translate="label">
            <label>Catalog Category (Non-Anchor)</label>
           <reference name="left">        
               <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/vert_nav.phtml" />
           </reference>

Same is to be done with Anchor Category

3
  • Ok I did that, so now there are two updates in the catalog.xml, one positioned at the very top, in the place of the usual compare products blocks etc. the second one where you suggested. It still isn't working for on the category pages however... – Donncha Jan 2 '14 at 20:11
  • I feel like I'm so close! I'm now getting 2 duplicate blocks when I click through to product page. Should I have a reference inside the opening <default> of catalog.xml? Or should I wait till later on in the file? – Donncha Jan 2 '14 at 20:30
  • Its wont be working on a category page because your category might be Anchor. Put the code in anchor category. Search for (Anchor) in catalog.xml, you will find the same structure as above. Insert your code in there – Dexter Jan 3 '14 at 4:40
0

The problem is you're missing a relevant layout handle. Without a handle the layout engine is trying to find a handle named 'reference' and when it does not it fails.

It may be a good idea to apply it by default to all left navigation items because as you say this is a static element to assist with site navigation. To do that you can apply it to the default layout handle:

<!-- this is the layout handle -->
<default> 
    <!-- this is the reference block we're using to create our sub-block -->
    <reference name="left">        
        <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/vert_nav.phtml" />
    </reference>
</default>

To add it just to non-anchor categories (categories that do not have layered navigation) use <catalog_category_default> otherwise if you need it on pages that also contain layered navigation you'll want to use <catalog_category_layered>.

Best of luck.

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.