Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • conforturis Friend
    #189213

    Hi,
    How can I make List of Jobs module to show offers of a single category?

    HeR0 Friend
    #500130

    Dear Conforturis,

    I’m afraid that at this moment this module doesn’t support to filter jobs by categories.

    conforturis Friend
    #500145

    But we can do this changing the code. Tell me how?
    It is really important.

    HeR0 Friend
    #500179

    Pls do as follow to see one the example of customization.

    – Open file mod_jalist_jobs.xml and add new params

    <field name="cat_id" type="text" default="20" label="CATEGORY" description="CATEGORY_DESC" />

    – Open file mod_jalist_jobs.php and add new code line

    [PHP]$catid = intval($params->get( ‘cat_id’, 0 ));[/PHP]
    after line

    [PHP]$mode = trim( $params->get( ‘mode’, ‘a.effected_date desc’ ) );[/PHP]

    Change code line

    [PHP]$all_items = modJAListJobsHelper::get_list_jobs($model, $limit, $mode);[/PHP]
    to
    [PHP]$all_items = modJAListJobsHelper::get_list_jobs($model, $limit, $mode, $catid);[/PHP]

    – Open file helper.php and custom condition to filter jobs by category then edit function get_list_jobs to

    [PHP]function get_list_jobs( $model, $limit=20, $mode=”, $catid = 0 ){
    global $jbconfig;
    $mainframe = JFactory::getApplication();

    $limitstart = 0;

    $where_more = ‘ a.status=’Approved’ ‘;
    $where_more .= ‘ and(a.effected_date<=now()) and ( (DATE_ADD(a.effected_date, INTERVAL ‘. (int)$jbconfig[‘posts’]->get(‘posts_display_days’, 30). ‘ DAY) >= now() AND a.is_hotjob=0) or (DATE_ADD(a.effected_date, INTERVAL ‘. (int)$jbconfig[‘posts’]->get(‘posts_show_days_elapsed’, 30). ‘ DAY) >= now() AND a.is_hotjob=1) )’;
    if($catid > 0){
    $where_more .= ‘ and (a.cat_id LIKE ”.$catid.’,%’ OR a.cat_id LIKE ‘%,’.$catid.’,%’ OR a.cat_id LIKE ‘%,’.$catid.” OR a.cat_id = ‘.$catid.’) ‘;
    }
    if (JRequest::getVar(‘task’)!=’employer’) {
    $filter_order = JRequest::getString(‘filter_order’, ”);
    $filter_order_Dir = JRequest::getString(‘filter_order_Dir’, ‘DESC’);
    if ($filter_order!=null) {
    $mode = ”;
    $mode .= $filter_order .’ ‘. $filter_order_Dir;
    }
    }
    $all_items = $model->getItems($where_more, $limit, $limitstart, $mode);

    return $all_items;
    }[/PHP]

    Hope this helps.

    Regards

    conforturis Friend
    #500227

    Works good!
    Thanks

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

This topic contains 5 replies, has 2 voices, and was last updated by  conforturis 11 years, 3 months ago.

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