简体   繁体   English

在首页的多个页面中显示带有图像的类别-Magento

[英]Display Categories with Image in Multiple Pages of Homepage - Magento

In my Customization , i have more than 100 categories under Default Category so I want to Display all the categories in multiple pages with images Homepage - Magento. 在我的“自定义”中,“默认类别”下有100多个类别,因此我想在多个页面中使用图像首页-Magento显示所有类别。

Im Using the below code : 我正在使用以下代码:

   <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 <?=$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>      

In this code im just getting only product with images but not in proper manner (not aligned) please anyone query me how to Display all the categories in multiple pages with images Homepage . 在此代码中,我只会获取带有图片的产品,而不能以正确的方式(未对齐)获取商品,请有人问我如何在带有图片的首页中显示所有类别的图片。

To display in Multiple page you will need to use some pagination techniques , 要在“多页”中显示,您需要使用一些分页技术,

to display the product categories do refer 显示产品类别请参考

How to create Categories Grid (list) with images 如何使用图像创建类别网格(列表)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM