Exemplo n.º 1
0
 /**
  * created by Yosin
  */
 public function actionSearch()
 {
     $request = new Request();
     if ($request->searchGood != "") {
         $minLength = 2;
         $select = new SelectPDO();
         $select->from("lot", ["lot.*", "user.email", "user.phone"])->join("bid", "id", "lot_id")->join("user", "user_id", "id");
         $results = AbstractModel::search($select, ["title", "description"], $request->searchGood, $minLength, false, true);
     } else {
         $results = [];
     }
     if (!$results) {
         $results = [];
     }
     $this->view->lastGoods = $results;
     $this->view->render('search');
     $this->view->display();
 }
Exemplo n.º 2
0
 public function searchProductWithCategory($request, $category_id)
 {
     $minLength = 2;
     $this->select->from("lot", ["lot.*", "user.first_name", "user.last_Name", "user.phone", "user.email", "category.name"])->where("`lot`.`category_id` = ?", array($category_id))->join("user", "user_id", "id")->join("category", "category_id", "id");
     $result = AbstractModel::search($this->select, ['title', 'description'], $request->searchText, $minLength, false, true);
     return $result;
 }
Exemplo n.º 3
0
 /**
  * search product
  *
  * @param $request
  * @param $id
  * @return array|bool
  */
 public static function searchProduct($request, $id)
 {
     $minLength = 2;
     $field = $request->field;
     if ($field == "lot") {
         $select = new SelectPDO();
         $select->from($field, "*")->where("`user_id` = ?", [$id]);
         $results = AbstractModel::search($select, ["title", "description"], $request->searchText, $minLength = 2, false, true);
     } else {
         if ($field == "bid") {
             $select = new SelectPDO();
             $select->from("lot", ["lot.*", "user.email", "user.phone"])->where("`bid`.`user_id` = ?", [$id])->join("bid", "id", "lot_id")->join("user", "user_id", "id");
             $results = AbstractModel::search($select, ["title", "description"], $request->searchText, $minLength, false, true);
         }
     }
     return $results;
 }