[英]Magento Pager on product list
如何僅在產品列表底部插入尋呼機?
在我想要的產品列表的頂部:“按相關性/暢銷書/等排序”和“排序項目:表/列表”,這是我能夠做到的。
在產品列表的底部我只想要尋呼機,我試圖在list.phtml中插入以下代碼
<?php echo $this->getPagerHtml() ?>
但這個PHP代碼不能直接在產品列表上工作。
如何使尋呼機在產品列表上工作並顯示在底部?
你好你用以下代碼創建新的toolbar-bottom.phtml文件,即app / design / frontend /(base或default)/(default或yourtheme)/template/catalog/product/list/toolbar-bottom.phtml
<?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>
</div>
<?php endif ?>
調用app / design / frontend /(base或default)/(默認或yourtheme)中的行底部/template/catalog/product/list.phtml
getToolbarBlock() - > setTemplate( '目錄/產品/列表/工具欄-bottom.phtml') - > toHtml();
你可以用兩種方法之一做到這一點。
1)使用CSS
<div class="category-products">
<div class='top-toolbar'><?php echo $this->getToolbarHtml() ?></div>
...
<div class='bottom-toolbar'><?php echo $this->getToolbarHtml() ?></div>
</div>
在css
.bottom-toolbar .xyz{
display:none;
}
2)使用自定義模塊覆蓋getToolbarHtml
和
$this->getToolbarHtml('top-toolbar');
$this->getToolbarHtml('bottom-toolbar');
public function getToolbarHtml($toolbar_position)
{
$this->toolbar_position = $toolbar_position;
return $this->getChildHtml('toolbar');
}
然后嘗試將$this->toolbar_position
傳遞給每個塊以顯示您需要的部分
我想這就是你想要的。
$toolbar = $this->getToolbarBlock();
$toolbar->setCollection($_productCollection);
if($toolbar->getCollection()->getSize() > 0):
echo $toolbar->getPagerHtml(); //Pager
echo $toolbar-> __('Items %s to %s of %s total', $toolbar->getFirstNum(), $toolbar->getLastNum(),
$toolbar ->getTotalNum());
endif;
字體: http : //mayankpatel104.blogspot.com.br/2012/07/magento-pagination-without-toolbar.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.