Skip to content

ContentList not filtering based on language selection #13

@dawidpjoubert

Description

@dawidpjoubert

Hi,

The ability to filter on language selection is not implemented at all. In the file GxcHelpers.php within method getContentList() you need to update the code to be as follows:

                        $condition .= ' or (object_id in (select object_id from `{{tag_relationships}}` where tag_id in (' . $tag_id_list . ')))';
                    }

                    //criteria not newest
                    if ($model->criteria != ConstantDefine::CONTENT_LIST_CRITERIA_NEWEST) {
                        $criteria_field = 'object_view DESC';                                             
                    } 

                    $criteria = new CdBCriteria(array(
                        'condition'=>$condition,
                        'params'=>$params,
                        'order'=>$criteria_field,
                        'limit'=>isset($max)?$max:$model->number,                                
                    ));


                    // Language constraints. ID#0 means all languages so we only apply the conditional if the ID#0 is not set.
                    if (!in_array(0, $model->lang)) $criteria->addInCondition('lang', $model->lang);

                    if ($return_type == ConstantDefine::CONTENT_LIST_RETURN_DATA_PROVIDER && $model->number >=1) { 

                        $sort = new CSort('Object');
                        $sort->defaultOrder='t.object_date DESC';
                        $sort->attributes = array('object_view' => array('asc'=>'object_view ASC',
                                                                         'desc'=>'object_view DESC',
                                                                        ),
                                                  'object_date'=>array('asc'=>'t.object_date ASC',
                                                                       'desc'=>'t.object_date DESC',
                                                                      ),
                                                );                    

                        return new CActiveDataProvider('Object',array(
                                'criteria'=> $criteria,
                                'pagination'=>array('pageSize' => isset($max) ? $max : $model->number * $page_number, 'pageVar'=>'page'),
                                'sort'=>$sort,
                        ));
                    }

                    return Object::model()->findAll($criteria);
                }
                else {
                    //manual

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions