Magento分页产品 [英] Magento pagination products

查看:112
本文介绍了Magento分页产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Magento分页有疑问.

I have a problem with Magento pagination.

我通过XML调用的实用列表页面是:

The prudct list page i call by my XML is:

    <block type="catalog/product_list" name="categorieen" as="categorieen" translate="label" template="page/html/categorieen.phtml">
        <label>Categorieën</label>
    </block>

我的产品列表页面的代码是:

The code of my product list page is:

    <div id="products">
<?php $_productCollection=$this->getLoadedProductCollection();?>


    <?php // Grid Mode ?>

    <?php $_collectionSize = $_productCollection->count() ?>
    <?php $_columnCount = $this->getColumnCount(); ?>
    <?php $i=0; foreach ($_productCollection as $_product): ?>
         <?php

         $pic = $this->helper('catalog/image')->init($_product, 'thumbnail')->keepFrame(false)->resize(170);
         ?>
         <a href="<?php echo $this->getAddToCartUrl($_product) ?>">
         <div class="block_prod">
           <div class="block_image_prod"><img src="<?php echo $pic; ?>"></div>
           <div class="block_title_prod"><h2><?php echo strtoupper($this->htmlEscape($_product->getName())); ?></h2></div>
        </div>
        </a>
        <?php $i++; endforeach ?>


<?php 

/*
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO.'/app/Mage.php';
Mage::app();*/

/* Provide a known category id that has children as a test */
$_cat = new Mage_Catalog_Block_Navigation();
$curent_cat = $_cat->getCurrentCategory();
$curent_cat_id = $curent_cat->getId();

$id = $curent_cat_id;

/* Load category by id*/
$cat = Mage::getModel('catalog/category')->load($id);


/*Returns comma separated ids*/
$subcats = $cat->getChildren();

//Print out categories string
#print_r($subcats);

foreach(explode(',',$subcats) as $subCatid)
{
  $_category = Mage::getModel('catalog/category')->load($subCatid);
  if($_category->getIsActive() && !$_category->getIncludeInMenu())
  {
    $caturl     = $_category->getURL();
    $catname     = $_category->getName();
    if($_category->getImageUrl())
    {
      $catimg     = $_category->getImageUrl();
    }
?>
         <a href="<?php echo $caturl; ?>">
         <div class="block_prod">
           <div class="block_image_prod"><img src="<?php  echo $catimg; ?>"></div>
           <div class="block_title_prod"><h2><?php echo strtoupper($catname); ?></h2></div>
        </div>
        </a>

<?php    

    }
}?>
</div>
    <div i="toolbar-bottom">
<?php echo $this->getToolbarHtml(); ?>
    </div>

在我的产品页面上,我在工具栏上添加了

On my product page i included the toolbar with

<?php echo $this->getToolbarHtml(); ?>

但是我没有

1-2-3-4...12

我只会得到:

Show 30 per page

有解决方案吗?非常感谢你!

Is there an solution fot this? Thank you very much!

推荐答案

如果查看默认的catalog.xml,您将看到工具栏包含如下:

If you look in the default catalog.xml you will see that the toolbar is included as follows:

<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
    <block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>

您是否以类似的方式包含了它?

Have you included it in a similar way?

另一个要查看的地方是toolbar.phtml,以查看其中是否包含您需要的所有内容.

The other place to look is is toolbar.phtml to see if everything you require is included there.

这篇关于Magento分页产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