Example #1
0
 public function actionIndex($id = '')
 {
     $id = $this->checkCategoryId($id);
     $categories = Category::model()->getFrontendCategories($id);
     if ($id == 0) {
         $listings = array();
     } else {
         $listings = Listing::model()->getFrontendListings($id);
     }
     Yii::app()->user->setCategoryId($id);
     if (Category::model()->isParentCategory($id)) {
         ViewsTrack::addCategoryView($id);
     } else {
         ViewsTrack::addSubCategoryView($id);
     }
     $this->render('index', array('categories' => $categories, 'listings' => $listings, 'categoryId' => $id));
 }