public function searchArticleByAuthor($key, $categoryId) { if ($categoryId == 0) { $this->mArticles = Product::SearchArticleByAuthor($key); echo json_encode($this->mArticles); } else { $this->mArticles = Product::SearchCategoryArticleByAuthor($key, $categoryId); echo json_encode($this->mArticles); } }