Во-первых, я новичок в Magento, поэтому, пожалуйста, объясните подробно, если вы можете помочь.
Я использовал следующий код:
<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>
Это отображает списки в моем левом меню какоднако, когда я нажимаю на URL-адрес категории, на странице категории не отображаются продукты.
Я могу получить продукты для отображения, если удалить левый столбец в:
app / design / frontend/default/default/layout/catalog.xml
Я сделал это с помощью следующего кода:
Макет по умолчанию для категории
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<remove name="left" />
Как вывидно, что я добавил «удалить имя = слева».
Мне нужно левое меню с категориями, отображаемыми на каждой странице веб-сайта, и мне нужно, чтобы продукты отображались при нажатии на категории...
Пожалуйста, помогите.