Firstly I am new to Magento, so please explain in detail if you can help.
I have used the following code:
<div class="left-nav-inner">
<h3 id="products">Products</h3>
<h4>Shop by:</h4>
<ul id="product-menu">
<?php
/* Get the categories that are active for the store */
$_main_categories=$this->getStoreCategories();
/* Get the current category the user is in */
$_current_category=$this->getCurrentCategory();
/* Get the current category path */
$_categorypath = $this->getCurrentCategoryPath();
?>
<?php
if ($_main_categories):
/* This bit cycles through the categories - setting the next one to current */
foreach ($_main_categories as $_main_category):
if($_main_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_main_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
/* Write the main categories */
?>
<li><a href="<?php echo $this->getCurrentCategory()->getUrl()?>"><?php echo $this->getCurrentCategory()->getName();?></a></li>
<?php
/* Check the category variable loop against the current category path if it is - print sub categories */
if (in_array($this->getCurrentCategory()->getId(), $_categorypath)): ?>
<?php $_maincategorylisting=$this->getCurrentCategory()?>
<?php $_categories=$this->getCurrentChildCategories()?>
<?php if($_categories->count()):?>
<?php /* This resets the category back to the original pages category
**** If this is not done, subsequent calls on the same page will use the last category
**** in the foreach loop
*/ ?>
<?php $layer->setCurrentCategory($_current_category); ?>
<?php endif; ?>
<?php endif; ?>
<?php
endif;
endforeach;
else:
?>
<p>$_main_categories array was empty.</p>
<p>This might be because you are referencing this phtml file with a wrong type attribute. You should use <block type="catalog/navigation" ... /> !</p>
<?php endif; ?>
</div>
This displays listings on my left menu as required however when I click the category urls the category page will not show the products..
I can get the products to show if I remove the left column within:
app/design/frontend/default/default/layout/catalog.xml
I did this with the following code:
Category default layout
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<remove name="left" />
As you can see I added the 'remove name=left'.
I need to have the left menu with the categories displaying on every page of the website and I need the products to show up when I click on the categories...
Please help.