Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7408085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:50:54+00:00 2026-05-29T05:50:54+00:00

Instead of categories I would like products to appear in the drop-down navigation menu

  • 0

Instead of categories I would like products to appear in the drop-down navigation menu similar to lowes.com. Is this possible? I am not paying for anything either 🙂

I’ve attempted to alter core/Mage/Catalog/Block/Navigation.php and try to ‘fake’ products as categories but the object requirement is very specific. Since the function to create the menu is recursive it will only work on actual categories and nothing else. Any ideas?

I know another option is to create 2nd level categories and name them as my products and then do a rewrite in .htaccess but this is not dynamic and very messy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:50:55+00:00Added an answer on May 29, 2026 at 5:50 am

    After a bit of experimenting I’ve got this working! Below is the new code to use in

    app/code/core/Mage/Catalog/Block/Navigation.php

    function _renderCategoryMenuItemHtml (swap ‘local’ for ‘core’ if localizing)

    protected function _renderCategoryMenuItemHtml($category, $level = 0, $isLast = false, $isFirst = false, $isOutermost = false, $outermostItemClass = '', $childrenWrapClass = '', $noEventAttributes = false)
    {
        if (!$category->getIsActive()) {
            return '';
        }
        $html = array();
    
        // get all children
        if (Mage::helper('catalog/category_flat')->isEnabled()) {
            $children = (array)$category->getChildrenNodes();
            $childrenCount = count($children);
        } else {
            $children = $category->getChildren();
            $childrenCount = $children->count();
        }
        $hasChildren = ($children && $childrenCount);
    
        // get products listing
        $cur_category = Mage::getModel('catalog/category')->load($category->getId());
        $_productCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($cur_category)->setOrder('position','ASC');
        $k = 1;
        $hasProduct1 = $_productCollection->count();
        $phtmlChildren = '';
        if ($hasProduct1 >= 1) {
            $l = $level+1;
            foreach ($_productCollection as $_product) {
                $cur_product = Mage::getModel('catalog/product')->load($_product->getId());
                if ($cur_product->getStatus()) {
                    $phtmlChildren .= '<li';
                    $phtmlChildren .= ' class="level'.$l;
                    $phtmlChildren .= ' nav-'.$this->_getItemPosition($l);
                    if ($k == $hasProduct1) {
                        $phtmlChildren .= ' last';
                    }
                    $phtmlChildren .= '">'."\n";
                    $phtmlChildren .= ' <a href="'.$cur_product->getProductUrl().'">'.$this->htmlEscape($cur_product->getName()).'</a>'."\n";
                    $phtmlChildren .= '</li>';
                    $k++;
                }
            }
        }
    
        // select active children
        $activeChildren = array();
        foreach ($children as $child) {
            if ($child->getIsActive()) {
                $activeChildren[] = $child;
            }
        }
        $activeChildrenCount = count($activeChildren);
        $hasActiveChildren = ($activeChildrenCount > 0);
    
        // prepare list item html classes
        $classes = array();
        $classes[] = 'level' . $level;
        $classes[] = 'nav-' . $this->_getItemPosition($level);
        if ($this->isCategoryActive($category)) {
            $classes[] = 'active';
        }
        $linkClass = '';
        if ($isOutermost && $outermostItemClass) {
            $classes[] = $outermostItemClass;
            $linkClass = ' class="'.$outermostItemClass.'"';
        }
        if ($isFirst) {
            $classes[] = 'first';
        }
        if ($isLast) {
            $classes[] = 'last';
        }
        if ($hasActiveChildren) {
            $classes[] = 'parent';
        }
    
        // prepare list item attributes
        $attributes = array();
        if (count($classes) > 0) {
            $attributes['class'] = implode(' ', $classes);
        }
        if ($hasActiveChildren && !$noEventAttributes) {
             $attributes['onmouseover'] = 'toggleMenu(this,1)';
             $attributes['onmouseout'] = 'toggleMenu(this,0)';
        }
    
        // assemble list item with attributes
        $htmlLi = '<li';
        foreach ($attributes as $attrName => $attrValue) {
            $htmlLi .= ' ' . $attrName . '="' . str_replace('"', '\"', $attrValue) . '"';
        }
        $htmlLi .= '>';
        $html[] = $htmlLi;
    
        $html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
        $html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
        $html[] = '</a>';
    
        // render 'product' children
        $htmlChildren = '';
        if ($hasChildren) {
            $j = 0;
            foreach ($children as $child) {
                if ($child->getIsActive()) {
                    $htmlChildren .= $this->_renderCategoryMenuItemHtml($child, $level + 1, $j++ >= $k);
                }
            }
        }
        if ((!empty($htmlChildren)) || (!empty($phtmlChildren))) {
            $html[] = '<ul class="level'.$level.'">'."\n".$htmlChildren.$phtmlChildren.'</ul>';
        }
    
        // render children
        $htmlChildren = '';
        $j = 0;
        foreach ($activeChildren as $child) {
            $htmlChildren .= $this->_renderCategoryMenuItemHtml(
                $child,
                ($level + 1),
                ($j == $activeChildrenCount - 1),
                ($j == 0),
                false,
                $outermostItemClass,
                $childrenWrapClass,
                $noEventAttributes
            );
            $j++;
        }
        if (!empty($htmlChildren)) {
            if ($childrenWrapClass) {
                $html[] = '<div class="' . $childrenWrapClass . '">';
            }
            $html[] = '<ul class="level' . $level . '">';
            $html[] = $htmlChildren;
            $html[] = '</ul>';
            if ($childrenWrapClass) {
                $html[] = '</div>';
            }
        }
    
        $html[] = '</li>';
    
        $html = implode("\n", $html);       
        return $html;
    }
    

    Basically there are two new added sections. The first section builds the product collection to get relevant info (name, url, etc). The second section appends the new unordered list inside the existing root category list items. Hope this helps someone. Now you don’t need to pay $99 for the extension that is out there 🙂

    Tested on v.1.6.1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know if it's possible to write a migration instead of
I'm trying to create a sliding horizontal menu with different categories. I would like
is it possible to do something like this in objective-c (using categories or something
Hi I am trying to create a drop down menu using GWT. This is
Instead of having nested callbacks in JS, I would like to fire and listen
Instead of using an interface like this: public interface IStartable { void Start(); void
I have an mvc-page that lists categories, and I would like to have it
Doxygen appears to have idiosyncratic handling of Objective-C categories and I would like to
Is it possible to show posts by categories/tags on the index page instead of
Instead of prefixing id's in xml, is it possible to specify the particular layout

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.