[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Magento Layered Navigation

Posted on 2009-12-20
3
Medium Priority
?
988 Views
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?
0
Comment
Question by:polscifreak
  • 2
3 Comments
 
LVL 12

Expert Comment

by:miked2004
ID: 26096520
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

0
 

Author Comment

by:polscifreak
ID: 26101611
miked2004,

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.

Thanks
0
 
LVL 12

Accepted Solution

by:
miked2004 earned 2000 total points
ID: 26102009
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.
<?php
     //Load selected category by Id
     $category = Mage::getModel('catalog/category')->load(14);
     Mage::register('current_category, $category);
?>


<?php 
   echo $this->getLayout()->createBlock('catalog/layer_view')
        ->setName('catalog.leftnav')
	->setTemplate('catalog/layer/view.phtml')
	->toHtml();
?>

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 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