Osclass code to filter the search results by seller type

freecoded

freecoded

Administrator
Staff member
Freecoin
5,262
Updated and working code.

Use this in your search form:


<select name="sCompany">
<option value="0">User</option>
<option value="1">Company</option>
</select>

Put this in your functions.php:


<?php
function wm_search_user_type($params) {
if(array_key_exists('sCompany', $params)) {
Search::newInstance()->dao->join(sprintf('%st_user u', DB_TABLE_PREFIX), sprintf('u.pk_i_id = %st_item.fk_i_user_id', DB_TABLE_PREFIX, DB_TABLE_PREFIX), 'LEFT');
Search::newInstance()->dao->where(sprintf('u.b_company = %s', osc_esc_html($params['sCompany'])));
}
}
osc_add_hook('search_conditions', 'wm_search_user_type');
 

Richest Freecoded User

Most Freecoin

freecoded
freecoded
5,262 Freecoin
P
Peterparker87
1,594 Freecoin
J
Johnhendrick
1,273 Freecoin
S
Smith16
736 Freecoin
Davy200
Davy200
590 Freecoin
R
riyageorge0895
496 Freecoin
nathan69
nathan69
426 Freecoin
A
Alfrenoe87
426 Freecoin
D
domnickfury
423 Freecoin
Laureine
Laureine
415 Freecoin
Top