Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Most popular ads are not properly paginated

  1. #1
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts

    Lightbulb Most popular ads are not properly paginated

    Hello, I want to pay the attention of developers.
    The 'Most popular' ads are not properly paginated!
    I found a bug in the file 'loop-featured.php'.
    Take a look at the code:


    PHP Code:
        $start $paged 10;

        
    // Add an additional entry to test for a next page
        
    $end $start 10 1;

        
    // give us the most popular ads based on page views
        
    $sql $wpdb->prepare"SELECT * FROM " $wpdb->prefix "cp_ad_pop_total a "
        
    "INNER JOIN " $wpdb->posts " p ON p.ID = a.postnum "
        
    "WHERE postcount > 0 AND post_status = 'publish' AND post_type = '".APP_POST_TYPE."' "
        
    "ORDER BY postcount DESC LIMIT $start,$end);

        
    $pageposts $wpdb->get_results$sql );

        global 
    $cp_has_next_page;
        if(
    count($pageposts) == 11){
        
    $cp_has_next_page true;
        }else{
        
    $cp_has_next_page false;
        }
        
        
    $pageposts array_slice$pageposts010); 
    On the home page variable $paged = 0:
    $start = $paged * 10 = 0
    $end = $start + 10 + 1 = 11
    And we see a records from 0 to 10

    Click on the link 'view more ads' and go to the page 2:
    $paged = 2
    $start = $paged * 10 = 20
    $end = $start + 10 + 1 = 31
    And we see a records from 21 to 30

    Where records from 11 to 20?

    That's how I fixed it:

    PHP Code:
        if ( $paged != $var 10;
        
    $start $paged 10 $var;

        
    // Add an additional entry to test for a next page
        
    $end $start 10 1;

        
    // give us the most popular ads based on page views
        
    $sql $wpdb->prepare"SELECT * FROM " $wpdb->prefix "cp_ad_pop_total a "
        
    "INNER JOIN " $wpdb->posts " p ON p.ID = a.postnum "
        
    "WHERE postcount > 0 AND post_status = 'publish' AND post_type = '".APP_POST_TYPE."' "
        
    "ORDER BY postcount DESC LIMIT $start,$end);

        
    $pageposts $wpdb->get_results$sql );

        global 
    $cp_has_next_page;
        if(
    count($pageposts) == 11){
        
    $cp_has_next_page true;
        }else{
        
    $cp_has_next_page false;
        }
        
        
    $pageposts array_slice$pageposts010); 
    Perhaps this is not a serious bug, but please fix it.
    This is not a serious way!


    By the way, why on the second page, there are no links to the next pages 3, 4, 5 ... ?
    If you type in the browser '.../page/3/?Sort=popular' page will be opened correctly. Where are the links?


    Thank you for your attention.
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  2. #2
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  4. The Following User Says Thank You to dikiyforester For This Useful Post:

    rubencio (February 18th, 2012)

  5. #4
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  6. #5
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #6
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. The Following User Says Thank You to dimitris For This Useful Post:

    dikiyforester (March 12th, 2012)

  9. #7
    laura's Avatar
    Join Date
    Apr 2010
    Location
    Michigan
    Posts
    2,594
    Thanks
    60
    Thanked 279 Times in 254 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  11. #9
    laura's Avatar
    Join Date
    Apr 2010
    Location
    Michigan
    Posts
    2,594
    Thanks
    60
    Thanked 279 Times in 254 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #10
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Display thumbnails in sidebar widgets (Popular today & Popular overall)
    By mistercyril in forum ClassiPress General Discussion
    Replies: 8
    Last Post: April 19th, 2016, 02:26 PM
  2. ADS not lining up properly
    By clickron in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: May 28th, 2011, 12:13 PM
  3. [SOLVED] Change on Popular Ads Today & Popular Ads Overall widgets :)
    By homme143 in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: March 14th, 2011, 01:16 AM
  4. Replies: 1
    Last Post: February 22nd, 2011, 11:18 AM
  5. Replies: 7
    Last Post: July 20th, 2010, 11:26 AM