简体   繁体   English

产品清单上的Magento寻呼机

[英]Magento Pager on product list

How do I insert only the pager in the bottom of product list? 如何仅在产品列表底部插入寻呼机?

At the top of the product list I want: "Sort by relevance/bestselers/etc" and the "Sort item by: Table/list", this I was able to do. 在我想要的产品列表的顶部:“按相关性/畅销书/等排序”和“排序项目:表/列表”,这是我能够做到的。

At the bottom of the product list I only want the pager, I've tried to insert the following code in list.phtml 在产品列表的底部我只想要寻呼机,我试图在list.phtml中插入以下代码

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

but this php code doesn't work directly on the product list. 但这个PHP代码不能直接在产品列表上工作。

How can I make the pager work on the product list and appear at the bottom? 如何使寻呼机在产品列表上工作并显示在底部?

Hello you create new toolbar-bottom.phtml file with following code ie app/design/frontend/(base or default)/(default or yourtheme)/template/catalog/product/list/toolbar-bottom.phtml 你好你用以下代码创建新的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 ?>

call into bottom of line in app/design/frontend/(base or default)/(default or yourtheme)/template/catalog/product/list.phtml 调用app / design / frontend /(base或default)/(默认或yourtheme)中的行底部/template/catalog/product/list.phtml

getToolbarBlock()->setTemplate('catalog/product/list/toolbar-bottom.phtml')->toHtml(); getToolbarBlock() - > setTemplate( '目录/产品/列表/工具栏-bottom.phtml') - > toHtml();

You can do this one of two ways. 你可以用两种方法之一做到这一点。

1) Using CSS 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>

In css 在css

 .bottom-toolbar .xyz{
    display:none;
 }

2) Using a Custom module to overwrite getToolbarHtml and 2)使用自定义模块覆盖getToolbarHtml

$this->getToolbarHtml('top-toolbar');

$this->getToolbarHtml('bottom-toolbar');


public function getToolbarHtml($toolbar_position)
{   
    $this->toolbar_position = $toolbar_position;
    return $this->getChildHtml('toolbar');
}

Then try to pass $this->toolbar_position to each block to show the section you need 然后尝试将$this->toolbar_position传递给每个块以显示您需要的部分

I think this is what you want. 我想这就是你想要的。

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

font: http://mayankpatel104.blogspot.com.br/2012/07/magento-pagination-without-toolbar.html 字体: http//mayankpatel104.blogspot.com.br/2012/07/magento-pagination-without-toolbar.html

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

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