Authored by wangqing

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

... ... @@ -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']);
... ... @@ -391,8 +396,10 @@ class HelperSearch
$sortList[$key]['active'] = isset(self::$params['msort']) && self::$params['msort'] == $val['sort_id'] ? true : false;
$sortList[$key]['childList'][] = array(
'name' => '全部'.$val['sort_name'],
'href' => self::buildUrl(array_merge($gender, array('msort'=>$val['sort_id'])))
'href' => self::buildUrl(array_merge($gender, array('msort'=>$val['sort_id']))),
'childActive' => isset(self::$params['msort']) && !isset(self::$params['misort']) && self::$params['msort'] == $val['sort_id'] ? true : false
);
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$sortList[$key]['childList'][$k+1]['name'] = $v['sort_name'];
... ... @@ -988,7 +995,7 @@ class HelperSearch
$url = self::buildUrl(array_merge($params, array(
'order' => 'p_d_desc'
)));
$desc = true;
$desc = false;
$active = true;
}
else {
... ... @@ -1138,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;
}
/**
* 组织产品的图片
... ... @@ -1339,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;
}
... ... @@ -1362,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]);
... ... @@ -1371,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') {
... ...
... ... @@ -38,6 +38,11 @@
</div>
<div class="good-detail-text">
<a href="{{url}}" target="_blank">{{{name}}}</a>
{{#brand}}
<p class="brand">
<a href="{{url}}">{{name}}</a>
</p>
{{/brand}}
<p class="price">
{{# marketPrice}}
<span class="market-price">¥{{.}}</span>
... ... @@ -47,4 +52,4 @@
</span>
</p>
</div>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -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,7 +1147,7 @@ function actionTipPic() {
}
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
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.
... ... @@ -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');
... ...
... ... @@ -50,7 +50,14 @@
}
> .price {
margin-top: 10px;
margin-top: 5px;
}
.brand {
a {
color: #666;
line-height: 1.5;
}
}
.market-price {
... ...
... ... @@ -18,6 +18,7 @@
.good {
float: left;
margin-right: 14px;
width: 150px;
}
img {
... ... @@ -58,6 +59,7 @@
.good {
margin-right: 10px;
width: 195px;
}
img {
... ...
... ... @@ -23,7 +23,7 @@ class IndexModel
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
$urlList['sort'] = SearchData::getClassesUrl();
//批量调接口获取数据
$result = Yohobuy::getMulti($urlList);
... ...
... ... @@ -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'])) {
... ... @@ -157,7 +158,6 @@ class SearchModel
// 组合搜索商品url
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
//$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
$urlList['sort'] = SearchData::getClassesUrl();
// 组合搜索折扣区间url
$urlList['discount'] = SearchData::getDiscountUrl();
... ...
... ... @@ -70,4 +70,4 @@ class SearchController extends WebAction
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
}
\ No newline at end of file
}
... ...