Можно немного дописать поисковую систему PrestaShop:
Откройте файл
/controllers/front/SearchController.php и после:
Код:
elseif (($tag = urldecode(Tools::getValue('tag'))) && !is_array($tag))
{
$nbProducts = (int)(Search::searchTag($this->context->language->id, $tag, true));
$this->pagination($nbProducts);
$result = Search::searchTag($this->context->language->id, $tag, false, $this->p, $this->n, $this->orderBy, $this->orderWay);
Hook::exec('actionSearch', array('expr' => $tag, 'total' => count($result)));
$this->addColorsToProductList($result);
$this->context->smarty->assign(array(
'search_tag' => $tag,
'products' => $result,
'search_products' => $result,
'nbProducts' => $nbProducts,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))));
}
добавьте подобный код:
Код:
elseif (($fv = urldecode(Tools::getValue('fv'))) && !is_array($fv))
{
if (!Validate::isGenericName($fv))
return false;
if ($fvid = Db::getInstance()->getValue('SELECT * FROM `'._DB_PREFIX_.'feature_value_lang` WHERE `value` = \''.pSQL($fv).'\' AND `id_lang` = '.(int)$this->context->language->id))
{
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, pl.`available_now`, pl.`available_later`,
m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
MAX(image_shop.`id_image`) id_image, il.`legend`, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
INTERVAL '.Configuration::get('PS_NB_DAYS_NEW_PRODUCT').' DAY)) > 0 AS new
FROM `'._DB_PREFIX_.'feature_product` fp
LEFT JOIN `'._DB_PREFIX_.'product` p ON fp.`id_product` = p.`id_product`
'.Shop::addSqlAssociation('product', 'p', false).'
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.$this->context->language->id.Shop::addSqlRestrictionOnLang('pl').'
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
AND tr.`id_state` = 0
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
'.Product::sqlStock('p').'
WHERE product_shop.`active` = 1
AND p.`visibility` != \'none\'
AND fp.`id_feature_value` = '.$fvid.'
GROUP BY product_shop.id_product';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
if (!$result)
return false;
$result = Product::getProductsProperties($this->context->language->id, $result);
$nbProducts = sizeof($result);
$this->pagination($nbProducts);
$this->addColorsToProductList($result);
$this->context->smarty->assign(array(
'search_tag' => $fv,
'search_products' => $result,
'nbProducts' => $nbProducts,
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
));
}
}
Далее можно тестировать через:
Код:
домен.ру/search?fv=Polyester