Jump to content

Remove the unnecessary button on pagination


Recommended Posts

hi all,

i am wondering how to remove the button of "OK" ("Go" in my case) in "XX items per page" of the pagination. all i want is that, customer just need on click to select the viewed number per page, no need to select the number from the drop down list then click ok.

i suppose this requested effect is just like the "sort by" one.

anyone know how to make it? highly appreciated!!!

ken

6197_AIvuL7SbB3dNn74iI1al_t

Link to comment
Share on other sites

This isn't an easy request. Here is a quick solution I've come up with. It won't work if the number of pages is 5 or 100, for example, since it assumes the length of the value is 2. Using the default page number values, it should work. It could also be optimised.

Add the following function to the bottom of classes/Link.php before the last }:

public function addPaginationDetails($url, $n)
{
   // Remove existing &n;= assuming value length is 2
   $pos = strpos($url, '&n;=');
   if ($pos !== FALSE)
       $url = substr($url, 0, $pos) . substr($url, $pos + 5);

   // Add new &n;= to the url
   $pos = strpos($url, '&');
   return ($pos !== FALSE ? substr($url, 0, $pos) : $url) . '&n;=' . $n . ($pos !== FALSE ? substr($url, $pos) : '');
}



Change lines 52-55 from:

<input type="submit" class="button_mini" value="{l s='OK'}" />
{l s='items:'}

{foreach from=$nArray item=nValue}
{$nValue|escape:'htmlall':'UTF-8'}



to:

{l s='items'}

{foreach from=$nArray item=nValue}
{$nValue|escape:'htmlall':'UTF-8'}



Hope it helps you. Feel free to modify it. It will help you learn PHP. ;)

Link to comment
Share on other sites

:wow: really not that easy! thank you Rocky for kind help. i am a big fan of the boxing fighter Rocky :kiss: haha...

i tried the codes but failed. i cannot tell if the php code is ok as i know nothing about it. but i research the mod codes from line 52-55 of pagination.tpl. it appears that no action is defined by . i guess a string of click-on-change is missing. so nothing happen when select the default page view values from the drop down list.

and hell i don't know coding. :sick:

Link to comment
Share on other sites

  • 6 months later...

You actually need the "Go" button there. You can't use the select box without a "Go" button unless you implement some javascript. For that matter, you can hide the button and open the new window with javascript. I suggest a theme level addon.

Link to comment
Share on other sites

×
×
  • Create New...