Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Forked from anonymous/mageavcat
Created October 25, 2011 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amacgregor/1310965 to your computer and use it in GitHub Desktop.
Save amacgregor/1310965 to your computer and use it in GitHub Desktop.
Magento EAV Attribute for Category
INSERT INTO `eav_attribute` VALUES(132, 3, 'include_in_left_menu', NULL, NULL, 'int', NULL, NULL, 'select', 'Include in Left Navigation Menu', NULL, 'eav/entity_attribute_source_boolean', 0, 0, '1', 0, NULL);
<?php
$parentid = 3; //Parent category ID
$parentCat = Mage::getModel('catalog/category')->load($parentid);
$childCategories = explode(',',$parentCat->getChildren()); //Child category IDs separated by commas
?>
<div class="block block-layered-nav">
<div class="block-content">
<dl id="narrow-by-list2">
<?php $parentCategoryId = 2;?>
<dt><?php echo $this->__('Our Kitchen Range') ?></dt>
<dd>
<ol>
<?php foreach($childCategories as $catId): ?>
<?php $_category = Mage::getModel('catalog/category')->load($catId); ?>
<?php if( $_category->getIsActive() && $_category->getIncludeInLeftMenu()): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a>
</li>
<?php endif; ?>
<?php endforeach ?>
</ol>
</dd>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment