public function searchArticleByKeyword($key, $categoryId) { if ($categoryId == 0) { $this->mArticles = Product::SearchArticleByKeyword($key); echo json_encode($this->mArticles); } else { $this->mArticles = Product::SearchCategoryArticleByKeyword($key, $categoryId); echo json_encode($this->mArticles); } }