zoukankan      html  css  js  c++  java
  • magento中对获取的数据在前台进行分页显示

    1.数据加载类
    class Bf170_Bf170Logistics_Block_Inquiry_Index extends Mage_Core_Block_Template {
        
        public function __construct(){
            parent::__construct();
            $account = new Varien_Object();
            $recordCol = new Varien_Data_Collection();//这个对象和加载数据的对象是同一个
            $customer = Mage::getSingleton( 'customer/session' )->getData('id');
             if(!!$customer){
                // 获取用户已经完款的订单
                $recordCol = Mage::getModel('sales/order_shipment_track')->getCollection();
                $orderAddressTableName = Mage::getSingleton('core/resource')->getTableName('sales/order');
                $recordCol->getSelect()->joinLeft(
                        array('order' => $orderAddressTableName),
                        "main_table.order_id = order.entity_id",
                        array(
                            'increment_id'=>'order.increment_id'
                        )
                )->where('customer_id=?',$customer);
            }
            $this->setRecordCol($recordCol);
        }
        
        protected function _prepareLayout(){
            parent::_prepareLayout();
            $pagerBlock = $this->getLayout()->createBlock('page/html_pager', 'bf170logistics.inquiry.index.pager');//这里是需要渲染的页面
            $pagerBlock->setCollection($this->getRecordCol());//这里需要把$this->setRecordCol($recordCol);拿出来
            $this->setChild('pager', $pagerBlock);
            $this->getRecordCol()->load();
            return $this;
        }

        public function getPagerHtml() {
            return $this->getChildHtml('pager');
        }
    }

  • 相关阅读:
    其实说起来要国庆节回去,心里有点担心再最后买不到票
    现在快要中秋节,之后又是国庆节
    天气开始降温,今天会下雨
    昨天晚上控制家里的电脑,与家里人视频
    有时候手机打开微信或者其它应用真的是非常慢
    手机有时候卡的不行,还是自己照顾着使用吧
    这几天晚上都是再看小别离,还是有点意思
    函数初识
    Python文件操作
    Python字符编码
  • 原文地址:https://www.cnblogs.com/sqsnbrdcwlcfzj/p/6221076.html
Copyright © 2011-2022 走看看