Author Topic: Pagenav - set the number of products per page up to 5 pieces as default (not 20)  (Read 42968 times)

0zz1

  • Beginner
  • *
  • Posts: 28
I dont get this working... what I want to do is to show 6 products per page... and now in 1 category I got 8 products and it shows all the 8 products even in the Display #6 (shows 6).

this is the code I got (note I only want to show 6... and I do not even want to show more pages... so if there is more than 6 products I want the rest to be hidden from users).


 if (!empty($link) && strpos( 'limitstart=', $link) === false) {  // insert limitstart in url if missing // shumisha
      $link .= '&limitstart='.$this->limitstart;
    }
    for ($i=6; $i <= 6; $i+=6) {
      if (empty( $link)) {
        $limits[$i] = $i;
      } else {
        $limits[vmRoute($link.'&limit='.$i)] = $i;
      }
    }
    if (empty( $link)) {
      $limits[6] = 6;
    } else {
      $limits[vmRoute($link.'&limit=6')] = 6;
    }


and what should I have here in the shop.browse.php ... I have tried different numbers (replacing the 0) but dont see any effect on the site.

if( $limitstart > 0 && $limit >= $num_rows) {

   $list = str_replace( 'LIMIT '.$limitstart, 'LIMIT 0', $list );
}

nitant

  • Beginner
  • *
  • Posts: 1
I found this solution. Works much better and no mucking around in PHP files.

http://forum.virtuemart.net/index.php?topic=25391.msg106792#msg106792
Quote
Sussed it - posting solution for future reference...

Joomla! - Global configuration - Site (TAB) - 'List length' (drop down menu) - default appears to be 30.... can be altered down to 5..

fibobaby

  • Beginner
  • *
  • Posts: 5
    • Thoi trang tre em tai Viet Nam
To set the steps the # of products are shown goto:

Joomla_1.5.x/administrator/components/com_virtuemart/classes/pageNavigation.class.php

and you'll find this around line 59:
Code: [Select]
  for ($i=6; $i <= 60; $i+=6) {
      if (empty( $link)) {
        $limits[$i] = $i;
      } else {
        $limits[vmRoute($link.'&limit='.$i)] = $i;
      }
    }
    if (empty( $link)) {
      $limits[90] = 90;
    } else {
      $limits[vmRoute($link.'&limit=90')] = 90;
    }
change these values to your needs:
Code: [Select]
($i=6; $i <= 60; $i+=6)
the 1st value (6) is the smallest # of products shown
the 2nd value (60) is until which # of products it will count up in steps of the 3rd value (6).

In the following part you set the max # of products shown (90):
Code: [Select]
if (empty( $link)) {
      $limits[90] = 90;
    } else {
      $limits[vmRoute($link.'&limit=90')] = 90;
    }

 ;) this code is customized already maybe you'll find other values in your php file!
Many thanks,
I've modified my pageNavigation.class.php file and eveything is perfectly.
http://www.fibobaby.com
Fibobaby - Baby fashion & more

yannik

  • Beginner
  • *
  • Posts: 3
Dear all,

I am newbie, I am using VM 1.1.9 where I can found the code. thank you

subtoxin

  • Beginner
  • *
  • Posts: 1
Alright, so on my   administrator/components/com_virtuemart/classes/pageNavigation.class.php file, this is what it says at line 59:

}
    for ($i=5; $i <= 30; $i+=5) {
      if (empty( $link)) {
        $limits[$i] = $i;
      } else {
        $limits[vmRoute($link.'&limit='.$i)] = $i;
      }
    }
    if (empty( $link)) {
      $limits[50] = 50;
    } else {
      $limits[vmRoute($link.'&limit=50')] = 50;
    }

Our product pages are only displaying 20 at a time. How do I adjust the code to allow for 50? Joomla 1.5, VM 1.1.9

infoleather

  • Beginner
  • *
  • Posts: 1
You can set a different default items per page in Joomla global configuration by changing the length of the parameter list. When you good collection of Slim Fit Black Leather Blazer Jackets it gives you confidence to attend to every occasion and cwmalls.com helps to dress up in the best possible way. Black Leather Motorcycle Jackets For Women is the best fashion for the forthcoming year.
the sunset of life gives me mystical lore, And coming events cast their shadows before.