After struggling for several days without much to go on or available help for the issues I was
having, I have gotten the results I wanted. I will not take credit for any of the code used;
however, what I am using is a combination of several sources. Here’s a step-by-step of what is
needed in order to properly display your subcategories in a grid view when you select a main
Step One: Create a Static Block
Login to your Magento Admin. Go to CMS -> Static Blocks. You will then select “Add New Block”
In your new block you will need to fill out a few different field of information:
Block Title: Subcategory Listing
Content: Use the below code
Now save your static block. What you’ve just done is create a static block that will display the
subcategories when you go to the category view.
Step Two: Create a new file for your code
At this point you will need to create a new .phtml file so that we can create the file your static
block will access. You can create your .phtml file using many mediums but I prefer to use
Notepad++. Not only is it easy to use but is very useful since it’s designed to be used when
Open a new file. You will want to paste the following code into your new file.
$layer = Mage::getSingleton('catalog/layer');
$_category = $layer->getCurrentCategory();
$_categories = $_category->getCollection()
<?php foreach ($_categories as $_category): ?>
<img src="<?php echo $this->htmlEscape($_category->getImageUrl()) ?>" alt="<?php echo
$this->htmlEscape($_category->getName()) ?>" />
<a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName())
<?php endif; ?>
<?php endforeach; ?>
Now you will want to save your new file as subcategory_listing.phtml.
Step Three: Upload subcategory_listing.phtml
You will want to upload subcategory_listing.phtml to the following directory. By placing it
here, your static block from step one will be able to access the code that is in the file and
display the information we want.
Step Four: Setting up your Category
Login to your Magento Admin. Go to Catalog -> Manage Categories. Select one of your main
categories you have created. You will want to upload an image for the “Thumbnail Image” and the
Make note of the image size you are uploading as this will affect the changes we will need to
make to the .css files. For my site, I am using Photoshop to edit my image files, creating them
with a image size of 150px by 125px.
Still in your category, select the “Display Settings” tab and use the following settings.
Display Mode: Static block only
CMS Block: Subcategory Listing
Is Anchor: No
After making these changes do not forget to click save category.
I will be posting the last step below.