簡體   English   中英

如何將無限滾動應用於此Costom分頁

[英]how to apply infinte scroll to this costom pagination page

我正在使用此頁面列出頁面上的所有用戶。 我正在使用自定義分頁列出它,現在我必須使用ajax或jquery進行無限滾動顯示。 googled / stackoverflowed許多解決方案似乎對此頁面中的自定義分頁無效

$paging_Obj = new Pagination();

$perPagerecord = 6;
$page = $this->getRequest()->getParam('page');

if($page){
    $start = ($page - 1) * $perPagerecord;
}else{
    $start = 0;
}



if($page == 0){
    $page = 1;
}
$prev = $page - 1;
$next = $page + 1;
$limitCond = "LIMIT $start, $perPagerecord";

$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');

//echo $artistTotalQuery = "SELECT * FROM marketplace_userdata WHERE mageuserid IN (SELECT userid FROM marketplace_product GROUP BY userid) AND partnerstatus = 'Seller' AND wantpartner = '1' ORDER BY autoid ASC";die;
$artistTotalQuery = "SELECT mu.*,cev.value as first_name,cev1.value as last_name FROM marketplace_userdata as mu LEFT JOIN customer_entity_varchar AS cev ON (cev.entity_id = mu.mageuserid) AND (cev.attribute_id = '5') LEFT JOIN customer_entity_varchar AS cev1 ON (cev1.entity_id = mu.mageuserid) AND (cev1.attribute_id = '7') WHERE mu.mageuserid IN (SELECT userid FROM marketplace_product GROUP BY userid) AND mu.partnerstatus = 'Seller' AND mu.wantpartner = '1'  
GROUP BY cev.entity_id  ORDER BY cev1.value ASC";
$sellerlist_total = $readConnection->fetchAll($artistTotalQuery);
$count = count($sellerlist_total);

$artistQuery = "SELECT mu.*,cev.value as first_name,cev1.value as last_name FROM marketplace_userdata as mu LEFT JOIN customer_entity_varchar AS cev ON (cev.entity_id = mu.mageuserid) AND (cev.attribute_id = '5') LEFT JOIN customer_entity_varchar AS cev1 ON (cev1.entity_id = mu.mageuserid) AND (cev1.attribute_id = '7') WHERE mu.mageuserid IN (SELECT userid FROM marketplace_product GROUP BY userid) AND mu.partnerstatus = 'Seller' AND mu.wantpartner = '1' GROUP BY cev.entity_id  ORDER BY cev1.value ASC $limitCond";
$sellerlist = $readConnection->fetchAll($artistQuery);

if($count>0){
?>
<?php 
$categories = Mage::getModel('catalog/category')->getCollection()->addAttributeToSelect('*')->addIsActiveFilter();
    $allcatid = array();
    $k=0;
    foreach ($categories as $c) {
       $allcatid[$k] = $c->getId();
       $k++;
    }
    $finalcat=array_shift($allcatid);
?>

<div class="div_Row">

    <?php
        $pagination = "";
        $nextDisplayPagesLimit = 3;
        $callPaging = $paging_Obj->Pagination($pagination,$count,$nextDisplayPagesLimit,$perPagerecord,$page,$next,$prev,$redirectUrl);
        echo $callPaging;
    ?>

    </div>
    </div>
</div>
<div class="div_Row">
<?php 
    $m = 1;

    foreach($sellerlist as $seller){

                    $customerid=$seller['mageuserid'];
                    $customer=Mage::getModel('customer/customer')->load($customerid);


                    /*********User Total Products and get last add product image Start************/


                        $query = "SELECT count(*) as total, max(mageproductid) as lastProduct_id FROM marketplace_product WHERE userid = $customerid";
                        $Product_result = $readConnection->fetchAll($query);

                        $totalProducts = $Product_result[0]['total'];

                        if(isset($totalProducts) && $totalProducts > 0){
                            $product_id = $Product_result[0]['lastProduct_id'];
                            $productDetails = Mage::getModel('catalog/product')->load($product_id);


                    $height = $this->helper('catalog/image')->init($productDetails, 'small_image')->getOriginalHeight();
                    $width = $this->helper('catalog/image')->init($productDetails, 'small_image')->getOriginalWidth();


                            $Product_image = $this->helper('catalog/image')->init($productDetails, 'small_image');
                        }else{
                            $Product_image = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).$APHolder;


                    //$profileURLArtist = Mage::getUrl()."marketplace/seller/profile/".$seller['profileurl']."/list";
                    $profileURLArtist = Mage::getUrl()."artist/".$seller['profileurl'];
                ?>
                    <div class="Artist_list_box span4">
                           <div class="Artist_main_img">
                               <a class="product-image-listing" href="<?php echo  $profileURLArtist; ?>">
                                  <img alt="<?php echo $customer_name; ?>" title="" src="<?php echo $Product_image;?>" style="width:<?php echo $widthRe."px";?>;max-width:<?php echo $widthRe."px";?>;margin-top:<?php echo $imageHeightDiff."px";?>; margin-left:<?php echo $imageWidthDiff."px";?>;">
                              </a>
                          </div>

                          <div class="List_inner_box">
                          <!-- <div class="List_them_bg">


                           </div>-->
                           <div class="List_inner_text">
                                <div class="list_Name_title">
                                    <a href="<?php echo  $profileURLArtist; ?>"><?php echo $customer_name; ?></a> 
                                    <?php if($city!='' && $country!=''){?>
                                        <span> <?php echo $city.", ".$country;?></span>
                                    <?php }?>
                                    <div class="pieces"><p style="margin-bottom:0;"><?php echo $totalProducts?> Artworks</p></div>
                                </div>

                                <div class="List_them">
                                    <a href="<?php echo  $profileURLArtist; ?>">
                                        <img style="height:50px;width:50px;" alt="<?php echo $customer_name; ?>" src="<?php echo $logo;?>">
                                    </a>

                               </div>


                                <div class="list_text"><?php //echo $customer_desc;?></div>
                           </div>
                         </div>
                   </div>

                    <?php if($m % 4 == 0){?>
                        <div style="clear:both"></div>
                    <?php } $m++;?>

            <?php
    }       ?>
    </div>
    <div class="div_Row">
    <div class="pager">
    <?php
        $pagination = "";
        $nextDisplayPagesLimit = 3;
        $callPaging = $paging_Obj->Pagination($pagination,$count,$nextDisplayPagesLimit,$perPagerecord,$page,$next,$prev,$redirectUrl);
        echo $callPaging;
    ?>

    </div>
</div>
    <?php

您是否嘗試過Paul Irishs jquery插件?

https://github.com/paulirish/infinite-scroll

應該管用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM