0

Thanks for looking! I've been playing around with this for a while with no luck getting a working instance... although I have VERY limited experience with .php so this might be a simple answer!

THE PROBLEM: I would like to utilize Magento's left nav to display items that are nested one level deeper than the root level. For example, my root level is 'AV Production', 'Sales & Expendables', 'About Us', 'Contact Us'... these categories do not need to be displayed on the 'AV Production' page, I would just like to see the sub-categories of 'AV Production' displayed ('Audio', 'Monitors', 'Video', 'Lighting'...). If that isn't possible, I'd like to just suppress displaying 'About Us' and 'Contact Us' in the left nav.

WHAT I'VE TRIED: I tried changing the script we have (we use a plug for an AJAX left menu) to modify the starting point for where it looks for the categories [$rootcatId = $store->getRootCategoryId();] but couldn't find anything that seemed to make a difference to the starting point. Ideally, I want to tell Magento to look one level down from the root and only display that in the nav.... I understand that might not be do-able though, especially since we have multiple store views.

Second thing I tried was suppressing the display of unwanted categories in the left nav, again, my .php skills are non existent and so it's probably all kinds of wrong. Anyway, please see below for the original script (A) and my futile attempt at a modified script (B). Even small pointers to get me on the right track would be appreciated. Thanks!

ORIGINAL (A):

<?php
ob_start();
$store = Mage::app()->getStore();
$block_title = $this->getBlockTitle();
if(Mage::getStoreConfig('categorylist_section/general/enable',$store)) {
    if ( empty($block_title) ) $block_title = 'Categories';
    ?>
    <div class="block block-left-nav" data-ajax-url="<?php echo $this->getUrl('leftmenu/ajax/load')?>">
        <div class="block-title">
            <strong><span><?php echo $this->__($block_title) ?></span></strong>
        </div>
        <div class="block-content">
            <?php
            $rootcatId = $store->getRootCategoryId();
            $categories = Mage::getModel('catalog/category')->getCategories($rootcatId);
            echo $this->getCategories($categories); ?>
        </div>
    </div>
    <style>
        <?php echo Mage::getStoreConfig('categorylist_section/design/css', $store)?>
    </style>
<?php } ?>

MODIFIED (B):

<?php
ob_start();
$store = Mage::app()->getStore();
$block_title = $this->getBlockTitle();
if(Mage::getStoreConfig('categorylist_section/general/enable',$store)) {
    if ( empty($block_title) ) $block_title = 'Categories';
    ?>
    <div class="block block-left-nav" data-ajax-url="<?php echo $this->getUrl('leftmenu/ajax/load')?>">
        <div class="block-title">
            <strong><span><?php echo $this->__($block_title) ?></span></strong>
        </div>
        <div class="block-content">
            <?php
            $rootcatId = $store->getRootCategoryId();
            $categories = Mage::getModel('catalog/category')->getCategories($rootcatId);?>
            <?php foreach ($this->getCategories() as $categories): ?>
            <?php if (!in_array($categories->getId(), array(91,92,98))) : ?> 
            <?php echo $this->drawItem2($categories) ?>
            <?php endif; ?>
            <?php endforeach ?>
        </div>
    </div>
    <style>
        <?php echo Mage::getStoreConfig('categorylist_section/design/css', $store)?>
    </style>
<?php } ?>

Your Answer

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

Browse other questions tagged or ask your own question.