public function cat($url, $offset = 0, $limit = 10) { $url = $this->uri->segment(2); if ($this->lang->lang() == "vi") { $productCat = new productCat(); $productCat->where("url_vietnamese", $url); $productCat->get(); if (!$productCat->exists()) { redirect(""); } $url = $this->uri->segment(3); $productCatSub = new productCat(); $productCatSub->where("url_vietnamese", $url); $productCatSub->where("parentcat_id", $productCat->id); $productCatSub->get(); if (!$productCatSub->exists()) { redirect(""); } $this->page_title = $productCatSub->seo_title_vietnamese; $this->page_description = $productCatSub->seo_description_vietnamese . ' - Trang ' . $this->getPageNumber($page); $this->page_keyword = $productCatSub->seo_keyword_vietnamese; } if ($this->lang->lang() == "en") { $productCat = new productCat(); $productCat->where("url_english", $url); $productCat->get(); if (!$productCat->exists()) { redirect(""); } $url = $this->uri->segment(3); $productCatSub = new productCat(); $productCatSub->where("url_english", $url); $productCatSub->where("parentcat_id", $productCat->id); $productCatSub->get(); if (!$productCatSub->exists()) { redirect(""); } $this->page_title = $productCatSub->seo_title_english; $this->page_description = $productCatSub->seo_description_english . ' - Trang ' . $this->getPageNumber($page); $this->page_keyword = $productCatSub->seo_keyword_english; } $dis['productCat'] = $productCat; $dis['productCatSub'] = $productCatSub; // get products $product = new Product(); $product->order_by('id', 'desc'); $product->where('productcat_id', $productCatSub->id); $product->get_iterated(); $dis['product'] = $product; // pass data to view $dis['base_url'] = base_url(); $dis['view'] = 'front/product/product_grid'; $this->viewfront($dis); }