首先我是新來的Magento,所以請詳細解釋,如果你可以提供幫助。分類列表分類頁面上 - 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>
當我點擊類別的要求卻網址分類頁面將不會顯示產品這顯示我的左側菜單中的上市..
我可以拿到產品展示,如果我刪除內左側立柱:
應用程序/設計/前端/預設/默認/佈局/的catalog.xml
我二叔d這與下面的代碼:
類別默認佈局
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<remove name="left" />
正如你可以看到我添加了 '除名=左'。
我需要與顯示網站的每個頁面上的類別左側菜單,我需要的產品展現出來,當我點擊的類別...
請幫助。
什麼顯示在目標網址上?你得到標準的頁眉/頁腳,沒有內容?你是否得到類別標題和cms塊,沒有產品列表?您是否檢查過日誌記錄是打開的,還是檢查了system.log和/或exception.log中的條目? – 2010-09-19 02:26:29
我收到除產品以外的所有東西。類別標題正確顯示,以及麪包屑等。它可以正常顯示所有產品,當我不使用左側導航。因此,類別列表代碼中的某些內容正在將其拋棄 – 2010-09-19 02:34:02