-
AuthorPosts
-
December 19, 2012 at 10:33 am #183246
I need to appear in alphabetical order select fields filtrates k2 extra fields.
ThanksMoonSailor FriendMoonSailor
- Join date:
- November 2011
- Posts:
- 1106
- Downloads:
- 0
- Uploads:
- 245
- Thanks:
- 89
- Thanked:
- 248 times in 223 posts
December 20, 2012 at 3:17 am #476850Hi,
Do you mean that you want to order here ?
Send me FTP account of your site, i will fix it for you
rsystems Friendrsystems
- Join date:
- July 2012
- Posts:
- 118
- Downloads:
- 0
- Uploads:
- 7
- Thanks:
- 41
- Thanked:
- 7 times in 1 posts
December 20, 2012 at 11:10 am #476925I’d like to know solution too, now if I create another K2 Extra field, it’s not sorted on alphabet but on number of entry/ID, it’s ugly.
December 20, 2012 at 11:54 am #476935That’s right, I want those extra fields appear ordered and that the results also appear in alphabetical order.
For security reasons, not allowed to give me FTP account but if I indicate the solution or files to play, I resolve. thanks :((
December 20, 2012 at 6:09 pm #476978MoonSailor FriendMoonSailor
- Join date:
- November 2011
- Posts:
- 1106
- Downloads:
- 0
- Uploads:
- 245
- Thanks:
- 89
- Thanked:
- 248 times in 223 posts
December 21, 2012 at 10:02 am #477066Hi @imaxenio2293, @rsystems:
Open file modules/mod_jak2filter/helper.php and add code
[PHP]
class ja_object_sorter
{
var $object_array;
var $sort_by;function _comp($a,$b)
{
$key=$this->sort_by;
if ($this->object_array[$a]->$key == $this->object_array[$b]->$key) return 0;
return ($this->object_array[$a]->$key < $this->object_array[$b]->$key) ? -1 : 1;
}function _comp_desc($a,$b)
{
$key=$this->sort_by;
if ($this->object_array[$a]->$key == $this->object_array[$b]->$key) return 0;
return ($this->object_array[$a]->$key > $this->object_array[$b]->$key) ? -1 : 1;
}function sort(&$object_array, $sort_by, $sort_type = “ASC”)
{
$this->object_array = $object_array;
$this->sort_by = $sort_by;
if ($sort_type == “DESC”)
{
uksort($object_array, array($this, “_comp_desc”));
}
else
{
uksort($object_array, array($this, “_comp”));
}
}
}
[/PHP]in bottom file.
Apply for select box : find function
[PHP]
public function getSelect($field,$ranges = NULL){
$defaut_values = JRequest::getVar(“xf_{$field->id}”,null);
$values = json_decode($field->value);
[/PHP]
add code
[PHP]
$ja_object_sorter = new ja_object_sorter ();
$ja_object_sorter ->sort($values,’name’);
[/PHP]
after “$values = json_decode($field->value);” and before “foreach ($values as $f)”Apply for multi select box :find function:
[PHP]
public function getMultipleSelect($field,$ranges = NULL){
$values = json_decode($field->value);
[/PHP]add code
[PHP]
$ja_object_sorter = new ja_object_sorter ();
$ja_object_sorter ->sort($values,’name’);
[/PHP]
alter “$values = json_decode($field->value);” and before “foreach ($values as $f)”Apply for Magic Select : find function:
[PHP]
public function getMagicSelect($field,$ranges = NULL){
$auto_filter = (int) @$this->params->get(‘auto_filter’);
$defaut_values = JRequest::getVar(“xf_{$field->id}”,null);
if(!is_array($defaut_values)) {
$defaut_values = array($defaut_values);
}
$values = json_decode($field->value);
[/PHP]add code
[PHP]
$ja_object_sorter = new ja_object_sorter ();
$ja_object_sorter ->sort($values,’name’);
[/PHP]
after “$values = json_decode($field->value);” and before “foreach ($values as $f)”MoonSailor FriendMoonSailor
- Join date:
- November 2011
- Posts:
- 1106
- Downloads:
- 0
- Uploads:
- 245
- Thanks:
- 89
- Thanked:
- 248 times in 223 posts
December 21, 2012 at 10:03 am #477067Note : please backup file “modules/mod_jak2filter/helper.php” before changing :p
rsystems Friendrsystems
- Join date:
- July 2012
- Posts:
- 118
- Downloads:
- 0
- Uploads:
- 7
- Thanks:
- 41
- Thanked:
- 7 times in 1 posts
January 3, 2013 at 1:39 pm #478279Can this also be an option in the next update?
Arvind Chauhan ModeratorArvind Chauhan
- Join date:
- September 2014
- Posts:
- 3835
- Downloads:
- 74
- Uploads:
- 92
- Thanks:
- 1240
- Thanked:
- 1334 times in 848 posts
AuthorPostsViewing 9 posts - 1 through 9 (of 9 total)This topic contains 9 replies, has 4 voices, and was last updated by Arvind Chauhan 11 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum