您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop搜索商品货号搜索商品属性货号的实现方法
涵柏2024-05-13 23:02:17ecshop商城教程已有人查阅
导读ECSHOP商城支持商品名称关键字,商品货号关键字等搜索商品,但不能按属性货号搜索。属性货号是ecshop属性库存的识别号,建立属性库存后,属性货号保存在products表中
ECSHOP商城支持商品名称关键字,商品货号关键字等搜索商品,但不能按属性货号搜索。属性货号是ecshop属性库存的识别号,建立属性库存后,属性货号保存在products表中,代码号提供可按商品属 货号关键字搜索方法教程。
一、打开ECSHOP商城根目录找到search.php文件修改搜索关键字变量,添加属性货号关键字product_sn。
一、打开ECSHOP商城根目录找到search.php文件修改搜索关键字变量,添加属性货号关键字product_sn。
$keywords .= "(goods_name LIKE '%$val%' OR goods_sn LIKE '%$val%' OR keywords LIKE '%$val%' $sc_dsad)";
修改成:
$keywords .= "(goods_name LIKE '%$val%' OR goods_sn LIKE '%$val%' OR product_sn LIKE '%$val%' OR keywords LIKE '%$val%' $sc_dsad)"; //ebingou.cn添加按属性货号product_sn查询
二、修改商品总数SQL语句,添加goods表与products表连接查询。
/* 获得符合条件的商品总数 */
$sql = "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".
"WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";
修改成:
/* 代码号ebingou.cn获得符合条件的商品总数 */
$sql = "SELECT COUNT(*) FROM " .$ecs->table('goods'). " AS g ".
"LEFT JOIN " . $GLOBALS['ecs']->table('products') . " AS p ".
"ON g.goods_id = p.goods_id ".
"WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock ." ) ".$tag_where." )";
三、修改商品查询SQL语句,添加goods表与products表连接查询。
/* 查询商品 */
$sql = "SELECT g.goods_id, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
"g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
"FROM " .$ecs->table('goods'). " AS g ".
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
"WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
"ORDER BY $sort $order";
修改成:
/* 代码号ebingou.cn查询商品 */
$sql = "SELECT g.goods_id, g.goods_name, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ".
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
"g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".
"FROM " .$ecs->table('goods'). " AS g ".
"LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ".
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ".
"LEFT JOIN " . $GLOBALS['ecs']->table('products') . " AS p ".
"ON g.goods_id = p.goods_id ".
"WHERE g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".
"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .
"ORDER BY $sort $order";
本文标签:
很赞哦! ()
随机图文
-
ecshop怎么样合并商品分类
这是一个基本操作的问题。有人问起这样的问题:如何合并商品分类,例如将A类商品合并到B类? -
ecshop后台添加新功能栏目权限管理管理员列表权限控制
ECSHOP后台添加新功能栏目权限管理管理员列表权限控制一、添加菜单项 打开 /admin/includes/inc_menu.php文件( -
ecshop循环中实现套用调取广告位的方法
在做某客户ECSHOP模板活动列表页面时,添加活动列表的时候,需要添加广告,可是该怎么调用广告位呢?现在ECSHOP代码号来告诉你,怎样轻松循环中调 -
ecshop订单批量导出导成成excel格式
各位ECSHOP网店系统用户大家好,欢迎来到代码号图文教程,今天为大家详细解说一下ECSHOP订单批量导出订单列表订单导成成excel格式。
留言与评论 (共有 条评论) |