Authored by yangyang

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into feature/web-list

@@ -78,6 +78,9 @@ class HelperSearch @@ -78,6 +78,9 @@ class HelperSearch
78 self::$options = $options; 78 self::$options = $options;
79 unset(self::$params['page']); 79 unset(self::$params['page']);
80 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array(); 80 self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
  81 + //当前页
  82 + $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
  83 + self::$page = $result['page'];
81 //产品列表 84 //产品列表
82 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array(); 85 $result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array();
83 //总页数 86 //总页数
@@ -88,8 +91,6 @@ class HelperSearch @@ -88,8 +91,6 @@ class HelperSearch
88 if (isset($data['product']['total'])) { 91 if (isset($data['product']['total'])) {
89 self::$total = $data['product']['total']; 92 self::$total = $data['product']['total'];
90 } 93 }
91 - //当前页  
92 - self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';  
93 //筛选条件 94 //筛选条件
94 $result['filters'] = isset($data['product']['filter']) ? self::filter() : array(); 95 $result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
95 //排序方式、显示数量等其他选项 96 //排序方式、显示数量等其他选项
@@ -185,6 +186,10 @@ class HelperSearch @@ -185,6 +186,10 @@ class HelperSearch
185 $isNew = false; 186 $isNew = false;
186 $isSale = false; 187 $isSale = false;
187 } 188 }
  189 + //SALE、NEW标签不共存
  190 + if ($isNew) {
  191 + $isSale = false;
  192 + }
188 $gender = 0; 193 $gender = 0;
189 if (isset(self::$options['gender'])) { 194 if (isset(self::$options['gender'])) {
190 $genderArr = explode(',', self::$options['gender']); 195 $genderArr = explode(',', self::$options['gender']);
@@ -1140,6 +1145,19 @@ class HelperSearch @@ -1140,6 +1145,19 @@ class HelperSearch
1140 } 1145 }
1141 return $next; 1146 return $next;
1142 } 1147 }
  1148 + /**
  1149 + * 上一页
  1150 + */
  1151 + public static function preUrl() {
  1152 + $preUrl = '';
  1153 + $param = self::$params;
  1154 + $page = self::$page;
  1155 + if ($page > 1) {
  1156 + $param['page'] = $page - 1;
  1157 + $preUrl = self::buildUrl($param);
  1158 + }
  1159 + return $preUrl;
  1160 + }
