Home > php教程 > php手册 > ShopNC 产品分类搜索功能

ShopNC 产品分类搜索功能

WBOY
Release: 2016-06-06 19:39:42
Original
1116 people have browsed it

ShopNC2014版本默认下不支持以品牌作为关键字的搜索,这段代码可以让品牌作为关键字进行搜索。 演示:http://cnnewyork.com/shop/index.php?act=searchkeyword=阿迪达斯 ShopNC # file: \shop\control\search.phpif ($_GET['keyword'] != '') {// 品牌搜索$mo

ShopNC 2014 版本默认下不支持以品牌作为关键字的搜索,这段代码可以让品牌作为关键字进行搜索。

演示: http://cnnewyork.com/shop/index.php?act=search&op=index&keyword=阿迪达斯

ShopNC

# file: \shop\control\search.php

if ($_GET['keyword'] != '') {
					// 品牌搜索
					$model_brand = Model('brand');
					$condition_brand['brand_name'] = array('like', '%' . $_GET['keyword'] . '%');
					$row_brand = $model_brand->where($condition_brand)->find();
					if ($row_brand) {
						$condition['goods_name|goods_jingle|brand_id'] = array(array('like', '%' . $_GET['keyword'] . '%'), array('eq', intval($row_brand['brand_id'])), 'or');
					} else {
						$condition['goods_name|goods_jingle'] = array('like', '%' . $_GET['keyword'] . '%');
					}
                }
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template