в functions.php
в inc.search.php
PHP:
function SearchFreeOnly() {
return (Params::getParam('sFree'));
}
//Add the search condition to search only Free ads
function AddSearch_FreeOnly($params) {
if(isset($params['sFree'])) {
//Only add search parameter if set to true
if($params['sFree']) {
$mSearch = Search::newInstance();
$mSearch->addConditions(sprintf("%st_item.i_price = 0", DB_TABLE_PREFIX));
}
}
}
//Add our contact condition to the search conditions used by Osclass
osc_add_hook('search_conditions', 'AddSearch_FreeOnly');
function SearchContactOnly() {
return (Params::getParam('sContact'));
}
//Add the search condition to search only Free ads
function AddSearch_ContactOnly($params1) {
if(isset($params1['sContact'])) {
//Only add search parameter if set to true
if($params1['sContact']) {
$mSearch1 = Search::newInstance();
$mSearch1->addConditions(sprintf("%st_item.i_price IS NULL", DB_TABLE_PREFIX));
}
}
}
//Add our new search condition to the search conditions used by Osclass
osc_add_hook('search_conditions', 'AddSearch_ContactOnly');
PHP:
<label for="FreeOnly">
<input type="checkbox" name="sFree" id="FreeOnly" value="1" <?php echo (SearchFreeOnly() ? 'checked' : ''); ?> /><strong><?php _e('Only free listings', 'boxer') ; ?></strong>
</label>
<label for="ContactOnly">
<input type="checkbox" name="sContact" id="ContactOnly" value="1" <?php echo (SearchContactOnly() ? 'checked' : ''); ?> /><strong><?php _e('Only contact listings', 'boxer') ; ?></strong>
</label>