Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

List subcategories on category page
 
Besiktas
Jr. Member
 
Total Posts:  17
Joined:  2009-08-03
 

i don’t know what i can do anymore to make this working. Ive been trying for three days know. That’s why i am sending this as a new topic. what i want is that when i click on a category that i see a block with subcategories (not products) in gridview, horizontal 4 columns. after clicking a subcategory then products.

Can you please take a little look at my code?

i made a static block: “subcategory listing” with identifier “subcategory_listing” with content
“{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}"

i made a file named “subcategory_listing.phtml” in the map appdesignfrontenddefaultgrayscaletemplatecatalognavigation

with the following code:

<?php $_categories=$this->getCurrentChildCategories(); ?>

<div class="listing-type-list catalog-listing">
<?php foreach ($_categories as $_category): ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if($_category->getIsActive()): ?>
<tr>
<td width="30%">
<div class="listing-item">
<div class="cat-box-text">
<a href="<?php echo $_category-<getURL() ?<" title="<?php echo $this-<htmlEscape($_category-<getName()) ?<"><?php echo $this->htmlEscape($_category->getName()) ?></a>

</div>
<div class="product-image">
<a href="<?php echo $_category-<getURL() ?<" title="<?php echo $this-<htmlEscape($_category-<getName()) ?<">
[img]<?php echo $_category-<getImageUrl() ?< width="100" alt="<?php echo $this-<htmlEscape($_category-<getName()) ?<" />
</a[/img]
<?php /* echo "Find this item->" */ ?>
</div>
</div>

</td>
<td width="40%">
<div class="listing-item">
<div class="cat-box-text">
<?php echo $_category->getDescription() ?>
</div>
</div>
</td>
<?php endif; ?>
</tr>
</table>
<?php endforeach; ?>
</div>

and when i clear the cache i see the following (see attachment foto1). What do i wrong? how can i realise this? i also tried to add ->addAttributeToSelect(’image’) in navigation.php..

My navigation.php getCurrentChildCategories() is this:

public function getCurrentChildCategories()
{
$layer = Mage::getSingleton(’catalog/layer’);
$category = $layer->getCurrentCategory();
/* @var $category Mage_Catalog_Model_Category */
$categories = $category->getChildrenCategories();
$productCollection = Mage::getResourceModel(’catalog/product_collection’);
$layer->prepareProductCollection($productCollection);
$productCollection->addCountToCategories($categories);
return $categories;
}

i dont know what i am doing wrong. can you help me with this? what should i do/try?

Thanks in advance!!

Image Attachments
foto1.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
Besiktas
Jr. Member
 
Total Posts:  17
Joined:  2009-08-03
 

Hi,

no one any suggestions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
handoyo
Jr. Member
 
Total Posts:  6
Joined:  2009-09-05
 

Hi there,take a look here display as grid,which is posted by LeidiBird..Good luck

Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top