Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
周少峰
9 years ago
Commit
ad6dc6ef0a1a97059375467100c4edf24ee0a260
1 parent
ac4c3f85
bug 修改
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
19 deletions
library/WebPlugin/HelperSearch.php
yohobuy/www.yohobuy.com/application/models/Product/Search.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Search.php
library/WebPlugin/HelperSearch.php
View file @
ad6dc6e
...
...
@@ -20,15 +20,16 @@ class HelperSearch
public
static
$options
=
array
();
//当前页
public
static
$page
=
1
;
//总页数
public
static
$pageTotal
;
//总记录数
public
static
$total
;
//接口返回搜索条件
public
static
$filter
;
//选中的条件
public
static
$selected
=
array
();
//list分类面包屑
public
static
$listNav
=
array
();
//设置导航
private
static
function
setListNav
()
{
...
...
@@ -81,9 +82,9 @@ class HelperSearch
//总页数
$result
[
'page_total'
]
=
isset
(
$data
[
'product'
][
'page_total'
])
?
$data
[
'product'
][
'page_total'
]
:
''
;
self
::
$pageTotal
=
$result
[
'page_total'
];
self
::
$total
=
$data
[
'product'
][
'total'
];
//当前页
$result
[
'page'
]
=
isset
(
$data
[
'product'
][
'page'
])
?
$data
[
'product'
][
'page'
]
:
''
;
self
::
$page
=
$result
[
'page'
];
self
::
$page
=
$result
[
'page'
]
=
isset
(
$data
[
'product'
][
'page'
])
?
$data
[
'product'
][
'page'
]
:
''
;
//筛选条件
$result
[
'filters'
]
=
isset
(
$data
[
'product'
][
'filter'
])
?
self
::
filter
()
:
array
();
//排序方式、显示数量等其他选项
...
...
@@ -148,7 +149,7 @@ class HelperSearch
* @author sefon 2015-12-21 17:24:04
* @return array
*/
public
static
function
getProductList
(
$product
,
$imgSize
)
public
static
function
getProductList
(
$product
,
$imgSize
)
{
$params
=
self
::
$params
;
$goods
=
array
();
...
...
@@ -163,12 +164,23 @@ class HelperSearch
//即将售罄
$isFew
=
$val
[
'is_soon_sold_out'
]
===
'Y'
?
true
:
false
;
//SALE
$isSale
=
(
$val
[
'is_discount'
]
==
'Y'
)
?
true
:
false
;
//新品节
//再到着
//年终大促
// 年中大促
$gender
=
isset
(
self
::
$options
[
'gender'
])
?
explode
(
','
,
self
::
$options
[
'gender'
])[
0
]
:
0
;
foreach
(
$val
[
'goods_list'
]
as
$k
=>
$v
){
$goods_list
[
$k
][
'url'
]
=
Helpers
::
getUrlBySkc
(
$val
[
'product_id'
],
$v
[
'goods_id'
],
$val
[
'cn_alphabet'
]);
//女封
if
(
isset
(
$v
[
'cover_1'
])
&&
$gender
==
1
)
{
$val
[
'default_images'
]
=
$v
[
'images_url'
];
}
//男封
if
(
isset
(
$v
[
'cover_2'
])
&&
$gender
==
2
)
{
$val
[
'default_images'
]
=
$v
[
'images_url'
];
}
//筛选符合颜色条件的封面图片
if
(
isset
(
$params
[
'color'
])
&&
$params
[
'color'
]
==
$v
[
'color_id'
])
{
$val
[
'default_images'
]
=
$v
[
'images_url'
];
...
...
@@ -182,7 +194,8 @@ class HelperSearch
$good
=
array
(
'tags'
=>
array
(
'isNew'
=>
$isNew
,
'isLimit'
=>
$isLimit
'isLimit'
=>
$isLimit
,
'isSale'
=>
$isSale
),
'url'
=>
self
::
fromPram
(
$goods_list
[
0
][
'url'
],
++
$key
),
'thumb'
=>
$val
[
'default_images'
],
...
...
@@ -425,7 +438,7 @@ class HelperSearch
//已选中品牌数量
$existBrandNum
=
0
;
//已选中品牌标签名
$existName
=
''
;
$existName
=
array
()
;
foreach
(
$brand
as
$key
=>
$v
)
{
$selectBrandIds
=
$brandIds
;
//品牌已被选中
...
...
@@ -436,10 +449,10 @@ class HelperSearch
'brand'
=>
implode
(
','
,
$selectBrandIds
)
)));
if
(
$existBrandNum
===
0
)
{
$existName
.=
$v
[
'brand_name'
]
.
'、'
;
$existName
[]
=
$v
[
'brand_name'
]
;
}
if
(
$existBrandNum
===
1
){
$existName
.
=
substr
(
$v
[
'brand_name'
],
0
,
3
)
.
'...'
;
$existName
[]
=
substr
(
$v
[
'brand_name'
],
0
,
3
)
.
'...'
;
}
$existBrandNum
++
;
}
...
...
@@ -477,7 +490,7 @@ class HelperSearch
//设置选中
if
(
isset
(
self
::
$params
[
'brand'
])
&&
!
empty
(
self
::
$params
[
'brand'
]))
{
self
::
$selected
[
'brand'
]
=
array
(
'name'
=>
rtrim
(
$existName
,
'、'
),
'name'
=>
implode
(
$existName
,
'、'
),
'href'
=>
self
::
buildUrl
(
$params
)
);
}
...
...
@@ -490,7 +503,6 @@ class HelperSearch
$result
[
'brandIndex'
][]
=
$index
;
}
unset
(
$brandList
);
//搜索页已选中,返回空
if
(
self
::
checkSearch
(
'brand'
))
{
return
array
();
...
...
@@ -589,12 +601,16 @@ class HelperSearch
*/
public static function price(
$filter
)
{
$result
= array();
//商品记录小于10,不显示价格区间
if (self::
$total
< 10) {
return
$result
;
}
$params
= self::
$params
;
$priceId
= isset(
$params['price']
) && !empty(self::
$params['price']
) ? self::
$params['price']
: '';
if (isset(
$params['price']
)) {
unset(
$params['price']
);
}
$result
= array();
//设置已选中价格
if (!empty(
$priceId
)) {
$price
= explode(',' ,
$priceId
);
...
...
yohobuy/www.yohobuy.com/application/models/Product/Search.php
View file @
ad6dc6e
...
...
@@ -150,8 +150,7 @@ class SearchModel
$urlList
[
'sort'
]
=
SearchData
::
getClassesUrl
(
$searchCondition
[
'sortCondition'
]);
// 组合搜索折扣区间url
$urlList
[
'discount'
]
=
SearchData
::
getDiscountUrl
(
$searchCondition
[
'condition'
]);
$result
=
Yohobuy
::
getMulti
(
$urlList
,
array
(),
true
);
$result
=
Yohobuy
::
getMulti
(
$urlList
);
// 组织模板数据
$data
=
HelperSearch
::
getList
(
$result
,
$searchCondition
[
'options'
]);
return
$data
;
...
...
@@ -187,7 +186,7 @@ class SearchModel
$param
[
'keyword'
]
=
$searchCondition
[
'condition'
][
'query'
];
$urlList
[
'shop'
]
=
SearchData
::
getShopUrl
(
$param
);
}
$data
=
Yohobuy
::
getMulti
(
$urlList
,
array
(),
true
);
$data
=
Yohobuy
::
getMulti
(
$urlList
);
//获取品牌商品分类
if
(
isset
(
$data
[
'shop'
])
&&
!
empty
(
$data
[
'shop'
]))
{
$shopSortParam
[
'brand'
]
=
$data
[
'shop'
][
'id'
];
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Search.php
View file @
ad6dc6e
...
...
@@ -47,8 +47,10 @@ class SearchController extends WebAction
*/
public
function
sortSizeAction
()
{
$condition
[
'msort'
]
=
$this
->
get
(
'msort'
);
$size
=
SearchModel
::
getSortSize
(
$condition
);
$this
->
echoJson
(
$size
);
if
(
!
$this
->
isAjax
())
{
$condition
[
'msort'
]
=
$this
->
get
(
'msort'
);
$size
=
SearchModel
::
getSortSize
(
$condition
);
$this
->
echoJson
(
$size
);
}
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment