[Помогите] Дописать параметр в поиск

Тема в разделе "OpenCart", создана пользователем nick885, 25 фев 2015.

  1. nick885

    nick885

    Регистрация:
    14 мар 2013
    Сообщения:
    101
    Симпатии:
    40
    Друзья, есть вот такой поиск:
    Код:
    <?phpclass ControllerSearchAutocomplete extends Controller {
    public function index() {
    $json = array();if (isset($this->request->get['filter_name'])) {
    $this->load->model('catalog/product');$this->load->model('tool/image');if (isset($this->request->get['filter_name'])) {
    $filter_name = $this->request->get['filter_name'];} else {
    $filter_name = '';}
    
    $data = array(
    'filter_name' => $filter_name,'start' => 0,'limit' => 5);$results = $this->model_catalog_product->getProducts($data);foreach ($results as $result) {
    if ($result['image']) {
    $image = $this->model_tool_image->resize($result['image'],100, 100);} else {
    $image = false;}
    
    if ($this->config->get('config_review_status')) {
    $rating = $result['rating'];} else {
    $rating = false;}
    
    if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));} else {
    $price = false;}
    
    if ((float)$result['special']) {
    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));} else {
    $special = false;}
    
    $json[] = array(
    'product_id' => $result['product_id'],'thumb' => $image,'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),'desc' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 45) . '..','price' => $price,'href' => html_entity_decode($this->url->link('product/product', 'product_id=' . $result['product_id']), ENT_QUOTES, 'UTF-8'),);}
    }
    
    $this->response->setOutput(json_encode($json));}
    }
    ?>
    
    Подскажите, как дополнить
    $json[] = array что была выборка и с опций продукта.
    Заранее большое спасибо.
     
  2. black_kasper

    black_kasper

    Регистрация:
    5 окт 2013
    Сообщения:
    82
    Симпатии:
    45
  3. Bogdan

    Bogdan

    Регистрация:
    25 фев 2013
    Сообщения:
    228
    Симпатии:
    104
    Просто изменением запроса этот вопрос не решить, так как метод model_catalog_product->getProducts умеет фильтровать только по имени и тегам.
    Если добавите в запросе 'filter_description' => true, то будет искать еще и в описании товара.
     
    KirillLyubimov и black_kasper нравится это.