Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • igorprado Friend
    #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 30

    But instead of 0, I want to start in 5, for example:

    5-10
    10-20
    20-30
    More than 30

    How can I make this work?

    Phan Gam Friend
    #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 30

    But instead of 0, I want to start in 5, for example:

    5-10
    10-20
    20-30
    More than 30

    How 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.

    igorprado Friend
    #363707

    Thanks so much!

    Awesome support! It works perfectly 😀

    tsaya Friend
    #516738

    What 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 Moderator
    #516814

    Hello,

    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.

    tsaya Friend
    #516850

    Not 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 Moderator
    #516852

    Hi,

    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]);
    }

    }

Viewing 7 posts - 1 through 7 (of 7 total)

This topic contains 7 replies, has 4 voices, and was last updated by  Luna Garden 10 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum