public static function showList($cat_id = 0) { $productService = new ProductService(); $root_category_id = $productService->getRootCategoryId(); $cat_list_arr = $productService->getCategoriesList($cat_id); //stores the product count in each category.. $productService->getCountForProducts(); $cat_list = $productService->populateProductCategoryList($cat_id); $productService->setProductOrderBy(\Input::get('orderby_field')); $q = $productService->buildProductQuery($cat_id); $list_prod_serviceobj = $productService; $perPage = \Config::get('webshoppack::product_per_page_list'); $product_details = $q->paginate($perPage); $product_total_count = $product_details->getTotal(); $category_name = ""; if ($cat_id > 0) { $category_name = $productService->getCategoryName($cat_id); } $subcat = false; if ($cat_id > 0) { $subcat = true; } return \View::make(\Config::get('webshoppack::product_list'), compact('cat_list', 'product_details', 'cat_list_arr', 'subcat', 'product_total_count', 'category_name', 'list_prod_serviceobj')); }