0

I'm trying to show the categories on the left side in the 3-column-layout, but it doesn't really work. Am I required to edit the catalog.xml, or does changing to 3-column-layout already do everything? If it should, it doesn't work on my shop.

I've already cleaned the cache and tried reinstalling it. I'm working on a fresh install right now.

This is how it looks:

enter image description here

I have already tried the extension which exists for this purpose, but it isn't bug-free, so I would like to do it myself.

I am very thankful for any suggestions.

1
  • can you update your code to display category in left end side?
    – Keyul Shah
    Commented Sep 19, 2014 at 2:25

1 Answer 1

2

create local.xml app/desgin/frontend/rwd/default/layout/

<?xml version="1.0"?>

<layout version="0.1.0">

<!--
Default layout, loads most of the pages
-->

    <default>

        <!-- Mage_Catalog -->
        <reference name="left">

        <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/myleft.phtml">
    <reference name="left">
</default>
</layout>

and then create a file myleft.phtml at app/desgin/frontend/rwd/default/template/catalog/navigation/

<?php $_categories = Mage::helper('category')->getStoreCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="block block-layered-nav block-layered-nav--no-filters">
    <div class="block-title">
        <strong><span><?php echo $this->__('Browse By') ?></span></strong>
    </div>
    <div class="block-content toggle-content open">
        <p class="block-subtitle block-subtitle--filter"><?php echo $this->__('Filter') ?></p>
        <dl id="narrow-by-list2">
            <dt><?php echo $this->__('Category') ?></dt>
            <dd>
                <ol>
                <?php foreach ($_categories as $_category): ?>
                    <?php if($_category->getIsActive()): ?>
                    <li>
                        <a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>>
                            <?php echo $this->escapeHtml($_category->getName()) ?>
                            <span class="count">(<?php echo $_category->getProductCount() ?>)</span>
                        </a>
                    </li>
                    <?php endif; ?>
                <?php endforeach ?>
                </ol>
            </dd>
        </dl>
        <script type="text/javascript">decorateDataList('narrow-by-list2')</script>
    </div>
</div>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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