search.html
8.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!--S 产品展示-->
<link type="text/css" rel="stylesheet" href="{url:@static/css/product.css}" />
<script type='text/javascript' src="{url:@static/js/jquery.enlarge.js}"></script>
<script type="text/javascript">
//$("body").addClass("screen_960");
</script>
<div class="nav-bar mt5">
<span class="category-0">搜索结果:</span>
<span class="category-1"><b class="red">"{$keyword}"</b></span>
</div>
<div class="goods-detail mt10 clearfix" style="position: relative;">
<div class="sidebar" style="width:230px;">
<div class="box">
<h2>热销排行榜</h2>
<ul class="content child-category-list ">
{query:name=goods as go join=left join order_goods as ord on (go.id eq ord.goods_id) fields=go.*, sum(ord.goods_nums) as sell_num order = sell_num desc group=go.id limit=10}
<li>
<dl>
<dt class="img tc"><a href="{url:/index/product/id/$item[id]}"><img src="{url:@}{echo:Common::thumb($item['img'],220,220)}" width=220></a></dt>
<dd><a href="{url:/index/product/id/$item[id]}">{$item['name']}</a></dd>
<dd><span class="price">售价:<b class="red">{$currency_symbol}{$item['sell_price']}</b></span><span class="market_price fr">市场价:<s>{$currency_symbol}{$item['market_price']}</s></span></dd>
</dl>
</li>
{/list}
</ul>
</div>
</div>
<div class="content">
<!--S 筛选部分-->
<div id="selector">
<div class="spec-attr box">
<h2><span class="red" style="font-size: 14px;">{$keyword}</span> 商品筛选</h2>
<!--S 分类-->
{query:name=goods_category where=parent_id eq 0}
{if:isset($has_category[$item['id']])}
<dl class="attr clearfix">
<dt class="attr-key">{$item['name']}:</dt>
<dd class="attr-value">
{list:items=$has_category[$item['id']] item=$value}
<a {if:isset($selected['cid']) && $selected['cid']==$value['id']} class="select" {set:$url_tem=str_replace("/cid/$value[id]","",$url);}href="{url:$url_tem}" {else:}href="{url:$url/cid/$value[id]}" {/if} >{$value['name']}({$value['num']})<i></i></a>
{/list}
</dd>
</dl>
{/if}
{/query}
<!--E 分类-->
<!--S 品牌-->
{if:$has_brand}
<dl class="attr clearfix">
<dt class="attr-key">品牌:</dt>
<dd class="attr-value">
{list:items=$has_brand}
<a {if:isset($selected['brand']) && $selected['brand']==$item['id']} class="select" {set:$url_tem=str_replace("/brand/$item[id]","",$url);}href="{url:$url_tem}" {else:}href="{url:$url/brand/$item[id]}" {/if} >{$item['name']}({$brand_num[$item['id']]})<i></i></a>
{/list}
</dd>
</dl>
{/if}
<!--E 品牌-->
<!--S 价格-->
{if:$price_range}
<dl class="attr clearfix">
<dt class="attr-key">价格:</dt>
<dd class="attr-value">
{list:items=$price_range}
<a {if:isset($selected['price']) && $selected['price']==$item} class="select" {set:$url_tem=str_replace("/price/$item","",$url);}href="{url:$url_tem}" {else:}href="{url:$url/price/$item}" {/if} >{if:strpos($item,'-')===false}{$item}以上{else:}{$item}{/if}<i></i></a>
{/list}
</dd>
</dl>
{/if}
<!--E 价格-->
<!--S 规格与属性-->
{list:items=$spec_attr}
<dl class="attr clearfix">
<dt class="attr-key">{$item['name']}:</dt>
<dd class="attr-value">
{list:items=$item['values'] item=$value}
<a {if:isset($selected[$item['id']]) && $selected[$item['id']]==$value['id']} class="select" {set:$url_tem=str_replace("/$item[id]/$value[id]","",$url);}href="{url:$url_tem}" {else:}href="{url:$url/$item[id]/$value[id]}" {/if} >{$value['name']}<i></i></a>
{/list}
</dd>
</dl>
{/list}
<!--E 规格与属性-->
</div>
<div id="select-more">
<div class="attr-extra"><div></div></div>
</div>
</div>
<!--E 筛选部分-->
<!--S 商品部分-->
<div class="mt10 product_show clearfix">
<div class="box " style="margin-left: 12.5px;padding: 4px 0;">
<div class="sort-bar">
<span>排序:</span>
<a href="{url:$url/sort/0}" {if:$sort==0}class="current"{/if}>默认<i></i></a>
<a href="{url:$url/sort/1}" {if:$sort==1}class="current"{/if}>销量<i></i></a>
<a href="{url:$url/sort/2}" {if:$sort==2}class="current"{/if}>评论数<i></i></a>
<a {if:$sort==4} href="{url:$url/sort/3}" class="current-2" {elseif:$sort==3}href="{url:$url/sort/4}" class="current"{else:} href="{url:$url/sort/4}" {/if}>价格<i></i></a>
<a href="{url:$url/sort/5}" {if:$sort==5}class="current"{/if}>最新<i></i></a>
</div>
<div class="page-nav"><b class=" red">共{$goods['page']['total']}个商品</b> {$topPageBar}</div>
</div>
<dl>
<dd>
<ul>
{if:isset($goods['data'])}
{list:items=$goods['data']}
<li>
<dl class="product">
<dt class="img"><a href="{url:/index/product/id/$item[id]}"><img src="{url:@}{echo:Common::thumb($item['img'],220,220)}" width=220></a></dt>
<dd class="title"><a href="{url:/index/product/id/$item[id]}">
{if:$keyword}{echo:preg_replace("/($keyword)/i","<b class='red'>$1</b>",$item['name']);}{else:}{$item['name']}{/if}</a></dd>
<dd><span class="price">{$currency_symbol}{$item['sell_price']}</span><span class="market_price">{$currency_symbol}{$item['market_price']}</span></dd>
</dl>
</li>
{/list}
{/if}
</ul>
</dd>
</dl>
</div>
<div class="page-nav">{$goods['html']}</div>
<!--E 商品部分-->
</div>
</div>
<script>
var attr_extra = '';
$(".attr").each(function(i){
var self = $(this);
if(i>3){
//self.css("display","none");
// attr_extra += self.find(".attr-key:eq(0)").text()+"、";
}
if(self.find(".attr-value").get(0).scrollHeight>self.height()){
var span = $("<div class='o-more'>更多<b></b></div>");
self.append(span);
if(self.find('.select').size()>0){
span.html('收起<b></b>');
span.parent().addClass("unflod");
}
span.on("click",function(){
if($(this).text()=='更多'){
$(this).html('收起<b></b>');
$(this).parent().addClass("unflod");
}
else {
$(this).html('更多<b></b>');
$(this).parent().removeClass("unflod");
}
});
}
});
attr_extra = $(".attr:gt(3) .attr-key").text();
attr_extra = attr_extra.replace(/:/gi,'、');
attr_extra = attr_extra.replace(/、$/gi,'');
if($(".attr:gt(3)").size()>0){
if($(".attr:gt(3)").find(".select").size()>0){
$(".attr:gt(3)").css("display","block");
$(".attr-extra div:eq(0)").html('收起<b></b>');
$(".attr-extra").addClass("unflod");
}else{
$(".attr:gt(3)").css("display","none");
$(".attr-extra div:eq(0)").html('更多选项('+attr_extra+')<b></b>');
$(".attr-extra").removeClass("unflod");
}
}else{
$("#select-more").css("display","none");
}
$(".attr-extra:eq(0)").on("click",function(){
if($(".attr:hidden").size()>0){
$(".attr:gt(3)").css("display","block");
$(".attr-extra div:eq(0)").html('收起<b></b>');
$(".attr-extra").addClass("unflod");
}else{
$(".attr:gt(3)").css("display","none");
$(".attr-extra div:eq(0)").html('更多选项('+attr_extra+')<b></b>');
$(".attr-extra").removeClass("unflod");
}
})
</script>