0

我正在为我的网站使用“静态块和产品”的类别显示模式。它可以很好地显示我的静态块,但是它只显示我最后一个子类别的产品,而不是所有产品。我已经仔细检查了我所有的“锚”选项,并尝试返回到原始的 category/view.phtml 认为我可能已经覆盖了一些无济于事的东西。我愿意接受任何建议...

这是我从第三方使用的静态块代码:

<div class="category-products">
<ul class="products-grid">
<?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
if ($categorycount == 0){
$class = "first";
}
elseif ($categorycount == 3){
$class = "last";
}
else{
$class = "";
}
?>
<li class="item <?php echo $class?>">
<a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
<img src="<?php echo $_category->getImageUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
</a>
<h2>
<a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
<?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
</li>
<?php
endif;
if($categorycount == 3){
$categorycount = 0;
echo "</ul>\n\n<ul class=\"products-grid\">";
}
else{
$categorycount++;
}
endforeach;
endif;
?>
</ul>
</div>
4

2 回答 2

0

我同意戴夫。我有同样的问题。只需注释掉这些行:

$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
于 2015-01-13T06:18:20.943 回答
0

我能够弄清楚。这部分出现错误:

$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);

我只是将这两行注释掉了,现在可以正常工作了。

于 2013-10-24T13:02:12.950 回答