public function GetProduct($category, $subcategory, $product_id)
 {
     $translatedCategory = Category::TranslateCategoryName($category);
     $translatedSubcategory = Category::TranslateSubcategoryName($subcategory);
     if (count($translatedCategory) == 0 || count($translatedSubcategory) == 0) {
         return Redirect::to("/");
     }
     $catID = $translatedCategory[0]->category_id;
     $subID = $translatedSubcategory[0]->sub_category_id;
     $product = Product::GetProduct($catID, $subID, $product_id);
     if (count($product) == 0) {
         return Redirect::to("/");
     }
     $pageInfo = ["categoryName" => $translatedCategory[0]->category_name, "subcategoryName" => $translatedSubcategory[0]->sub_category_name, "productName" => $product[0]->product_name, "categoryEngName" => $category, "subcategoryEngName" => $subcategory, "productId" => $product_id];
     //if the product has different models get them
     if ($product[0]->has_models == 1) {
         $product_models = Product::GetProductModels($product[0]->product_id);
         $data["product_models"] = $product_models;
         $pageInfo["has_models"] = "1";
     } else {
         $pageInfo["has_models"] = "0";
     }
     $data["pageInfo"] = $pageInfo;
     $data["product_info"] = $product;
     return view("single_product", ["data" => $data]);
 }
 public function GetMainAndSubCategory($category, $sub_category)
 {
     $category_subCategory = Category::GetCategoryAndSubcategoryInfo($category, $sub_category);
     if (count($category_subCategory) == 0) {
         return Redirect::to("/");
     }
     $translatedCategory = Category::TranslateCategoryName($category);
     $translatedSubcategory = Category::TranslateSubcategoryName($sub_category);
     $sub_categories = Category::GetSubCategories($category_subCategory[0]->category_id);
     $newest_products = Product::GetProductsByMainAndSubCategory($translatedCategory[0]->category_id, $translatedSubcategory[0]->sub_category_id);
     $data["newest_products"] = $newest_products;
     $data["sub_info"] = $category_subCategory;
     $data["sub_categories"] = $sub_categories;
     return view("sub_category", ["data" => $data]);
 }