3

The original post is further down but I would like to rephrase it for clarity:

We use both top & left-side navigation on Magento CE and I want to add the MAIN category to our left-side navigation ONLY.

Now, the way things are currently configured (or customized) is when you create a new Main Category and set Visible in Nav to (Yes) it is added to BOTH top navigation & left-side navigation.

Conversely, if you set Visible in Nav to (No) it is removed from BOTH top navigation & left-side navigation.

So how can I show the Main Category in one BUT not the other? I have looked at left.phtml & top.phtml too. Thank you all again in helping resolve this question.

=> Original Post:

Our Magento CE site is customized to show Categories in both the top & left-side menus. So, how do I show a Category ONLY in the left-side menu? I have looked through left.phtml & top.phtml here: /html/app/design/frontend/default/ourtheme/template/catalog/navigation to no avail as well as dozens of other files. I can't seem to figure this out. Can you help me? Thank You.

  • To clarify, below is an example of what I want to accomplish. Notice that the ROOT Categories 5 & 8 ONLY appear in the sidebar menu. Currently, when I add a Root Category it is added to BOTH sidebar & main menus. How do I make the appropriate changes??? Thank You! - *(MAIN MENU) Cat 1 | Cat 7 | Cat 9 *(SIDEBAR/LEFT MENU) Cat 1 - Cat 5 - Cat 8 - Cat 7 - Cat 9 – user9722 Jul 2 '14 at 20:43
4

I had same problem, after some coding I made this in template/catalog/navigation/left.phtml:

first line:

<?php $ct = Mage::registry('current_category')->getID(); ?>

in the end of the file(before endif;)

<?php elseif( $ct == 92 || $ct == 85 || $ct == 224): ?>
<?php
$currentcategory = Mage::registry('current_category');
$subcategorys = explode(',' , $currentcategory->getChildren());


?>

<div class="block block-layered-nav">
    <div class="block-title">
        <strong><span><?php echo $this->__('Browse By') ?></span></strong>
    </div>
    <div class="block-content">
        <dl id="narrow-by-list2">
            <dt><?php echo $this->__('Category') ?></dt>
            <dd>
                <ol>
                <?php foreach($subcategorys as $cat): ?>
                     <?php $cate =  Mage::getModel('catalog/category')->load($cat); ?>
                    <li>

                        <a href="<?php echo $cate->getUrl()?>" <?php if ($this->isCategoryActive($cate)): ?> class="current"<?php endif; ?>><?php echo $this->escapeHtml($cate->getName()) ?>(<?php echo $cate->getProductCount() ?>) </a>                  
                    </li>
                <?php endforeach; ?>
                </ol>
            </dd>
        </dl>
        <script type="text/javascript">decorateDataList('narrow-by-list2')</script>
    </div>
</div>

<?php endif; ?>
  • Please do not load() in a loop, this is a performance killer. Rather use a collection: $collection = Mage::getResourceModel('catalog/category_collection')->addIdFilter($subcategorys); foreach ($collection as $cate) { ... – Fabian Schmengler Feb 13 '15 at 21:41
2

If you want to remove a category from top menu and then want to show it only in left side, then Go to

Catalog  >  Manage Category  > [Select  a  category]  > General Information (tab)  >  Include in Navigation Menu

and set it to No.

  • Thank you but I already tried that. Selecting "No" removes it from the left-side menu yet leaves it in the top menu. I want to do the opposite. – user9722 Jun 30 '14 at 19:09
1

enter image description here

As shown in the above image.please select Is Anchor to Yes of each categories from the Display Settings.

Then Your category will come in the left side.

If this answer helped you.please upvote and accept this answer Please

  • Setting "Is Anchor to Yes" had no effect and neither does selecting "No" for "Include in Navigation Menu". What that did was remove the 'Category' from the left-side menu 'ONLY' while leaving it in the 'Top' Menu. I want to do the opposite. Any other help? Thank You! – user9722 Jun 30 '14 at 19:18
1

Solved after some research & thought I would share! To recap, our site (Magento CE Platform) is programmed to add MAIN CATEGORIES to both top nav & left-side nav when "Visible in Nav" is set to "Yes". But I didn't want to show ALL MAIN CATEGORIES in the top navigation which I solved using the following PHP Array. I'm sure this is simple coding because I'm a beginner but there it is none the less:

<?php foreach ($this->getStoreCategories() as $_category): ?>
<!-- show categories in top nav not in following array -->
<?php if (!in_array($_category->getId(), array(738, 383, 392, 328, 389))) : ?> 
<?php echo $this->drawItem2($_category) ?>
<?php endif; ?>
<?php endforeach ?>

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.