Return to Snippet

Revision: 64163
at July 11, 2013 01:27 by vbth


Initial Code
<ul>
			                <?php $parentCategoryId = 3;
							foreach (Mage::getModel('catalog/category')->load($parentCategoryId)->getChildrenCategories() as $_category): ?>
								<li class="<?php echo $_category->getName(); ?>">
									<a href="<?php echo $_category->getUrl(); ?>"><?php echo $_category->getName(); ?></a>
									<?php if ($currentCategory & $currentCategory->getId() == $_category->getId()): ?>
										<?php $parentCategory = $currentCategory ?>
					                    <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
					                    <?php $_subcategories = $_category->getChildrenCategories() ?>
					                    <?php if (count($_subcategories) > 0): ?>
					                        <ul>
					                            <?php foreach($_subcategories as $_subcategory): ?>
					                                <li>
					                                    <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
					                                        <?php echo $_subcategory->getName() ?>
					                                    </a>
					                                </li>
					                            <?php endforeach; ?>
					                        </ul>
					                    <?php endif; ?>
					                <?php endif; ?>
			                    </li>
			        		<?php endforeach

Initial URL

                                

Initial Description
Comment

Initial Title
Category and Childcategory snippet

Initial Tags

                                

Initial Language
PHP