troubleshooting Question

PHP Query

Avatar of movieprodw
movieprodw asked on
3 Comments1 Solution200 ViewsLast Modified:

I have the following query and I would like it so that if there is a sub category then the parent category is not a link.

My ultimate goal is to make an accordion menu with this.

        <?php foreach ($this->getStoreCategories() as $_category): ?>
		<a href="<?php echo $this->getCategoryUrl($_category) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a>
		$category = Mage::getModel('catalog/category')->load($_catid);
		$subcategory = $category->getAllChildren(true);
		foreach ($subcategory as $sub)
		$sub1 = Mage::getModel('catalog/category')->load( $sub);
		<li><a href="<?php echo $sub1->getUrl();?>"><span>
		<?php echo $sub1->getName(); ?>
		<?php } ?>
		<?php }?>
		<?php endforeach ?> 

Open in new window

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros