pagenation bug found

Discussion in 'General Support' started by skyhigh, Jul 31, 2018.

  1. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    i just found i dont have a number next or prev showing omy browse page it didnt occur to me until last nite, plz is there a fix for this been searching the site didnt see none
     
  2. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    No pagenation on browse. Php except wen i select category it shows up
     
  3. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    I don't have enough items on my site to use pagenation. How many items do you have? Are you seeing any errors reported? Check your visitor log too and see if any errors show there. Check also the url addresses when you change to a different page. Let us know what you see.
     
  4. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    change d page break in yr admin settings from 10 to 2 or so to see wat am taking about
     
  5. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    I'm totally lost with what you are talking about. I'm in my admin settings and don't see a d break page or any kind of break page. Can you be specific with what page I am looking for please?
     
  6. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    go to settings click display change page break to 2 n check ur browse page if u have more than 2 items next n prev should appear
     
  7. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    I'm still confused. Are we in the the admin panel or the user's panel? I don't know where this is: " display change page break "
     
  8. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    If I change my Display Settings from 12 to 2 it shows 2 items on the home page as it's supposed to. Page nation won't display on the home page. Are you talking about a search or something?
     
  9. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    yh browse page
     
  10. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
  11. nay27uk

    nay27uk Super Moderator Staff Member

    Joined:
    Nov 24, 2009
    Messages:
    5,572
    Likes Received:
    547
    Prev and Next will only show when there are more than 1 page of items
     
  12. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    What do you get shown as pagination? Is it just all empty?
     
  13. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    d browse page is working now but d admin page is having issue still pagenation problem if u search for a name and u have like multiple people with same name

    let say page view is 3 per page
    u search a name and it returns more than 3 names
    the first 3 names shows but wen u click on next to show d other list u either get a blank list or
    it will show d whole database list
    Instead of d name u search
    hope u understand

    chk d admin n try it for ur self
     
  14. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    I am starting to understand your language. I was looking for a f'n d page. I didn't know d store for the until you wrote all that there. NIU. This is what you do. GTDPACCSIW.
     
    SteveM and nay27uk like this.
  15. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    i dont understand wat u just wrote
     
  16. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
  17. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    Can you take a snapshot of the page and show us something? What is the php page name that you are talking about?
     
  18. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    ok this is the tpl code i rewrote this found in yourauction
    PHP:
    <!-- INCLUDE user_menu_header.tpl -->

    <
    script type="text/javascript">
    $(
    document).ready(function() {
       $(
    "#closeall").click(function() {
         var 
    checked_status this.checked;
         $(
    "input[name='closenow[]']").each(function() {
           
    this.checked checked_status;
         });
       });
       $(
    "#deleteall").click(function() {
         var 
    checked_status this.checked;
         $(
    "input[name='O_delete[]']").each(function() {
           
    this.checked checked_status;
         });
       });
       $(
    "#processdel").submit(function() {
         if (
    confirm('{L_30_0087}'))
         {
           return 
    true;
         }
         else
         {
           return 
    false;
         }
       });
    });
    </
    script>

    <!-- IF 
    USER_MESSAGE ne '' -->
    <
    div class="success-box">{USER_MESSAGE}</div>
    <!-- ENDIF -->

    <
    form name="search" action="{SITEURL}yourauctions.php" id="myformlist" method="post">
                   <
    input type="hidden" name="csrftoken" value="{_CSRFTOKEN}">
                     
    dsdd <table width="43%" cellpadding="3" cellspacing="3">
      <
    tr>
      <
    td width="74%"><div align="left"><input class="form-control" type="text" name="keyword" size="45">
      </
    div></td>
      <
    td width="26%"><div align="right"><input class="btn btn-primary" type="submit" name="submit" value="{L_5023}"></div></td>
      </
    tr>
    </
    table>
     <
    br><br>
                   
      </
    form>

    <
    form name="auctions" method="post" action="" id="processdel">
       <
    input type="hidden" name="csrftoken" value="{_CSRFTOKEN}">
       <
    ul class="nav nav-tabs nav-justified">
         <
    li role="presentation" class="active"><a href="yourauctions.php">{L_619}</a></li>
         <
    li role="presentation"><a href="yourauctions_s.php">Moderated / {L_2__0056}</a></li>
       </
    ul>
       <
    table class="table table-bordered table-condensed table-striped">
         <
    tr>
          <
    td width="12%"><div align="left">image</div></td>
           <
    td width="17%"><div align="left">Artist</div></td>
           <
    td width="21%">
             <
    div align="left"><a href="yourauctions.php?oa_ord=title&oa_type={ORDERNEXT}">{L_624}</a>
           
          </
    div></td>
           <
    td width="12%" class="hidden-xs"><div align="left">Viewed</div></td>
           <
    td width="14%" class="hidden-xs">
             <
    div align="left"><a href="yourauctions.php?oa_ord=starts&oa_type={ORDERNEXT}">Uploaded</a>
      <!-- IF 
    ORDERCOL eq 'starts' -->
              <
    a href="yourauctions.php?oa_ord=starts&oa_type={ORDERNEXT}">{ORDERTYPEIMG}</a>
      <!-- ENDIF -->       
          </
    div></td>
           <
    td width="6%" align="center">
             <
    div align="left">{L_298}       </div></td>
           <
    td width="6%" align="center">
             <
    div align="left">{L_008}       </div></td>
           
         </
    tr>
    <!-- IF 
    B_AREITEMS -->
       <!-- 
    BEGIN items -->
         <
    tr bgcolor="#EEEEEE">
          <
    td width="7%"><div align="left"><a href="{SITEURL}item.php?id={items.ID}" ><span class="pull-left thumb-sm-topsongs m-l-xs m-r-sm"><img src="{items.IMAGE_URL}" alt="..." width="60" height="60" class="r r-2x img-full" /></span></a></div></td>
           <
    td width="15%"><div align="left">{items.ARTISTNAME}</div></td>
           <
    td width="13%">
             <
    div align="left"><a href="item.php?id={items.ID}">{items.TITLE}</a>
              <
    br>
            <
    small></small></div></td>
           <
    td align="center" class="hidden-xs"><div align="left">[{L_30_0081}{items.COUNTER}{L__0151}]</div></td>
           <
    td align="center" class="hidden-xs">
             <
    div align="left"><small>{items.STARTS}</small> </div></td>
           <
    td width="6%"  align="center">
          <
    div align="left">
          <!-- IF 
    items.B_HASNOBIDS -->
          <
    a href="edit_active_auction.php?id={items.ID}"><span class="glyphicon glyphicon-edit" aria-hidden="true" title="{L_click_to_edit_auction}"></span></a>
      <!-- ELSE -->
          <
    span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="{L_edit_disabled}"></span>
      <!-- ENDIF -->       
      </
    div></td>
           <
    td width="6%"  align="center">
          <
    div align="left">
          <!-- IF 
    items.B_HASNOBIDS -->
          <
    input type="checkbox" name="O_delete[]" value="{items.ID}">
      <!-- ELSE -->
          <
    span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="{L_delete_auction_disabled}"></span>     
      <!-- ENDIF -->       
      </
    div></td>
           
         </
    tr>
       <!-- 
    END items -->
    <!-- ENDIF -->
         <
    tr class="hidden-xs" {BGCOLOUR}>
           <
    td colspan="6" align="right">{L_30_0102}</td>
           <
    td align="center"><div align="left">
            <
    input type="checkbox" id="deleteall">
          </
    div></td>
           
         </
    tr>
         <
    tr>
           <
    td colspan="8" align="center">
             <
    input type="hidden" name="action" value="delopenauctions">
             <
    input type="submit" name="Submit" value="{L_631}" class="btn btn-primary">       </td>
         </
    tr>
       </
    table>
    </
    form>{PAGENA}
    <
    div class="text-center">
       {
    L_5117}&nbsp;{PAGE}&nbsp;{L_5118}&nbsp;{PAGES}
       <
    br>
       {
    PREV}
    <!-- 
    BEGIN pages -->
       {
    pages.PAGE}&nbsp;&nbsp;
    <!-- 
    END pages -->
       {
    NEXT}
    </
    div>

    <!-- INCLUDE 
    user_menu_footer.tpl -->
    and this is the php code
    PHP:
    <?php
    /***************************************************************************
     *  copyright         : (C) 2008 - 2016 WeBid
     *  site           : http://www.webidsupport.com/
     ***************************************************************************/

    /***************************************************************************
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 2 of the License, or
     *  (at your option) any later version. Although none of the code may be
     *  sold. If you have been sold this script, get a refund.
     ***************************************************************************/

    include 'common.php';

    // If user is not logged in redirect to login page
    if (!$user->checkAuth())
    {
       
    $_SESSION['LOGIN_MESSAGE'] = $MSG['5000'];
       
    $_SESSION['REDIRECT_AFTER_LOGIN'] = 'yourauctions.php';
       
    header('location: user_login.php');
       exit;
    }
    // check if the user can access this page
    $user->checkSuspended();

    $NOW time();
    $NOWB date('Ymd');
    $user_message '';



    // DELETE OR CLOSE OPEN AUCTIONS
    if (isset($_POST['action']) && $_POST['action'] == 'delopenauctions')
    {
       if (isset(
    $_POST['O_delete']) && is_array($_POST['O_delete']) && count($_POST['O_delete']) > 0)
       {
         
    $removed 0;
         foreach (
    $_POST['O_delete'] as $k => $v)
         {
           
    $v intval($v);
           
    // Pictures Gallery
           
    if (is_dir(UPLOAD_PATH $v))
           {
             if (
    $dir opendir(UPLOAD_PATH $v))
             {
               while (
    $file readdir($dir))
               {
                 if (
    $file != '.' && $file != '..')
                 {
                   @
    unlink(UPLOAD_PATH $v '/' $file);
                 }
               }
               
    closedir($dir);
               
    rmdir(UPLOAD_PATH $v);
             }
           }

           
    // Delete auction views
           
    $query "DELETE FROM " $DBPrefix "auccounter WHERE auction_id = :auc_id";
           
    $params = array();
           
    $params[] = array(':auc_id'$v'int');
           
    $db->query($query$params);

           
    // Auction
           
    $query "DELETE FROM " $DBPrefix "auctions WHERE id = :auc_id";
           
    $params = array();
           
    $params[] = array(':auc_id'$v'int');
           
    $db->query($query$params);
           
    $removed++;
         }

         
    $query "UPDATE " $DBPrefix "counters SET auctions = (auctions - :removed)";
         
    $params = array();
         
    $params[] = array(':removed'$removed'int');
         
    $db->query($query$params);
         
    $user_message .= sprintf($MSG['1145'], count($_POST['O_delete']));
       }

       if (isset(
    $_POST['closenow']) && is_array($_POST['closenow']) && count($_POST['closenow']) > 0)
       {
         foreach (
    $_POST['closenow'] as $k => $v)
         {
           
    // Update end time to the current time
           
    $query "UPDATE " $DBPrefix "auctions SET ends = :time, relist = relisted WHERE id = :auc_id";
           
    $params = array();
           
    $params[] = array(':time'$NOW'int');
           
    $params[] = array(':auc_id'$v'int');
           
    $db->query($query$params);
         }
         include 
    'cron.php';
         
    $user_message .= sprintf($MSG['1149'], count($_POST['closenow']));
       }
    }
    // Retrieve active auctions from the database

    $params = array();

    $keyword $system->cleanvars($_POST['keyword']);

    $query "SELECT *, count(id) AS COUNT FROM " $DBPrefix "auctions
       WHERE user = :user_id AND closed = 0 AND suspended = 0 AND (title LIKE :title OR artistname LIKE :artistname)
       ORDER BY starts DESC LIMIT :offset, :perpage"
    ;
       
    $params[] = array(':title''%' $keyword '%''int');
    $params[] = array(':artistname''%' $keyword '%''int');
       
    $params[] = array(':user_id'$user->user_data['id'], 'int');
    $params[] = array(':time'$NOW'int');
    $params[] = array(':offset'$OFFSET'int');
    $params[] = array(':perpage'$system->SETTINGS['perpage'], 'int');
    $db->query($query$params);

    $TOTALAUCTIONS $db->result('COUNT');



    if (!isset(
    $_GET['PAGE']) || $_GET['PAGE'] <= || $_GET['PAGE'] == '')
    {
       
    $OFFSET 0;
       
    $PAGE 1;
    }
    else
    {
       
    $PAGE intval($_GET['PAGE']);
       
    $OFFSET = ($PAGE 1) * $system->SETTINGS['perpage'];
    }
    $PAGES = ($TOTALAUCTIONS == 0) ? ceil($TOTALAUCTIONS $system->SETTINGS['perpage']);




    $params = array();

    $keyword $system->cleanvars($_POST['keyword']);

    $query "SELECT * FROM " $DBPrefix "auctions
       WHERE user = :user_id AND closed = 0 AND suspended = 0 AND (title LIKE :title OR artistname LIKE :artistname)
       ORDER BY starts DESC LIMIT :offset, :perpage"
    ;
       
    $params[] = array(':title''%' $keyword '%''int');
    $params[] = array(':artistname''%' $keyword '%''int');
       
    $params[] = array(':user_id'$user->user_data['id'], 'int');
    $params[] = array(':time'$NOW'int');
    $params[] = array(':offset'$OFFSET'int');
    $params[] = array(':perpage'$system->SETTINGS['perpage'], 'int');
    $db->query($query$params);

    $i 0;
    while (
    $item $db->fetch())
    {
       if (
    $item['num_bids'] > 0)
       {
         
    $query "SELECT bid FROM " $DBPrefix "bids WHERE auction = :auc_id ORDER BY bid DESC, id DESC LIMIT 1";
         
    $params = array();
         
    $params[] = array(':auc_id'$item['id'], 'int');
         
    $db->query($query$params);
         if (
    $db->numrows() > 0)
         {
           
    $high_bid $db->result('bid');
         }
       }
       
    // Retrieve counter
       
    $query "SELECT counter FROM " $DBPrefix "auccounter WHERE auction_id = :auc_id";
       
    $params = array();
       
    $params[] = array(':auc_id'$item['id'], 'int');
       
    $db->query($query$params);
       if (
    $db->numrows() > 0)
       {
         
    $viewcounter $db->result('counter');
       }
       else
       {
         
    $viewcounter 0;
       }

       
    $template->assign_block_vars('items', array(
           
    'BGCOLOUR' => (!($i 2)) ? '' 'class="alt-row"',
           
    'ID' => $item['id'],
           
    'TITLE' => htmlspecialchars($item['title']),
           
    'STARTS' => FormatDate($item['starts'], '/'false),
           
    'ENDS' => FormatDate($item['ends'], '/'false),
           
    'BID' => $system->print_money($item['current_bid']),
           
    'BIDS' => $item['num_bids'],
           
    'RELIST' => $item['relist'],
           
    'RELISTED' => $item['relisted'],
           
    'COUNTER' => $viewcounter,
           
    'ARTISTNAME' => $item['artistname'],

           
    'IMAGE_URL' => (!empty($item['pict_url'])) ? 'getthumb.php?w=' $system->SETTINGS['thumb_show'] . '&amp;fromfile=' UPLOAD_FOLDER $item['id'] . '/' $item['pict_url'] : 'images/email_alerts/default_item_img.jpg',

           
    'B_HASNOBIDS' => ($item['current_bid'] == 0)
           ));
       
    $i++;
    }
    // get pagenation
    $PREV intval($PAGE 1);
    $NEXT intval($PAGE 1);
    if (
    $PAGES 1)
    {
       
    $LOW $PAGE 5;
       if (
    $LOW <= 0$LOW 1;
       
    $COUNTER $LOW;
       while (
    $COUNTER <= $PAGES && $COUNTER < ($PAGE 6))
       {
         
    $template->assign_block_vars('pages', array(
             
    'PAGE' => ($PAGE == $COUNTER) ? '<b>' $COUNTER '</b>' '<a class="btn btn-info btn-rounded" href="' $system->SETTINGS['siteurl'] . 'yourauctions.php?PAGE=' $COUNTER '"><u>' $COUNTER '</u></a>'
             
    ));
         
    $COUNTER++;
       }
    }




    $template->assign_vars(array(
         
    'BGCOLOUR' => (!($i 2)) ? '' 'class="alt-row"',
         
    'ORDERCOL' => $_SESSION['oa_ord'],
         
    'ORDERNEXT' => $_SESSION['oa_nexttype'],
         
    'ORDERTYPEIMG' => $_SESSION['oa_type_img'],
         
    'USER_MESSAGE' => $user_message,

         
    'PREV' => ($PAGES && $PAGE 1) ? '<a class="btn btn-info btn-rounded" href="' $system->SETTINGS['siteurl'] . 'yourauctions.php?PAGE=' $PREV '"><u>' $MSG['5119'] . '</u></a>&nbsp;&nbsp;' '',
         
    'NEXT' => ($PAGE $PAGES) ? '<a class="btn btn-info btn-rounded" href="' $system->SETTINGS['siteurl'] . 'yourauctions.php?PAGE=' $NEXT '"><u>' $MSG['5120'] . '</u></a>' '',
         
    'PAGE' => $PAGE,
         
    'PAGES' => $PAGES,

         
    'B_AREITEMS' => ($i 0)
         ));

    include 
    'header.php';
    $TMP_usmenutitle $MSG['619'];
    include 
    INCLUDE_PATH 'user_cp.php';
    $template->set_filenames(array(
         
    'body' => 'yourauctions.tpl'
         
    ));
    $template->display('body');
    include 
    'footer_no.php';


    so the issue is this if i search for for something and it has a next page it doesnt show the item that need to be shown on the next page instead it just shows the rest of the items thats has nothing to do with what i searched for
     
  19. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,145
    Likes Received:
    247
    Is this for yourauction.php page? I thought we were looking for something in the admin panel. I wish I could try to help you quicker but, I have limited time in the forum when I come in here just because there is not much to do in here. It would be nice if specific details were put here. I am totally confused with what you are asking help on. I don't see a search in the yourauctions.php page and I only have 8 items up so, I don't see pagination on my yourauctions.php page. There is no search on the yourauctions.php either. If you run a search in that search box, it's for what is active on the site.

    There is no pagination in the codes you shared about above. Check these pages out with the pagination on them and see if you can figure it out. https://github.com/renlok/WeBid/search?p=1&q=pagination&unscoped_q=pagination

    You can see the pagination code in this one https://github.com/renlok/WeBid/blob/b7b05654df048f79bcf1e5bfe961a04524162d53/browse.php#L147 is different than this one: https://github.com/renlok/WeBid/blo...ff2459060b0b69a3c186e/active_auctions.php#L41

    I hope this helps!
     
  20. skyhigh

    skyhigh Member

    Joined:
    Sep 28, 2010
    Messages:
    449
    Likes Received:
    8
    hi u didnt check d tpl form well theres a search form there i took part of the code from admin page
    it was wen i added the code i realize theres a problem with d admin list auction code with search

    plz read well while i try to explain d issue because i dont think anyone notice this

    so here is what am tryin to explain again

    first go to d admin page change d page break per page to 2
    now click the list auction it will show u d list of auctions (items)

    so let say you have 8 auctions
    boy glass
    boy with
    boy car
    boy gloves
    boy cap
    jack man
    dark glass
    horse shoe

    u search for an item called boy 3 or more similar names will show in the result

    result below
    boy glass
    boy with
    boy car
    boy gloves
    boy cap

    now because d page break is 2 u get this

    boy glass
    boy with

    PREV 1 of 3 NEXT

    and when u click next page u should get
    boy car
    boy gloves

    but instead you will get
    boy glass
    boy with
    boy car
    boy gloves
    boy cap
    jack man
    dark glass
    horse shoe

    i hope u under stand what am saying
     

Share This Page