2012-05-02 5 views
0

Magentoページネーションに問題があります。マゼンタページネーション製品

私は私のXMLで呼び出すprudct一覧ページには次のとおりです。

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

私の製品一覧ページのコードは次のとおりです。私は

とツールバーを含め、私の製品ページで
<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> 

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

しかし、私はページ分割のようにはありません

1-2-3-4...12 

私は取得のみ:

Show 30 per page 

このFOT解決策はありますか?どうもありがとうございました!

答えて

0

デフォルトcatalog.xmlに見える場合は、次のようにツールバーが含まれていることがわかります。

<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> 

あなたは同様の方法でそれを含めることがありますか?

他の場所は、必要なものがすべて含まれているかどうかを確認するためにtoolbar.phtmlです。

+0

のための役に立つかもしれねえアレックスは、私はこれを試してみましたが、何もこの方法で表示されません。ツールバーは動作しますが、ページャーは表示されません。コードtoolbar.phtmlで、私はこのコードを見つける:<?php echo $ this-> getPagerHtml()?>。しかしそれは空です。 – JelleP

+0

toolbar.phtmlを投稿できますか? –

+0

また、私はあなたには、明らかにそれを表示しないと思われるアイテムを複数のページに分けていると思いますか? –

0

カテゴリに46の製品があり、一部の製品は非表示です。ツールバーのコード:

<?php 
/** 
* Magento 
* 
* NOTICE OF LICENSE 
* 
* This source file is subject to the Academic Free License (AFL 3.0) 
* that is bundled with this package in the file LICENSE_AFL.txt. 
* It is also available through the world-wide-web at this URL: 
* http://opensource.org/licenses/afl-3.0.php 
* If you did not receive a copy of the license and are unable to 
* obtain it through the world-wide-web, please send an email 
* to [email protected] so we can send you a copy immediately. 
* 
* DISCLAIMER 
* 
* Do not edit or add to this file if you wish to upgrade Magento to newer 
* versions in the future. If you wish to customize Magento for your 
* needs please refer to http://www.magentocommerce.com for more information. 
* 
* @category design 
* @package  base_default 
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) 
* @license  http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 
*/ 
?> 
<?php 
/** 
* Product list toolbar 
* 
* @see Mage_Catalog_Block_Product_List_Toolbar 
*/ 
?> 
<?php if($this->getCollection()->getSize()): ?> 
<div class="toolbar"> 
    <div class="pager"> 
     <p class="amount"> 
      <?php if($this->getLastPageNum()>1): ?> 
       <?php echo $this->__('Items %s to %s of %s total', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?> 
      <?php else: ?> 
       <strong><?php echo $this->__('%s Item(s)', $this->getTotalNum()) ?></strong> 
      <?php endif; ?> 
     </p> 

     <div class="limiter"> 
      <label><?php echo $this->__('Show') ?></label> 
      <select onchange="setLocation(this.value)"> 
      <?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?> 
       <option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>> 
        <?php echo $_limit ?> 
       </option> 
      <?php endforeach; ?> 
      </select> <?php echo $this->__('per page') ?> 
     </div> 

     <?php echo $this->getPagerHtml() ?> 

    </div> 

    <?php if($this->isExpanded()): ?> 
    <div class="sorter"> 
     <?php if($this->isEnabledViewSwitcher()): ?> 
     <p class="view-mode"> 
      <?php $_modes = $this->getModes(); ?> 
      <?php if($_modes && count($_modes)>1): ?> 
      <label><?php echo $this->__('View as') ?>:</label> 
      <?php foreach ($this->getModes() as $_code=>$_label): ?> 
       <?php if($this->isModeActive($_code)): ?> 
        <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp; 
       <?php else: ?> 
        <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp; 
       <?php endif; ?> 
      <?php endforeach; ?> 
      <?php endif; ?> 
     </p> 
     <?php endif; ?> 

     <div class="sort-by"> 
      <label><?php echo $this->__('Sort By') ?></label> 
      <select onchange="setLocation(this.value)"> 
      <?php foreach($this->getAvailableOrders() as $_key=>$_order): ?> 
       <option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>> 
        <?php echo $this->__($_order) ?> 
       </option> 
      <?php endforeach; ?> 
      </select> 
      <?php if($this->getCurrentDirection() == 'desc'): ?> 
       <a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a> 
      <?php else: ?> 
       <a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a> 
      <?php endif; ?> 
     </div> 
    </div> 
    <?php endif; ?> 
</div> 
<?php endif ?> 
1

これは、いくつかのいずれか

<?php $toolbar = $this->getToolbarBlock()->setCollection($_productCollection); 
$pager = Mage::getBlockSingleton('page/html_pager')->setLimit($toolbar->getLimit())->setCollection($_productCollection); 
if ($toolbar->getCollection()->getSize() > 0):?> 
<?php if (!$pager->isFirstPage()): ?> 
    <a class="prev-page" href="<?php echo $pager->getPreviousPageUrl() ?>" title="<?php echo $this->__('Previous') ?>">Previous</a> 
<?php else: ?> 
    <span class="prev-page disabled">&nbsp;PreviousDisable</span> 
<?php endif; ?> 

<span class="current-page-detail"> 
    Page <?php echo $pager->getCurrentPage(); ?> of <?php echo $pager->getLastPageNum(); ?> 
</span> 

<?php if (!$pager->isLastPage()): ?> 
    <a class="next-page" href="<?php echo $pager->getNextPageUrl() ?>" title="<?php echo $this->__('Next') ?>">&nbsp;Next</a> 
<?php else: ?> 
    <span class="next-page disabled">&nbsp;NextDisable</span> 
<?php endif; ?>