Thursday, December 2

Display Subcategory Listing in Parent Caategories

1. In cms select Static Pages
a. Set the Block Identifyer to for example “Sub Category Listing”
b. Set the Identifyer to “subcategory_listing”
c. In the content section add “{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}"

2. Now take this code and create a new file called for example “subcategory_listing.phtml” this file needs to live in the “catalog/navigation” directory


<?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">
                      <
h6><a href="<?php echo $_category->getURL() ?>"

  title="<?php echo $this->htmlEscape($_category->getName()) ?>"> 
<?php echo $this->htmlEscape($_category->getName()) ?></a></h6>
                        </
div>
                        <
div class="product-image">
                            <
a href="<?php echo $_category->getURL() ?>" 

 title="<?php echo $this->htmlEscape($_category->getName()) ?>">
                                <
img src="<?php echo $_category->getImageUrl() ?>"

 width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
                            </
a>
                                
<?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>



3. Now Goto Manage Categories. 
a. Pick a Sub Category Entry 
b. Set the display mode to “Static Block Only” 
c. From the CMS Block dropdown select the Static Page “Sub Category Listing” 
d. Set the is anchor to no

i have just set a site live you can see this in action http://www.shrinova.com

No comments:

Post a Comment