Call-back icon  Sales: Call 800.374.8146 (N America)|757.278.0920 (International)

Magento

Open Source eCommerce Evolved

Magento Forum

   
Page 1 of 2
How do I create a product category, without it showing up in the main navigation? 
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

I have tried Active = yes, Anchor = no, but it still shows in the navigation.  I thought the “Anchor” field was what determined if it shows in the navigation, no?

 
Magento Community Magento Community
Magento Community
Magento Community
 
roco
Sr. Member
 
Total Posts:  117
Joined:  2008-03-18
 

Try making a new category at the same level as the “root category” for your site.  All categories under the new category should not show up in your nav.  You could also use attributes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

Thanks Roco.  I tried that and the only problem is when I put it on the root category level, I can’t seem to access it.  I setup a URL rewrite for it, but the rewrite doesn’t seem to work.  Also, when I go to the /category/id/36 or whatever the real URL is, that doesn’t work either.

It seems like with previous versions of Magento when you select Anchor = No it removes it from the Navigation.  If that’s not what the Anchor feature does, then what is it for?

 
Magento Community Magento Community
Magento Community
Magento Community
 
paul@moodandmind.com
Member
 
Avatar
Total Posts:  57
Joined:  2008-01-13
 

BUMP! I need to know this too!

I’ve blown my whole day trying to figure this out. PLEASE HELP!

 
Magento Community Magento Community
Magento Community
Magento Community
 
dunk
Jr. Member
 
Total Posts:  24
Joined:  2008-02-24
 

Whats up with this, did anyone find a solution??

It’s driving me nuts, if “is anchor” to “No” doesn’t remove the category from navigation whilst keeping it active within the store whats the point in it???

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

In early development versions of Magento, I could have swore that’s what the “anchor” feature did.  I would set it to “No” and it would remove from the navigation.  Maybe I should try to download and old version and give it a shot.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dunk
Jr. Member
 
Total Posts:  24
Joined:  2008-02-24
 

I have since found that the is anchor applies to the layered navigation only....since I am not using layered navigation this would not have been obvious, bit misleading that one

.....it would be useful if I could find a way of accessing this attribute in the same way as isActive() so I could affect the templates accordingly to ignore the categories I want from the navigation.... if I find anything I will post it here, if you find a way before me I would love to know.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

Can probably go into app > design > frontend > default > default > template > catalog > navigation > top.phtml and code it so it only will load categories with the attribute Anchor = “yes”.  I’ll look into it and see if I can figure that out.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kara
Member
 
Total Posts:  36
Joined:  2008-01-17
aa, mi
 

I’d love to know what the “right” way to have done this is, but my solution was to create a new store and store view in the same website (ADMIN > System > Manage Stores)

Before rolling around to this approach, I made a new category at the root level as suggested earlier and as also pointed out earlier, there’s no way to access it that I could figure.  But if you create another store in the same website and assign your new root level category as the Root Category for that store, then you have a prayer.  (Be sure to put some subcats in your new root-level category.)

Meanwhile back in ADMIN>System>Manage Stores, the store view for your new store includes a “code”.  Assign that to something unique and then the URL becomes http://www.yourdomain.com/yourSubCatName/?store=yourCodeName

It causes some trouble for links within that new subcat because the store URL isn’t your main store anymore, but depending on what you’re putting there it might not matter.  Hope it helps.  Let me know if there’s a better way!

 
Magento Community Magento Community
Magento Community
Magento Community
 
dunk
Jr. Member
 
Total Posts:  24
Joined:  2008-02-24
 

brady:

yep already looked in there but no obvious function in app/code/core/catalog/block/navigation.php to find if the category is an anchor or not, if you find something let me know!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

Looks like the proper file is app > code > core > Mage > Catalog > Block > Navigation.php

Looks like the main categories code is:

public function getStoreCategories()
    
