Change Default List Length Options in dropdown Global Config

Your code modifications and patches you want to share with others.
Locked
lydianp18
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Jan 21, 2009 4:52 am

Change Default List Length Options in dropdown Global Config

Post by lydianp18 » Tue Oct 20, 2009 6:18 am

Ok, here's my problem. I need to change the options in the drop down box for list length in the Global Configuration area. Currently they're 5,10,15,20 - etc... I need it by 3s (ie 3,6,9).

I've looked everywhere and can't find where the options are coming from - help! :D

Thanks,
Lydia

ps. If I wasn't turning the site over to my client it wouldn't be a problem - I could just change the config file by hand anytime I edit anything in the global config, like meta-tags. But my client can't do that - so I need to change the drop down so it corresponds to our layout.

Umeboshi
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Apr 29, 2009 10:32 am

Re: Change Default List Length Options in dropdown Global Config

Post by Umeboshi » Thu Oct 22, 2009 1:05 pm

Need help with the same thing - the only solutions I can find are old and not valid anymore.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11615
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Change Default List Length Options in dropdown Global Config

Post by ooffick » Thu Oct 22, 2009 2:40 pm

You would need to change the following file:
administrator/components/com_config/controllers/application.php

Code: Select all

$listLimit 				= array (JHTML::_('select.option', 5, 5), JHTML::_('select.option', 10, 10), JHTML::_('select.option', 15, 15), JHTML::_('select.option', 20, 20), JHTML::_('select.option', 25, 25), JHTML::_('select.option', 30, 30), JHTML::_('select.option', 50, 50), JHTML::_('select.option', 100, 100),);
Olaf
Olaf Offick - Global Moderator
learnskills.org

Umeboshi
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Apr 29, 2009 10:32 am

Re: Change Default List Length Options in dropdown Global Config

Post by Umeboshi » Thu Oct 22, 2009 5:11 pm

Thanks! That changed the numbers in backend, but how do you get the same result in frontend? There it still says 5, 10, 15 etc.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11615
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: Change Default List Length Options in dropdown Global Config

Post by ooffick » Thu Oct 22, 2009 6:49 pm

For that you will need to change this:

Code: Select all

	/**
	 * Creates a dropdown box for selecting how many records to show per page
	 *
	 * @access	public
	 * @return	string	The html for the limit # input box
	 * @since	1.0
	 */
	function getLimitBox()
	{
		global $mainframe;

		// Initialize variables
		$limits = array ();

		// Make the option list
		for ($i = 5; $i <= 30; $i += 5) {
			$limits[] = JHTML::_('select.option', "$i");
		}
		$limits[] = JHTML::_('select.option', '50');
		$limits[] = JHTML::_('select.option', '100');
		$limits[] = JHTML::_('select.option', '0', JText::_('all'));

		$selected = $this->_viewall ? 0 : $this->limit;

		// Build the select list
		if ($mainframe->isAdmin()) {
			$html = JHTML::_('select.genericlist',  $limits, 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected);
		} else {
			$html = JHTML::_('select.genericlist',  $limits, 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
		}
		return $html;
	}
in the file libraries/joomla/html/pagination.php

Olaf
Olaf Offick - Global Moderator
learnskills.org

mennoooo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Feb 07, 2010 8:41 pm

Re: Change Default List Length Options in dropdown Global Config

Post by mennoooo » Sun Feb 07, 2010 8:46 pm

I need to change the options in the drop down box for product list length in Yootheme Zoo to 6 and not 5, 10, 15 etc... But how?

anthonyo
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Sat Mar 15, 2008 10:38 am

Re: Change Default List Length Options in dropdown Global Config

Post by anthonyo » Tue Apr 13, 2010 8:28 am

Hello, thanks for your help. I followed your instructions and managed to get this to work, except thant the dropdown list on the frontend is not showing the list as I wanted to.

On the backend it works great, in settings and in any other dropdown (like article manager)

I guess some other adjustment must be made but I can't find the correct file.

Thank you very much

User avatar
bluesardine
Joomla! Guru
Joomla! Guru
Posts: 502
Joined: Fri Nov 16, 2007 10:49 pm
Location: Oxford
Contact:

Re: Change Default List Length Options in dropdown Global Co

Post by bluesardine » Mon Nov 01, 2010 9:36 pm

Hi guys

This below quote, please advise as I only want to show 4 or 6 products what would I do here?
ooffick wrote:For that you will need to change this:

Code: Select all

	/**
	 * Creates a dropdown box for selecting how many records to show per page
	 *
	 * @access	public
	 * @return	string	The html for the limit # input box
	 * @since	1.0
	 */
	function getLimitBox()
	{
		global $mainframe;

		// Initialize variables
		$limits = array ();

		// Make the option list
		for ($i = 5; $i <= 30; $i += 5) {
			$limits[] = JHTML::_('select.option', "$i");
		}
		$limits[] = JHTML::_('select.option', '50');
		$limits[] = JHTML::_('select.option', '100');
		$limits[] = JHTML::_('select.option', '0', JText::_('all'));

		$selected = $this->_viewall ? 0 : $this->limit;

		// Build the select list
		if ($mainframe->isAdmin()) {
			$html = JHTML::_('select.genericlist',  $limits, 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected);
		} else {
			$html = JHTML::_('select.genericlist',  $limits, 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
		}
		return $html;
	}
in the file libraries/joomla/html/pagination.php

Olaf
Joomla Web designer Oxford https://www.swankypixels.com
Architectural Photographer UK https://www.peterhaken.com

User avatar
draftvader
Joomla! Explorer
Joomla! Explorer
Posts: 321
Joined: Sun Jun 15, 2008 11:52 am
Location: Bangkok, Thailand
Contact:

Re: Change Default List Length Options in dropdown Global Co

Post by draftvader » Thu Jan 20, 2011 2:16 am

Hacked it

Change from:

Code: Select all

// Make the option list
      for ($i = 5; $i <= 30; $i += 5) {
         $limits[] = JHTML::_('select.option', "$i");
      }
      $limits[] = JHTML::_('select.option', '50');
      $limits[] = JHTML::_('select.option', '100');
      $limits[] = JHTML::_('select.option', '0', JText::_('all'));
to

Code: Select all

// Make the option list
      for ($i = 1; $i <= 30; $i += 1) {
         $limits[] = JHTML::_('select.option', "$i");
      }
      $limits[] = JHTML::_('select.option', '4');
      $limits[] = JHTML::_('select.option', '6');
      $limits[] = JHTML::_('select.option', '0', JText::_('all'));
Good luck :)
http://www.theorganicweb.co.uk

"Geek is all I've got. That and my sweet style" - Moss, IT Crowd

User avatar
draftvader
Joomla! Explorer
Joomla! Explorer
Posts: 321
Joined: Sun Jun 15, 2008 11:52 am
Location: Bangkok, Thailand
Contact:

Re: Change Default List Length Options in dropdown Global Co

Post by draftvader » Thu Jan 20, 2011 2:17 am

Sorry, nearly forgot. Make sure you do a complete browser clean after making the change. This did NOT want to display the change with a simple CTRL+F5
http://www.theorganicweb.co.uk

"Geek is all I've got. That and my sweet style" - Moss, IT Crowd


Locked

Return to “Core Hacks and Patches”