private function search($search) { $res = CompanyModel::Search($search, $this->region_id, $this->group_id, $this->result_per_page, ($this->page - 1) * $this->result_per_page); if (SQL::Count() == 0 and $this->group_id + $this->region_id > 0 and $search != '') { $this->region_id = 0; $this->group_id = 0; $res = CompanyModel::search($search, 0, 0, $this->page, ($this->page - 1) * $this->result_per_page); if (SQL::Count() > 0) { Site::Message('Мы не нашли ничего в выбранных вами группах, но похоже что-то нашлось тут.'); } } if (SQL::Count() == 0) { return $this->filter($search); } return $res; }