Hi Everybody,
I'm quite new with magento and I can't find solution with this problem:
I would like to hide the categoies which are not belong in the same products.
Please see the printscreens for easy understanding.
1. Front Office
Please visit the link below to see the printscreen picture.
http://www.mx7.com/view2/zukesk2kpTlwqMy3
2. Back Office
Please visit the link below to see the printscreen picture.
http://www.mx7.com/view2/zukhbLSjXtM0uv5O
Looking forward to hear from you guys,
Cheers,
Hi @armzzplayboy, your image links don't seem to work. Maybe post them here instead?
Unfortunately, I'm not sure what you're asking so it's difficult to answer without the visuals.
See if below code help you to get what you want.
Let's say that you already have the current category in the variable $category. This piece of code should give you all the (active) category siblings.
$siblings = Mage::getModel('catalog/category')->getCollection()->setStoreId(Mage::app()->getStore()->getId()); $siblings->addAttributeToSelect('*') ->addAttributeToFilter('parent_id', $category->getParentId()) //siblings have the same parent as the current category ->addAttributeToFilter('is_active', 1)//get only active categories ->addAttributeToFilter('entity_id', array('neq'=>$category->getId()))//exclude current category ->addAttributeToSort('position');//sort by position
Now you can use loop of the siblings and list them:
<?php foreach ($siblings as $sibling): ?> <a href="<?php echo $sibling->getUrl();?>"><?php echo $sibling->getName();?></a><br /> <?php endforeach;?>
References: http://magento.stackexchange.com/questions/1303/how-to-show-category-siblings
Thanks