Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Customising Top Level Categories in Magento PHP

  • Please log in to reply
No replies to this topic

#1 David7626


  • Members
  • 29 posts
  • Local time:06:41 AM

Posted 02 July 2015 - 10:36 PM

I'm using Magento at the moment, and I've tried to display all categories in a page. 
I've done that, but now I want to have each category display in a separate div element. 
At the moment, they're all displayed in an unordered list. 
I believe I have to change something in the PHP line of code that says "getStoreCategories", but I don't know what to replace it with.




<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php if (count($_categories) > 0): ?>
<div class="catalog-image">
<?php foreach($_categories as $_category): ?>
<?php echo $_category->getImage() ?>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>

<?php echo $_category->getDesc() ?>
<?php echo $_category->getUrlPath() ?>
<?php endforeach; ?>
<a class="button" href="<?php echo $url_path; ?>">View Products</a>
<?php endif; ?>


By the way, I got the idea for the PHP code from this address:



BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users