{
        $helper 
Mage::helper('catalog/category');
        return 
$helper->getStoreCategories();
    
}

While the subcategories code is (notice the anchor tag):

public function getCurrentChildCategories()
{
        $layer 
Mage::getSingleton('catalog/layer');
        
$category   $layer->getCurrentCategory();
        
/* @var $category Mage_Catalog_Model_Category */
        
$collection Mage::getModel('catalog/category')->getCollection();
        
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
        
$collection->addAttributeToSelect('url_key')
            ->
addAttributeToSelect('name')
            ->
addAttributeToSelect('is_anchor')
            ->
addAttributeToFilter('is_active'1)
            ->
addIdFilter($category->getChildren())
            ->
joinUrlRewrite()
            ->
load();

        
$productCollection Mage::getResourceModel('catalog/product_collection');
        
$layer->prepareProductCollection($productCollection);
        
$productCollection->addCountToCategories($collection);
        return 
$collection;
 
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
johannes
Magento Team
 
Avatar
Total Posts:  11
Joined:  2007-08-03
 

Building additional store views to accomodate this seems cumbersome and not ideal… Anchor = “yes/no” does have logic associated which governs the category’s behavior within the layered navigation logic, so making the category tree dependent on this may have repercussions.  It may also work fine, depends on how much you’re depending on layered navigation features.

At this time I don’t believe Magento has a flag whereby categories can be turned off in the nav but still be “active” (accessible via URL)

I can think of a few uses for this, but I’m curious as to what you guys would be doing with it… Let me know smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brady
Sr. Member
 
Avatar
Total Posts:  199
Joined:  2007-09-10
Orange County, CA
 

I want to use it for product-specific landing pages. 

For example, we sell laptop bags, so I want to create a landing page that includes all 17” laptop bags for women.  By creating a new category, I can easily assign products to this 17” laptop bags page, instead of building a static page through CMS and adding the products manually through code.  The trick is, I don’t want a navigation option for 17” laptop bags for women.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kara
Member
 
Total Posts:  36
Joined:  2008-01-17
aa, mi
 

I’d posted about this previously (http://www.magentocommerce.com/boards/viewthread/7388/) but didn’t get an answer then, hence my use of multiple stores.

We often like to create categories that aren’t part of our catalog hierarchy for merchandising purposes.  Clearance items, gift ideas for X, Summer specials, As seen on XYZ show… etc.  They’re pretty varied and are driven by semi-random merchandising and PR events.  Having flexible categories that we can make on the fly, without having to make them part of our catalog structure or having to recode to pick up a new attribute, is way helpful.

 
Magento Community Magento Community
Magento Community
Magento Community
 
johannes
Magento Team
 
Avatar
Total Posts:  11
Joined:  2007-08-03
 

@Brady - Ah I see.

I think layered navigation might be a simpler way to accomplish this - you could just create an attribute “Gender” (or something more fun sounding) and make this filterable with results…

Then, under the Laptop bags category it can show up as a way to filter all laptop bags by Men and Women.  It looks to me that the URLs contain the layered navigation settings, so you could point people to this category, already filtered to Women.

This is an example from my test:
http://www.example.com/catalog/category/view/price/35,10/color/23/manufacturer/21/id/8/

Obviously the category name isn’t in the URL, but it is at the very end: /id/8/.  The other paths are:
- /price/35,10/
- /color/23/
- /manufacturer/21/

And these indicate the layered navigation settings at which the category loads…

Would that work?

 
Magento Community Magento Community
Magento Community
Magento Community
 
johannes
Magento Team
 
Avatar
Total Posts:  11
Joined:  2007-08-03
 

@ Brady:

Whoops, just noticed you wrote “The trick is, I don’t want a navigation option for 17” laptop bags for women.”

So maybe that won’t work for you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
Sales: Call 800.374.8146 (North America) 757.278.0920 (International)
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
33629 users|350 users currently online|74598 forum posts