Magento Layered Navigation

Posted on 2009-12-20
Last Modified: 2012-05-08
I am trying to figure out a problem with layered navigation using the magento shopping cart.

What I want to do is use one of my attributes in the layered navigation on the HOMEPAGE.

I can get the layered navigation to work AFTER I select a category, but I want my chosen attribute to be available for navigation on the homepage.

How can I do this?
Question by:polscifreak
    LVL 12

    Expert Comment

    As I understand, the layered navigation is suppose to be used from with in a category. When you place the layered nav block on the homepage you may need to set the top most category(root category) as active. This would mean setting it in the registry. "Mage:register('current_category', 1)" I believe current category is what it looks for, but I might be wrong. And you would need to replace 1 with the id of your root catalog.
    P.S. If that dosn't work it might want the category object. so instead of 1 you would want to pass the object. You could get it by:
    $category = Mage::getModel('catalog/category')->load($categoryId);

    Open in new window


    Author Comment


    Thank you for your comment! I didn't even think of that.

    Do you happen to know where this might be in the files?

    I've been looking around and I can't seem to find it.

    LVL 12

    Accepted Solution

    Well I hope this helps a little. This will get you a layered navigation block onto your homepage, but you will still need to add a product list like the category pages or edit the layered navigation filter links so that they point to a page that will display a product list.  This will use the root category's settings. You will probably want to set another catalog by using the code at the top of the snippet attached.
         //Load selected category by Id
         $category = Mage::getModel('catalog/category')->load(14);
         Mage::register('current_category, $category);
       echo $this->getLayout()->createBlock('catalog/layer_view')

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now