让寻呼机显示在 magento 列表中 [英] Getting pager to show on magento list

查看:22
本文介绍了让寻呼机显示在 magento 列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前有一个报价页面,其中列出了我们希望向寻呼机显示的所有现有报价.

We currently have a quote page which lists all existing quotes that we would like to show the pager.

我们在列表页面中有以下代码,我们已将调用添加到寻呼机,但它似乎根本没有显示前端.

We have the following code in the List page which we've added the call to the pager but it doesn't appear to be showing frontend at all.

我还添加了历史记录页面,该页面显示一个带有寻呼机的列表,作为我们尝试模拟的工作页面的示例.

I've also added the history page which displays a list with a pager as an example of a working page we are trying to emulate.

谁能指出我们正确的方向,因为我们似乎遗漏了什么

Can anyone point us in the right direction as we appear to be missing something

列表

<?php $_quotation = $this->getQuotations();?>
<?php if($_quotation->getSize()): ?>
<?php echo $this->getPagerHtml(); ?>
<table cellspacing="0" class="data-table" id="my-quotations-table">
    <thead>
        <tr>
            <th class="quote-quote"><?php echo $this->__('Quote #') ?></th>
            <th class="quote-date"><?php echo $this->__('Creation Date') ?></th>
            <th class="quote-valid"><?php echo $this->__('Valid until') ?></th>
            <th class="quote-status"><?php echo $this->__('Status') ?></th>
            <th class="quote-view-link">&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        <?php $_odd = ''; ?>
        <?php foreach ($this->getQuotations() as $_quotation): ?>
            <?php $_quotation->checkExpirationDateAndApply(); ?>
            <tr>
                <td><?php echo $_quotation->getincrement_id() ?></td>
                <td><?php echo $this->formatDate($_quotation->getcreated_time()) ?></td>
                <td><?php echo $this->formatDate($_quotation->getValidEndTime()); ?>
                <td><?php echo $this->__($_quotation->getstatus()); ?></td>
                <td class="a-center"><?php if ($_quotation->isViewableByCustomer()): ?>
                        <a href="<?php echo $this->getViewUrl($_quotation) ?>"><?php echo $this->__('View Quotation') ?></a>
                        <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<script type="text/javascript">decorateTable('my-quotations-table')</script>
<?php echo $this->getPagerHtml(); ?>
<?php else: ?>
    <p><?php echo $this->__('You have no quotes available.') ?></p>
<?php endif ?>

历史

<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php $_orders = $this->getOrders(); ?>
<div class="pager"><?php echo $this->getPagerHtml(); ?></div>
<?php if($_orders->getSize()): ?>
<table class="data-table" id="my-orders-table">
    <col width="1" />
    <col width="1" />
    <col />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <thead>
        <tr>
            <th><?php echo $this->__('Order #') ?></th>
            <th><?php echo $this->__('Date') ?></th>
            <th><?php echo $this->__('Delivery To') ?></th>
            <th><span class="nobr"><?php echo $this->__('Order Total') ?></span></th>
            <th><span class="nobr"><?php echo $this->__('Order Status') ?></span></th>
            <th>&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        <?php $_odd = ''; ?>
        <?php foreach ($_orders as $_order): ?>
        <tr>
            <td><?php echo $_order->getRealOrderId() ?></td>
            <td><span class="nobr"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></span></td>
            <td><?php echo $_order->getShippingAddress() ? $this->htmlEscape($_order->getShippingAddress()->getName()) : '&nbsp;' ?></td>
            <td><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td>
            <td><em><?php echo $_order->getStatusLabel() ?></em></td>
            <td class="a-center">
                <span class="nobr"><a href="<?php echo $this->getViewUrl($_order) ?>"><?php echo $this->__('View Order') ?></a>
                    <?php /*<span class="separator">|</span><a href="<?php echo $this->getTrackUrl($_order) ?>"><?php echo $this->__('Track Order') ?></a>&nbsp;*/ ?>
                    <?php if ($this->helper('sales/reorder')->canReorder($_order)) : ?>
                    <span class="separator">|</span> <a href="<?php echo $this->getReorderUrl($_order) ?>" class="link-reorder"><?php echo $this->__('Reorder') ?></a>
                <?php endif ?>
                </span>
            </td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<script type="text/javascript">decorateTable('my-orders-table');</script>
<?php echo $this->getPagerHtml(); ?>
<?php else: ?>
    <p><?php echo $this->__('You have placed no orders.'); ?></p>
<?php endif ?>

List 的布局块

<quotation_quote_list>
    <reference name="root">
        <action method="setTemplate"><template>page/3columns-account.phtml</template></action>
    </reference>
    <update handle="customer_account"/>
    <reference name="content">
            <block type="Quotation/Frontend_Grid" name="quotationslist" as="quotationslist" template="Quotation/List.phtml"/>
    </reference>
</quotation_quote_list>

推荐答案

我们可以通过在我们的块类中扩展 Mage_Catalog_Block_Product_List 类来实现带有 magento 分页的自定义模型集合.假设我想用分页显示用户博客文章.以下是轻松实现它的步骤:

We can implement custom model collection with magento pagination by extending Mage_Catalog_Block_Product_List class in our block class. Suppose I want to display users blog posts with pagination. Here is the steps to implement it easily:

  1. 创建一个块类 (posts.php) 并在其中添加以下代码.

  1. Create a block class (posts.php) and add the below code in it.

class Blog_User_Block_Posts extends Mage_Catalog_Block_Product_List
{
    protected function _beforeToHtml()
    {
        $toolbar = $this->getToolbarBlock();
        $collection = $this->_getPostsCollection();
        $toolbar->setCollection($collection);     /*(Add toolbar to collection)*/
        return parent::_beforeToHtml();
    }
}

  • view.phptml文件中添加如下代码

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

  • 这篇关于让寻呼机显示在 magento 列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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