Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
yangyang
9 years ago
Commit
c827cba0a2d0bf5d083ca312b95f52e835293d74
2 parents
d2682617
fd20113c
Merge branch 'feature/web-list' of
http://git.dev.yoho.cn/web/yohobuy
into feature/web-list
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
30 deletions
library/Plugin/HelperSearch.php
yohobuy/www.yohobuy.com/application/models/Product/Search.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Search.php
library/Plugin/HelperSearch.php
View file @
c827cba
...
...
@@ -63,13 +63,13 @@ class HelperSearch
unset
(
self
::
$params
[
'page'
]);
unset
(
self
::
$params
[
'/sale'
]);
unset
(
self
::
$params
[
'sale'
]);
$filter
=
$data
[
'
data
'
][
'filter'
];
$filter
=
$data
[
'
product
'
][
'filter'
];
//产品列表
$result
[
'goods'
]
=
self
::
getProductList
(
$data
[
'
data
'
][
'product_list'
],
$options
[
'imgSize'
]);
$result
[
'goods'
]
=
self
::
getProductList
(
$data
[
'
product
'
][
'product_list'
],
$options
[
'imgSize'
]);
//总页数
$result
[
'page_total'
]
=
$data
[
'
data
'
][
'page_total'
];
$result
[
'page_total'
]
=
$data
[
'
product
'
][
'page_total'
];
//当前页
$result
[
'page'
]
=
$data
[
'
data
'
][
'page'
];
$result
[
'page'
]
=
$data
[
'
product
'
][
'page'
];
self
::
$page
=
$result
[
'page'
];
//清除选中
$result
[
'filters'
][
'checkedConditions'
][
'clearUrl'
]
=
self
::
current
();
...
...
@@ -99,25 +99,25 @@ class HelperSearch
//可选每页显示数量
$result
[
'opts'
][
'pageCounts'
]
=
self
::
viewNum
();
$result
[
'opts'
][
'curPage'
]
=
self
::
$page
;
$result
[
'opts'
][
'pageCount'
]
=
$data
[
'data'
][
'page_total'
];
$result
[
'opts'
][
'nextHref'
]
=
(
$next
=
self
::
next
(
$data
[
'data'
][
'page_total'
],
$data
[
'data'
][
'filter'
]))
?
$next
[
'href'
]
:
''
;
$result
[
'hasNextPage'
]
=
self
::
next
(
$data
[
'data'
][
'page_total'
]);
$result
[
'opts'
][
'pageCount'
]
=
$data
[
'product'
][
'page_total'
];
$result
[
'opts'
][
'nextHref'
]
=
(
$next
=
self
::
next
(
$data
[
'product'
][
'page_total'
],
$data
[
'product'
][
'filter'
]))
?
$next
[
'href'
]
:
''
;
$result
[
'hasNextPage'
]
=
self
::
next
(
$data
[
'product'
][
'page_total'
]);
//分类条件
$result
[
'filters'
][
'sort'
]
=
isset
(
$
filter
[
'group_sort'
])
?
self
::
searchSort
(
$filter
[
'group_
sort'
])
:
array
();
$result
[
'filters'
][
'sort'
]
=
isset
(
$
data
[
'sort'
])
?
self
::
searchSort
(
$data
[
'sort'
][
'
sort'
])
:
array
();
//左侧分类分类
$result
[
'leftContent'
][][
'allSort'
]
=
isset
(
$
filter
[
'group_sort'
])
?
self
::
groupSort
(
$filter
[
'group_
sort'
])
:
array
();
$result
[
'leftContent'
][][
'allSort'
]
=
isset
(
$
data
[
'sort'
])
?
self
::
groupSort
(
$data
[
'sort'
][
'
sort'
])
:
array
();
//一周新品上架
$result
[
'leftContent'
][][
'newSales'
]
=
isset
(
$
filter
[
'recent'
])
?
self
::
recentShelve
(
$filter
[
'recent'
])
:
array
();
$result
[
'leftContent'
][][
'newSales'
]
=
isset
(
$
data
[
'recent'
])
?
self
::
recentShelve
(
$data
[
'recent'
])
:
array
();
//全部折扣
$result
[
'leftContent'
][][
'allDiscount'
]
=
isset
(
$
filter
[
'discount'
])
?
self
::
getDiscount
(
$filter
[
'discount'
])
:
array
();
$result
[
'leftContent'
][][
'allDiscount'
]
=
isset
(
$
data
[
'discount'
])
?
self
::
getDiscount
(
$data
[
'discount'
]
[
'discount'
])
:
array
();
//总记录数
$result
[
'totalCount'
]
=
$data
[
'
data
'
][
'total'
];
$result
[
'totalCount'
]
=
$data
[
'
product
'
][
'total'
];
//分页
$result
[
'pager'
]
=
self
::
pager
(
$result
[
'totalCount'
],
$options
[
'viewNum'
]);
//选中条件
$result
[
'filters'
][
'checkedConditions'
][
'conditions'
]
=
self
::
getSelected
();
if
(
isset
(
$options
[
'controller'
])
&&
$options
[
'controller'
]
==
'Search'
)
{
self
::
setSearchNav
(
$data
[
'
data
'
][
'total'
]);
self
::
setSearchNav
(
$data
[
'
product
'
][
'total'
]);
}
$result
[
'pathNav'
]
=
self
::
$listnav
;
return
$result
;
...
...
@@ -393,7 +393,7 @@ class HelperSearch
'id'
=>
$v
[
'id'
],
'href'
=>
$url
,
'name'
=>
$v
[
'brand_name'
],
'key'
=>
$v
[
'brand_name'
]
,
'key'
=>
strtolower
(
$v
[
'brand_name'
])
,
'active'
=>
in_array
(
$v
[
'id'
],
$brandIds
)
?
true
:
false
);
if
(
is_numeric
(
$v
[
'brand_alif'
]))
{
...
...
@@ -426,7 +426,7 @@ class HelperSearch
//品牌列表排序, 添加品牌索引
$index_key
=
array
();
foreach
(
$brandList
as
$key
=>
$val
)
{
if
(
$key
&&
!
in_array
(
$key
,
$index_key
))
{
if
(
$key
&&
!
in_array
(
$key
,
$index_key
)
&&
!
is_numeric
(
$key
)
)
{
$index
[
'index'
]
=
strtolower
((
$key
));
$index
[
'name'
]
=
$key
;
$result
[
'brandIndex'
][]
=
$index
;
...
...
yohobuy/www.yohobuy.com/application/models/Product/Search.php
View file @
c827cba
...
...
@@ -130,25 +130,25 @@ class SearchModel
*/
public
static
function
getSearchData
(
$customCondition
=
array
(),
$customOptions
=
array
())
{
$
data
=
array
();
$
urlList
=
array
();
$searchCondition
=
self
::
searchCondition
(
$customCondition
,
$customOptions
);
// 调用接口查询商品数据
$urlList
[
'productUrl'
]
=
HelperSearch
::
getProductUrl
(
$searchCondition
[
'condition'
]);
// 调用分类信息
$urlList
[
'sortUrl'
]
=
HelperSearch
::
getSortUrl
(
$searchCondition
[
'condition'
]);
// $result['data']['filter']['group_sort'] = $category['data']['sort'];
// 调用折扣区间
$urlList
[
'discountUrl'
]
=
HelperSearch
::
getDiscountUrl
(
$searchCondition
[
'condition'
]);
// $result['data']['filter']['discount'] = $discount['data']['discount'];
// 调用最新上架
$urlList
[
'recentUrl'
]
=
HelperSearch
::
getRecentUrl
(
$searchCondition
[
'condition'
]);
// $result['data']['filter']['recent'] = $recent['data']['recent'];
// 组合搜索商品url
$urlList
[
'product'
]
=
HelperSearch
::
getProductUrl
(
$searchCondition
[
'condition'
]);
// 组合搜索分类url
$urlList
[
'sort'
]
=
HelperSearch
::
getClassesUrl
(
$searchCondition
[
'condition'
]);
// 组合搜索折扣区间url
$urlList
[
'discount'
]
=
HelperSearch
::
getDiscountUrl
(
$searchCondition
[
'condition'
]);
// 组合搜索最新上架url
$urlList
[
'recent'
]
=
HelperSearch
::
getRecentShelveUrl
(
$searchCondition
[
'condition'
]);
//用户浏览记录
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
$result
=
Yohobuy
::
getMulti
(
$urlList
,
array
(),
true
);
// print_r($result['product']);
// print_r($result['sort']);
// print_r($result['discount']);
// print_r($result['recent']);
// exit;
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Search.php
View file @
c827cba
...
...
@@ -6,7 +6,7 @@ class SearchController extends WebAction
public
function
indexAction
()
{
$options
[
'controller'
]
=
$this
->
_request
->
controller
;
$searchData
=
SearchModel
::
searchData
(
''
,
$options
);
$searchData
=
SearchModel
::
searchData
(
array
()
,
$options
);
$this
->
setWebNavHeader
();
$data
=
array
(
//初始化js
...
...
Please
register
or
login
to post a comment