1143 1161
1144 /** 1162 /**
1145 * 组织产品的图片 1163 * 组织产品的图片
@@ -1341,6 +1359,7 @@ class HelperSearch @@ -1341,6 +1359,7 @@ class HelperSearch
1341 $result['pageCounts'] = self::viewNum(); 1359 $result['pageCounts'] = self::viewNum();
1342 $result['curPage'] = self::$page; 1360 $result['curPage'] = self::$page;
1343 $result['pageCount'] = self::$pageTotal; 1361 $result['pageCount'] = self::$pageTotal;
  1362 + $result['preHref'] = self::preUrl();
1344 $result['nextHref'] = ($next = self::next(self::$pageTotal, self::$filter)) ? $next['href'] : ''; 1363 $result['nextHref'] = ($next = self::next(self::$pageTotal, self::$filter)) ? $next['href'] : '';
1345 return $result; 1364 return $result;
1346 } 1365 }
@@ -1364,7 +1383,7 @@ class HelperSearch @@ -1364,7 +1383,7 @@ class HelperSearch
1364 $type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : ''; 1383 $type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : '';
1365 } 1384 }
1366 //新品到着 1385 //新品到着
1367 - elseif ($controller == 'List' && $action == 'new') { 1386 + elseif ($controller == 'list' && $action == 'new') {
1368 if (isset(self::$params['shelve_time'])) { 1387 if (isset(self::$params['shelve_time'])) {
1369 $date = explode(',', self::$params['shelve_time']); 1388 $date = explode(',', self::$params['shelve_time']);
1370 $date = date('Y-m-d', $date[0]); 1389 $date = date('Y-m-d', $date[0]);
@@ -1373,14 +1392,14 @@ class HelperSearch @@ -1373,14 +1392,14 @@ class HelperSearch
1373 } 1392 }
1374 //list - sale 1393 //list - sale
1375 elseif ($controller == 'list' && $action == 'sale') { 1394 elseif ($controller == 'list' && $action == 'sale') {
1376 - $type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9'; 1395 + $type = isset(self::$params['p_d']) && self::$params['p_d'] ? self::$params['p_d'] : '0,0.9';
1377 } 1396 }
1378 elseif ($controller == 'sale' && $action == 'index') { 1397 elseif ($controller == 'sale' && $action == 'index') {
1379 $type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : ''; 1398 $type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : '';
1380 } 1399 }
1381 // 品牌 1400 // 品牌
1382 - elseif ($controller == 'list' && $action == 'sale') {  
1383 - $type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : ''; 1401 + elseif ($controller == 'index' && $action == 'brand') {
  1402 + $type = isset(self::$options['brandId']) && self::$options['brandId'] ? self::$options['brandId'] : '';
1384 } 1403 }
1385 // 搜索 1404 // 搜索
1386 elseif ($controller == 'search') { 1405 elseif ($controller == 'search') {
@@ -24,23 +24,11 @@ var $body = $('body'); @@ -24,23 +24,11 @@ var $body = $('body');
24 24
25 require("js/footer"); 25 require("js/footer");
26 26
27 -  
28 -  
29 function cookie(name) { 27 function cookie(name) {
30 - var cookies = document.cookie,  
31 - cookieVal,  
32 - offset;  
33 -  
34 - if (document.cookie && document.cookie !== '') {  
35 - offset = cookies.indexOf(name + '=');  
36 - if (offset > -1) {  
37 - offset += name.length + 1;  
38 -  
39 - cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));  
40 - }  
41 - } 28 + var re = new RegExp(name + '=([^;$]*)', 'i'),
  29 + matchPattern = '$1';
42 30
43 - return cookieVal; 31 + return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
44 } 32 }
45 33
46 function setCookie(name, value, options) { 34 function setCookie(name, value, options) {
@@ -492,7 +480,7 @@ function actionGoodsCart() { @@ -492,7 +480,7 @@ function actionGoodsCart() {
492 } 480 }
493 481
494 } 482 }
495 - if (cartInfo != null) { 483 + if (cartInfo !== null && cartInfo !== '') {
496 totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac); 484 totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
497 if (totalNum === 0) { 485 if (totalNum === 0) {
498 $('#icart-num').attr('class', 'icart-num icart-none'); 486 $('#icart-num').attr('class', 'icart-num icart-none');
@@ -1159,8 +1147,8 @@ function actionTipPic() { @@ -1159,8 +1147,8 @@ function actionTipPic() {
1159 } 1147 }
1160 } 1148 }
1161 }); 1149 });
1162 - logolink = $('.first-nav-list .cur').find('a').attr('href');  
1163 - $('.main-link').attr('href', link); 1150 + logolink = $('.cure').find('.name-cn').find('a').attr('href');
  1151 + $('.main-link').attr('href', logolink);
1164 } 1152 }
1165 1153
1166 1154
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -10,23 +10,11 @@ var $body = $('body'); @@ -10,23 +10,11 @@ var $body = $('body');
10 10
11 require('./footer'); 11 require('./footer');
12 12
13 -  
14 -  
15 function cookie(name) { 13 function cookie(name) {
16 - var cookies = document.cookie,  
17 - cookieVal,  
18 - offset;  
19 -  
20 - if (document.cookie && document.cookie !== '') {  
21 - offset = cookies.indexOf(name + '=');  
22 - if (offset > -1) {  
23 - offset += name.length + 1;  
24 -  
25 - cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));  
26 - }  
27 - } 14 + var re = new RegExp(name + '=([^;$]*)', 'i'),
  15 + matchPattern = '$1';
28 16
29 - return cookieVal; 17 + return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
30 } 18 }
31 19
32 function setCookie(name, value, options) { 20 function setCookie(name, value, options) {
@@ -157,7 +157,7 @@ function actionGoodsCart() { @@ -157,7 +157,7 @@ function actionGoodsCart() {
157 } 157 }
158 158
159 } 159 }
160 - if (cartInfo != null) { 160 + if (cartInfo !== null && cartInfo !== '') {
161 totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac); 161 totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
162 if (totalNum === 0) { 162 if (totalNum === 0) {
163 $('#icart-num').attr('class', 'icart-num icart-none'); 163 $('#icart-num').attr('class', 'icart-num icart-none');
@@ -824,8 +824,8 @@ function actionTipPic() { @@ -824,8 +824,8 @@ function actionTipPic() {
824 } 824 }
825 } 825 }
826 }); 826 });
827 - logolink = $('.first-nav-list .cur').find('a').attr('href');  
828 - $('.main-link').attr('href', link); 827 + logolink = $('.cure').find('.name-cn').find('a').attr('href');
  828 + $('.main-link').attr('href', logolink);
829 } 829 }
830 830
831 831
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 .good { 18 .good {
19 float: left; 19 float: left;
20 margin-right: 14px; 20 margin-right: 14px;
  21 + width: 150px;
21 } 22 }
22 23
23 img { 24 img {
@@ -58,6 +59,7 @@ @@ -58,6 +59,7 @@
58 59
59 .good { 60 .good {
60 margin-right: 10px; 61 margin-right: 10px;
  62 + width: 195px;
61 } 63 }
62 64
63 img { 65 img {
@@ -57,6 +57,7 @@ class SearchModel @@ -57,6 +57,7 @@ class SearchModel
57 //关键字 57 //关键字
58 if (isset($condition['query']) && !empty($condition['query'])) { 58 if (isset($condition['query']) && !empty($condition['query'])) {
59 $condition['query'] = rawurldecode($condition['query']); 59 $condition['query'] = rawurldecode($condition['query']);
  60 + $condition['query'] = HelperSearch::stripTags($condition['query']);
60 } 61 }
61 //品牌 62 //品牌
62 if (isset($condition['brand']) && !empty($condition['brand'])) { 63 if (isset($condition['brand']) && !empty($condition['brand'])) {