Чтобы добавить поиск по модели и SKU (артикулу), надо модифицировать один файл (вариант для версий 1.5.0.5 - 1.5.1.2 и может более ранних 1.5.x): Код: commit 56a765ccb474075b7073f11474100e2251e0d762 Author: Ruslan Brest <[email protected]> Date: Mon Sep 5 11:55:51 2011 +0300 [+] catalog: search: добавлен поиск по модели и SKU diff --git a/public_html/catalog/model/catalog/product.php b/public_html/catalog/model/catalog/product.php index 520bc34..e9a3d73 100644 --- a/public_html/catalog/model/catalog/product.php +++ b/public_html/catalog/model/catalog/product.php @@ -106,10 +106,12 @@ class ModelCatalogProduct extends Model { . (int)$this->config->get('config_store_id') . "'"; if (isset($data['filter_name']) && $data['filter_name']) { + $sFilterName = $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')); + $sql_search_model_sku = 'LCASE(p.model) LIKE "%' . $sFilterName . '%" OR LCASE(p.sku) LIKE "%' . $sFilterName . '%"'; if (isset($data['filter_description']) && $data['filter_description']) { - $sql .= " AND (LCASE(pd.name) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%' OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%') OR LCASE(pd.description) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%')"; + $sql .= " AND (".$sql_search_model_sku." OR LCASE(pd.name) LIKE '%" . $sFilterName . "%' OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE '%" . $sFilterName . "%') OR LCASE(pd.description) LIKE '%" . $sFilterName . "%')"; } else { - $sql .= " AND (LCASE(pd.name) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%' OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE '%" . $this->db->escape(mb_strtolower($data['filter_name'], 'UTF-8')) . "%'))"; + $sql .= " AND (".$sql_search_model_sku." OR LCASE(pd.name) LIKE '%" . $sFilterName . "%' OR p.product_id IN (SELECT pt.product_id FROM " . DB_PREFIX . "product_tag pt WHERE pt.language_id = '" . (int)$this->config->get('config_language_id') . "' AND LCASE(pt.tag) LIKE '%" . $sFilterName . "%'))"; Поиск по модели и SKU (артикулу) - вариант для версии 1.5.1.3 (и наверное выше): Код: commit 77611b6dcad3fb21484c889bb7726688cb68de34 Author: Ruslan Brest <[email protected]> Date: Mon Oct 10 11:58:24 2011 +0300 [+] catalog: search by model and SKU diff --git a/upload/catalog/model/catalog/product.php b/upload/catalog/model/catalog/product.php index 25a7861..a9ed128 100644 --- a/upload/catalog/model/catalog/product.php +++ b/upload/catalog/model/catalog/product.php @@ -54,13 +54,19 @@ class ModelCatalogProduct extends Model { $implode = array(); $words = explode(' ', $data['filter_name']); foreach ($words as $word) { - if (!empty($data['filter_description'])) { - $implode[] = "LCASE(pd.name) LIKE '%" . $this->db->escape(utf8_strtolower($word)) . "%' OR LCASE(pd.description) LIKE '%" . $this->db->escape(utf8_strtolower($word)) . "%'"; - } else { - $implode[] = "LCASE(pd.name) LIKE '%" . $this->db->escape(utf8_strtolower($word)) . "%'"; - } + if( !empty($word) ) + { + $lword = $this->db->escape(utf8_strtolower(trim($word))); + // Add search by model and SKU + $implode[] = 'LCASE(p.model) LIKE "%' . $lword . '%" OR LCASE(p.sku) LIKE "%' . $lword . '%"'; + if (!empty($data['filter_description'])) { + $implode[] = "LCASE(pd.name) LIKE '%" . $lword . "%' OR LCASE(pd.description) LIKE '%" . $lword . "%'"; + } else { + $implode[] = "LCASE(pd.name) LIKE '%" . $lword . "%'"; + } + } } if ($implode) { Источник, комменты, код -
Ну или как вариант поставить вот этот модуль, там можно отдельно выбирать где искать http://opencartforum.ru/files/file/246-search-ajax-ajax-поиск-товаров/
Savok32, на oc extensions мод добавляет sku и модель в поиск - This little MOD adds sku and model product's fields to the search criteria:
Savok32, Batch Editor можно поставить или можно использовать решение отсюда (если маг новый) или править код ручками -