Authored by yangyang

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

... ... @@ -78,6 +78,9 @@ class HelperSearch
self::$options = $options;
unset(self::$params['page']);
self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
//当前页
$result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
self::$page = $result['page'];
//产品列表
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array();
//总页数
... ... @@ -88,8 +91,6 @@ class HelperSearch
if (isset($data['product']['total'])) {
self::$total = $data['product']['total'];
}
//当前页
self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
//筛选条件
$result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
//排序方式、显示数量等其他选项
... ... @@ -185,6 +186,10 @@ class HelperSearch
$isNew = false;
$isSale = false;
}
//SALE、NEW标签不共存
if ($isNew) {
$isSale = false;
}
$gender = 0;
if (isset(self::$options['gender'])) {
$genderArr = explode(',', self::$options['gender']);
... ... @@ -1140,6 +1145,19 @@ class HelperSearch
}
return $next;
}
/**
* 上一页
*/
public static function preUrl() {
$preUrl = '';
$param = self::$params;
$page = self::$page;
if ($page > 1) {
$param['page'] = $page - 1;
$preUrl = self::buildUrl($param);
}
return $preUrl;
}
/**
* 组织产品的图片
... ... @@ -1341,6 +1359,7 @@ class HelperSearch
$result['pageCounts'] = self::viewNum();
$result['curPage'] = self::$page;
$result['pageCount'] = self::$pageTotal;
$result['preHref'] = self::preUrl();
$result['nextHref'] = ($next = self::next(self::$pageTotal, self::$filter)) ? $next['href'] : '';
return $result;
}
... ... @@ -1364,7 +1383,7 @@ class HelperSearch
$type = isset(self::$params['msort']) && self::$params['msort'] ? self::$params['msort'] : '';
}
//新品到着
elseif ($controller == 'List' && $action == 'new') {
elseif ($controller == 'list' && $action == 'new') {
if (isset(self::$params['shelve_time'])) {
$date = explode(',', self::$params['shelve_time']);
$date = date('Y-m-d', $date[0]);
... ... @@ -1373,14 +1392,14 @@ class HelperSearch
}
//list - sale
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
$type = isset(self::$params['p_d']) && self::$params['p_d'] ? self::$params['p_d'] : '0,0.9';
}
elseif ($controller == 'sale' && $action == 'index') {
$type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : '';
}
// 品牌
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
elseif ($controller == 'index' && $action == 'brand') {
$type = isset(self::$options['brandId']) && self::$options['brandId'] ? self::$options['brandId'] : '';
}
// 搜索
elseif ($controller == 'search') {
... ...
... ... @@ -24,23 +24,11 @@ var $body = $('body');
require("js/footer");
function cookie(name) {
var cookies = document.cookie,
cookieVal,
offset;
if (document.cookie && document.cookie !== '') {
offset = cookies.indexOf(name + '=');
if (offset > -1) {
offset += name.length + 1;
cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));
}
}
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
return cookieVal;
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
}
function setCookie(name, value, options) {
... ... @@ -492,7 +480,7 @@ function actionGoodsCart() {
}
}
if (cartInfo != null) {
if (cartInfo !== null && cartInfo !== '') {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
if (totalNum === 0) {
$('#icart-num').attr('class', 'icart-num icart-none');
... ... @@ -1159,8 +1147,8 @@ function actionTipPic() {
}
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
logolink = $('.cure').find('.name-cn').find('a').attr('href');
$('.main-link').attr('href', logolink);
}
... ...
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');
require('./footer');
function cookie(name) {
var cookies = document.cookie,
cookieVal,
offset;
if (document.cookie && document.cookie !== '') {
offset = cookies.indexOf(name + '=');
if (offset > -1) {
offset += name.length + 1;
cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));
}
}
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
return cookieVal;
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
}
function setCookie(name, value, options) {
... ...
... ... @@ -157,7 +157,7 @@ function actionGoodsCart() {
}
}
if (cartInfo != null) {
if (cartInfo !== null && cartInfo !== '') {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
if (totalNum === 0) {
$('#icart-num').attr('class', 'icart-num icart-none');
... ... @@ -824,8 +824,8 @@ function actionTipPic() {
}
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
logolink = $('.cure').find('.name-cn').find('a').attr('href');
$('.main-link').attr('href', logolink);
}
... ...
... ... @@ -18,6 +18,7 @@
.good {
float: left;
margin-right: 14px;
width: 150px;
}
img {
... ... @@ -58,6 +59,7 @@
.good {
margin-right: 10px;
width: 195px;
}
img {
... ...
... ... @@ -57,6 +57,7 @@ class SearchModel
//关键字
if (isset($condition['query']) && !empty($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
$condition['query'] = HelperSearch::stripTags($condition['query']);
}
//品牌
if (isset($condition['brand']) && !empty($condition['brand'])) {
... ...