在实现按价格排序问题上需要有前台链接,然后在后台实现对应的功能即可。

前台代码:\include\template\team_multi.html

此模板因为我们是开启了在首页显示和多项团购显示,所以用team_multi.html这个模板

代码如下:
<div class=”filter-by-group-title”>按价格:</div>
<div class=”filter-by-group-id”>
<ul class=”cates”>
<li
<!–{if $selector_p == ”}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}”>全部</a>
</li>
<li
<!–{if $selector_p == ‘p1’}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}&p=p1″>10元以下</a>
</li>
<li
<!–{if $selector_p == ‘p2’}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}&p=p2″>10-50元</a>
</li>
<li
<!–{if $selector_p == ‘p3’}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}&p=p3″>50-100元</a>
</li>
<li
<!–{if $selector_p == ‘p4’}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}&p=p4″>100-200元</a>
</li>
<li
<!–{if $selector_p == ‘p5’}–>
class=”current”
<!–{/if}–>
><a href=”?gid={$_GET[‘gid’]}&areaid={$_GET[‘areaid’]}&p=p5″>200元以上</a>
</li>
</ul>
</div>
</div>

后台代码:\include\function\common.php
index_get_team 函数 修改后的代码

代码如下:
function index_get_team($city_id,$group_id=0,$p=””) {
global $INI;
$multi = option_yes(‘indexmulti’);
$city_id = abs(intval($city_id));

if (!$multi) return current_team($city_id);
$now = time();
$size = abs(intval($INI[‘system’][‘indexteam’]));

if ($size<=1) return current_team($city_id);
switch ($p)
{
case “p1″:
$pp1=”team_price < ’10′”;
$pp2=””;
break;
case “p2″:
$pp1=”team_price > ’10′”;
$pp2=”team_price < ’50′”;
break;
case “p3″:
$pp1=”team_price > ’50′”;
$pp2=”team_price < ‘100’”;
break;
case “p4″:
$pp1=”team_price > ‘100’”;
$pp2=”team_price < ‘200’”;
break;
case “p5″:
$pp1=”team_price > ‘200’”;
$pp2=””;
break;
default:
$pp1=””;
$pp2=””;
}
$oc = array(
‘team_type’ => ‘normal’,
“begin_time < ‘{$now}'”,
“end_time > ‘{$now}'”,
);
if(!empty($pp1)){
array_push($oc,$pp1);
}
if(!empty($pp2)){
array_push($oc,$pp2);
}
if($group_id) $oc[‘group_id’]=$group_id;

$oc[] = “(city_ids like ‘%@{$city_id}@%’ or city_ids like ‘%@0@%’) or (city_ids = ” and city_id in(0,{$city_id}))”;
$teams = DB::LimitQuery(‘team’, array(
‘condition’ => $oc,
‘order’ => ‘ORDER BY `sort_order` DESC, `id` DESC’,
‘size’ => $size,
));
if(count($teams) == 1) return array_pop($teams);
return $teams;
}

需要在index.php页面中增加一个
$selector_p=$p=addslashes($_GET[‘p’]);方面当前价格的高亮。
结合以上几点,即可实现最土团购ZuituGo_CV2.0_20111231 商业版的价格排序功能。

1.本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2.分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3.不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4.本站提供的源码、模板、插件等其他资源,都不包含技术服务请大家谅解!
5.如有链接无法下载或失效,请联系管理员处理!
6.本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!