Hi, I am missing the limit for items per page. I have set them properly to 12 in my block view, however I still see all my 20 items.

This is at the end of my preview code.

WHERE (node.status <> 0) AND (node.type in ('video')) 
ORDER BY node_data_field_date_pub_od_field_date_pub_od_value DESC

I suppose it should be like:

WHERE (node.status <> 0) AND (node.type in ('video')) 
ORDER BY node_data_field_date_pub_od_field_date_pub_od_value DESC <b>LIMIT 12</b>

How could I solve this?

Comments

lekvarnik’s picture

One more time, because it messed up the code.

I suppose it should be like:

WHERE (node.status <> 0) AND (node.type in ('video')) 
ORDER BY node_data_field_date_pub_od_field_date_pub_od_value DESC LIMIT 12
quicksketch’s picture

Could you post the entire query you're seeing? jCarousel does a COUNT() query (with no limit) to get the total number of items in the entire list so that it can pager properly, perhaps that's what you're seeing? jCarousel doesn't affect the total number of items queried, so it shouldn't be changing the original query in any way.

quicksketch’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Reopen if you have further input.

Dandily’s picture

Version: 6.x-2.3 » 6.x-2.6

I have the same problem with limiting jcarousel items from views. I have about 4000 images, so when i want to show only first 20 - module show all of them, ignoring Views show limit.

To correct this i changed this in jcarousel.views.inc:

comment line 63
//$view->pager['items_per_page'] = $last - $first;

comment line 75
//$view->items_per_page = $last - $first;

before:

  // Views may already populate total_rows later, but since we've already
  // generated this value, we might as well make it available.
  $view->total_rows = $count;

add

  // 0 - its not limit, its UNLIMIT
  // Views 2:
  if (isset($view->pager)) {
    if ($view->pager['items_per_page'] != 0){
	    $count = $view->pager['items_per_page'];
    }
  // Views 3:
  } else {
    if ($view->items_per_page != 0){
      $count = $view->items_per_page;
    }
  }

For now jCarousel will use Views limits for items and will not use when limit is set to 0.

mikat’s picture

With the version 7.x-2.6 you can set the "Display a specified number of items" by changing lines 156-157 at jcarousel.views.inc

if ($view->query->pager->options['items_per_page'] != 0){
      $count = $view->query->pager->options['items_per_page'];

This will read the value from the views pager. You can still use the jcarousel pager but this will set the total amount items fetched.