Advertisement:

Author Topic: How to add new car field to search?  (Read 1525 times)

jamesy

  • Newbie
  • *
  • Posts: 22
How to add new car field to search?
« on: June 03, 2014, 01:18:06 pm »
Recently, I just tried to make other field to works properly. But in search form how do I make it work?

Here is the current code that without proper search result
Code: [Select]
    <div class="row one_input">
        <h6><?php _e('Condition''cars_attributes'); ?></h6>
        <?php $condition Params::getParam('condition') ; ?>
        <select name="condition" id="condition">
            <option value=""><?php _e('Select a condition''cars_attributes'); ?></option>
                <option value="USED" <?php if($condition ==  'USED') { echo 'selected'; } ?>><?php _e('Used''cars_attributes'); ?>
                <option value="NEW" <?php if($condition ==  'NEW') { echo 'selected'; } ?>><?php _e('New''cars_attributes'); ?>
</option>
        </select>
    </div>
« Last Edit: June 03, 2014, 01:20:38 pm by jamesy »

jamesy

  • Newbie
  • *
  • Posts: 22
Re: How to add new car field to search?
« Reply #1 on: June 03, 2014, 02:13:04 pm »
I've just solved this problem by adding code below in index.php.. I don't know if this is correct way to do so.

Code: [Select]
case 'condition':
                    if( $value == 'USED' || $value == 'NEW' ) {
                        Search::newInstance()->addConditions(sprintf("%st_item_car_attr.e_condition = '%s'", DB_TABLE_PREFIX, $value));
                        $has_conditions = true;
                    }