0
votes

I am using the category Display Mode of "static block and products" for my site. It displays my static block just fine, however it only displays my last sub-category's products, not all of the products. I've double checked all of my "anchor" options and tried returning to the original category/view.phtml thinking that I might have overwritten something to no avail. I'm open to any suggestions...

Here is the static block code that I am using from a third party:

<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>
2
Show us your code. We can't help you unless we know what you're doing wrong.\ApproachingDarknessFish
Above is the 3rd party code I'm using. The catalog/view.phtml page I have reverted back to the default Magento page and it still doesn't work.Dave1064

2 Answers

0
votes

I was able to figure it out. An error was caused on this part:

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

I simply commented out those two lines and it works fine now.

0
votes

I agree with Dave. I had the same problem. Just comment out these lines:

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