-
AuthorPosts
-
November 20, 2010 at 5:23 pm #156626
Hi,
I want to set the first value of a range selection with a specific value. If I make a range selection with the numbers 10,20,30, my select would be:
Any FIELDNAME
0-10
10-20
20-30
More than 30But instead of 0, I want to start in 5, for example:
5-10
10-20
20-30
More than 30How can I make this work?
Phan Gam FriendPhan Gam
- Join date:
- June 2008
- Posts:
- 216
- Downloads:
- 0
- Uploads:
- 2
- Thanks:
- 4
- Thanked:
- 39 times in 38 posts
November 22, 2010 at 8:23 am #363691<em>@igorprado 204455 wrote:</em><blockquote>Hi,
I want to set the first value of a range selection with a specific value. If I make a range selection with the numbers 10,20,30, my select would be:
Any FIELDNAME
0-10
10-20
20-30
More than 30But instead of 0, I want to start in 5, for example:
5-10
10-20
20-30
More than 30How can I make this work?</blockquote>
Hi,
In JA-K2 Filter default, for ja-ranges type we set starting option is 0, but i think You can change it following way below :
1 – Download and install Ja K2 Filter package
2 – You can see php file as plugins/search/jak2_filter.php, please find code secsion
$objects[]= JHTML::_('select.option',"",JText::_('Any '). $item->name);
$objects[]= JHTML::_('select.option',"0-{$options[0]}","0 - {$options[0]}");
about line 495.
Please remove line$objects[]= JHTML::_('select.option',"0-{$options[0]}","0 - {$options[0]}");
3. In Ja-range, you can put options 5,10,20,30 to render your html.
Please do it and check again, Happy if can help you.November 22, 2010 at 10:15 am #363707Thanks so much!
Awesome support! It works perfectly 😀
December 28, 2013 at 2:12 pm #516738What about the same functionallity in the latest version of this plugin? there is no path plugins/search/jak2_filter.php
but : plugins/k2/jak2filter/jak2filter.php and there is no line 495.
Luna Garden ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
December 30, 2013 at 3:00 am #516814Hello,
In new version of JA K2 Filter, go to file:
modulesmod_jak2filterhelper.php
Find these lines (about line 221 )
for($i = 0; $i<count($ranges);$i++){
if($i==0){
$options[] = JHTML::_('select.option','|'.$ranges[$i],JText::_('LESS_THAN').' '. $this->jak2filterNumberFormat($ranges[$i], $field) );
}
else if($i==(count($ranges)-1)){
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$this->jak2filterNumberFormat($ranges[$i-1], $field).JText::_('JA_K2FILTER_TO').$this->jak2filterNumberFormat($ranges[$i], $field));
$options[] = JHTML::_('select.option',$ranges[$i].'|',JText::_('MORE_THAN').' '.$this->jak2filterNumberFormat($ranges[$i], $field) );
}
else{
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$this->jak2filterNumberFormat($ranges[$i-1], $field).JText::_('JA_K2FILTER_TO').$this->jak2filterNumberFormat($ranges[$i], $field));
}}
change to:
for($i = 1; $i<count($ranges);$i++){
if($i==(count($ranges)-1)){
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$this->jak2filterNumberFormat($ranges[$i-1], $field).JText::_('JA_K2FILTER_TO').$this->jak2filterNumberFormat($ranges[$i], $field));
$options[] = JHTML::_('select.option',$ranges[$i].'|',JText::_('MORE_THAN').' '.$this->jak2filterNumberFormat($ranges[$i], $field) );
}
else{
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$this->jak2filterNumberFormat($ranges[$i-1], $field).JText::_('JA_K2FILTER_TO').$this->jak2filterNumberFormat($ranges[$i], $field));
}}
Remember to backup your file before processing.
December 30, 2013 at 9:38 am #516850Not working. I get this error on error_log
Call to undefined method modJak2filterHelper::jak2filterNumberFormat() in /var/www/vhosts/mydomain.com/httpdocs/modules/mod_jak2filter/helper.php on line 205, referer: http://mydomain.com/filterpage
Luna Garden ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
December 30, 2013 at 9:54 am #516852Hi,
Sorry I said wrong file.
Please go to:
modulesmod_jak2filterhelper.php
find these lines:
for($i = 0; $i<count($ranges);$i++){
if($i==0){
$options[] = JHTML::_('select.option','|'.$ranges[$i],JText::_('LESS_THAN').' '.$ranges[$i] );
}
else if($i==(count($ranges)-1)){
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$ranges[$i-1].JText::_('JA_K2FILTER_TO').$ranges[$i]);
$options[] = JHTML::_('select.option',$ranges[$i].'|',JText::_('MORE_THAN').' '.$ranges[$i] );
}
else{
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$ranges[$i-1].JText::_('JA_K2FILTER_TO').$ranges[$i]);
}}
change to:
for($i = 1; $i<count($ranges);$i++){
if($i==(count($ranges)-1)){
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$ranges[$i-1].JText::_('JA_K2FILTER_TO').$ranges[$i]);
$options[] = JHTML::_('select.option',$ranges[$i].'|',JText::_('MORE_THAN').' '.$ranges[$i] );
}
else{
$options[] = JHTML::_('select.option',$ranges[$i-1].'|'.$ranges[$i],$ranges[$i-1].JText::_('JA_K2FILTER_TO').$ranges[$i]);
}}
-
AuthorPosts
This topic contains 7 replies, has 4 voices, and was last updated by Luna Garden 10 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum