0

i want to create category wise landing page in magento. i tried to create same with static block but nothing changing in my page. i already followed this url http://www.demacmedia.com/magento-commerce/mini-tutorial-how-to-add-a-category-landing-page/.

let's assume that i have categories like below

  • Mens
    • Clothes
    • Aviator

when i click on Mens i want to open landing page for this category. so how can i do this.

1

app/design/frontend/default/your_theme/template/catalog/category. This will be the template file for our landing page. i hope this will work for you

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

<div class="subcategory-grid">
<?php $i=0; foreach ($_categories as $_category): ?>

<?php
$layer = Mage::getSingleton('catalog/layer');
    $layer->setCurrentCategory(Mage::getModel('catalog/category')->load($_category->getId()));
$helper = Mage::helper('catalog/category');
?>
<div class="category-container<?php if($i % 3 == 0){ echo ' first'; }     if($i >= 3){ echo ' additional-rows'; }?>">
    <?php $_img = $this->getCurrentCategory()->getImageUrl() ?>
    <?php if($_img): ?>
        <div class="category-img">
            <a href="<?php echo $helper->getCategoryUrl($_category);?>">
                <img src="<?php echo $_img?>" title="<?php echo $_category->getName() ?>"/>
            </a>
        </div>
    <?php endif; ?>
    <div class="category-name<?php if (strlen($_category->getName()) > 32) echo ' small-category-name' ?>">
        <a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
        <?php echo $this->htmlEscape($_category->getName()) ?>
        </a>
    </div>
</div>
<?php
$i++;
endforeach;
?>
</div>
  • thanks, but how to call this file from static block.this is what i done i created one static block and puted this code {{block type="catalog/navigation" template="catalog/category/category_listing.phtml"}}. and in manage categories i set display mode static block only and select this static block. but it nothing rendering it displaying blank. – Nikunj Beladiya Apr 26 '16 at 8:05
  • try this {{block type="catalog/navigation" name="catalog.categories" template="catalog/navigation/category_listing.phtml"}} then Go to the menu Catalog/Manage Categories,Select the categorie that you want, and in the tab“DISPLAY SETTINGS we set the following information:DISPLAY MODE: STATIC BLOCK CMS Block: Category Listing (the block that you create before) Is Anchor: NO – Tush Apr 26 '16 at 8:52
  • thanks Swati for replay, i changed according to your new answer but still it is not rendering. – Nikunj Beladiya Apr 26 '16 at 10:01
0

Below code will give you all categories & on click them you will goto their landing page.

     <?php $_categories = Mage::helper('catalog/category')->getStoreCategories() ?>
     <?php if (count($_categories) > 0): ?>
<ul>
    <?php foreach($_categories as $_category): ?>
        <li>
            <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
                <?php echo $_category->getName() ?>
            </a>
            <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
            <?php $_subcategories = $_category->getChildrenCategories() ?>
            <?php if (count($_subcategories) > 0): ?>
                <ul>
                    <?php foreach($_subcategories as $_subcategory): ?>
                        <li>
                            <a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
                                <?php echo $_subcategory->getName() ?>
                            </a>
                        </li>
                    <?php endforeach; ?>
                </ul>
            <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
  • but it displaying nothing it give just blank space. – Nikunj Beladiya Apr 26 '16 at 10:03
0

Go to your admin panel, Catalog, Manage Categories and select your category.

Then on the tab Display Settings, chose your preferred display setting.

Chosing static block allowes you to add a block with your desired content (landing page).

You can also just add a description in General Information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.