dedecms联动类别查询

原创
2014/04/06 00:13
阅读数 1.3K

今天大象哥写了个联动类别的查询共享出来

//枚举查询
function get_enum($topvalue,$egroup = 'shoptype'){
	global $dsql;//商品枚举
	//一级枚举
	$orderby = 'ORDER BY disorder ASC, evalue ASC';

	if ($topvalue == 'all'){//取全部枚举
		$egroupsql = " WHERE egroup LIKE '$egroup'";
	} elseif(!$topvalue){//取一级枚举
		$egroupsql = " WHERE egroup LIKE '$egroup' AND egroup='$egroup' AND (evalue MOD 500)=0";	
	} elseif($topvalue % 500 == 0){//取二级枚举
		$egroupsql = " WHERE egroup LIKE '$egroup' AND evalue>=$topvalue AND evalue < ".($topvalue + 500);	
	} else { //取三级枚举
		$egroupsql = " WHERE (evalue LIKE '$topvalue.%%%' OR evalue=$topvalue) AND egroup LIKE '$egroup'";
	}
	$sql = "SELECT * FROM `#@__sys_enum` $egroupsql $orderby";
	echo $sql;
}



只有三级枚举,等有空搞搞多级枚举

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
4 收藏
0
分享
返回顶部
顶部