List category and subcategory on sidebar – Magento

<?php
 $obj = new Mage_Catalog_Block_Navigation();
 $store_cats = $obj->getStoreCategories();
 $current_cat = $obj->getCurrentCategory();
 $current_cat = (is_object($current_cat) ? $current_cat->getName() : '');?>
 <?php foreach ($store_cats as $cat)
 { if ($cat->getName() == $current_cat) {
  echo '<li style="padding-left:5px;">
  <a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."
  </a>n<ul>n";
 foreach ($obj->getCurrentChildCategories() as $subcat)
{ echo '<li style="padding-left:15px;">
 <a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a>
 </li>n"; }
 echo "</ul>n</li>n"; }
else
 { echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."
 </a></li>n"; }}

?>
Share

55 thoughts on “List category and subcategory on sidebar – Magento”

  1. I realise this is off topic but while your blog looks pleasant, it would be far better if you’ll be able to use lighter colors too in the design. This will encourage a lot more scaners come to check it out more often!

  2. Im glad to have located this post as its such an interesting one! I am always on the watchout for quality posts and posts so i suppose im lucky to have found this! I hope you will be adding more in the future…

  3. I admit, I have not been on this website in a long time, however it was joy to find it again. It is such an important topic and ignored by so many, even professionals! I thank you for helping to make people more aware of these issues. Just great stuff as per usual!

  4. I have seen fantastic blogs and I have seen not so brilliant sites. This site is very informationrmative in many ways and certainloy ranks in the former category. Really appreciate the information your providing use avid scaners!

  5. I enjoyed scaning your nice website. I see you offer priceless info. stumbled into this site by chance but I’m sure glad I clicked on that link. You definitely answered all the questions I’ve been dying to answer for some time now. Will definitely come back for more of this.

  6. This is my first time i visit here. I found so many interesting stuff in your site especially its discussion. From the tons of comments on your storys, I guess I am not the only one having all the enjoyment here! keep up the good work.

  7. thanx for such a fantastic blog. Where else could someone get that kind of info written in such a perfect way? I have a presentation that I am presently working on, and I have been on the look out for such info.

  8. This website post is excellent, probably because of how well the subject was developped. I like some of the comments too though I could prefer we all stay on the suject in order add value to the subject!

  9. thanx for such a brilliant website. Where else could anyone get that kind of info written in such a perfect way? I have a presentation that I am presently working on, and I have been on the look out for such info.

  10. Your post will be rather good, and I’m sure some will find it interesting because it’s about a topic that’s as widely discussed as others. Some may even find it useful.thank so much for your post.

  11. Please keep on leaving such quality storys as this is a rare thing to find these days. I am always searching online for storys that can help me. watching forward to another great blog. Good luck to the author! all the best!

  12. I admit, I have not been on this website in a long time, however it was joy to find it again. It is such an important topic and ignored by so many, even professionals! I thanx for helping to make people more aware of these issues. Just great stuff as per usual!

  13. Hello I am so delighted I located your website, I really located you by mistake, while I was looking on yahoo for something else, Anyways I am here now and would just like to say nice one for a tremendous post and a all round entertaining site. Please do keep up the great work.

  14. Pingback: The Girl With The Dragon Tattoom FULL MOVIE
  15. Pingback: Accounting Basics
  16. Pingback: Accounting Basics
  17. Pingback: oil change coupons
  18. Pingback: Maid service
  19. Pingback: Charlotte SEO
  20. Pingback: Homepage
  21. Pingback: Get the facts
  22. Pingback: Find Out More
  23. Pingback: Full Article
  24. Pingback: Epic Traffic Bot
  25. Pingback: suchmaschkljkj
  26. Pingback: robe
  27. Pingback: friv
  28. Hi there, just became aware of your blog through Google, and
    found that it’s truly informative. I’m going to
    watch out for brussels. I’ll appreciate if you continue this in future. Many people will be benefited from your writing. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *