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
Email Patches
Plain Diff
Browse Files
Authored by
周少峰
9 years ago
Commit
e3a78a05081e96b3a823c7fd9e09c45f93d1675d
1 parent
2127a627
多选风格,保留一个标签
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
library/Plugin/HelperSearch.php
library/Plugin/HelperSearch.php
View file @
e3a78a0
...
...
@@ -622,18 +622,18 @@ class HelperSearch
}
$result
= array();
$style
=
$filter['style']
;
$styleNum
= 0;
$styleName
= '';
foreach (
$style
as
$v
) {
//选中的筛选条件
if (in_array(
$v['style_id']
,
$styleIds
)) {
$selectedStyle
= explode(',', self::
$params['style']
);
$selectedKey
= array_search(
$v['style_id']
,
$selectedStyle
);
unset(
$selectedStyle[$selectedKey]
);
$selectedParams
=
$params
;
$selectedParams['style']
= implode(',',
$selectedStyle
);
self::
$selected['style'][]
= array(
'name' =>
$v['style_name']
,
'href' => self::buildUrl(
$selectedParams
)
);
if (!
$styleNum
) {
$styleName
=
$v['style_name']
."
、
";
}
elseif (
$styleNum
===1){
$styleName
.= substr(
$v['style_name']
, 0, 3).'...';
}
$styleNum
++;
}
$selectedStyle
= isset(self::
$params['style']
) && !empty(self::
$params['style']
) ? explode(',', self::
$params['style']
) : array();
//风格id在提交的参数中,构造url参数去除该风格id
...
...
@@ -657,9 +657,11 @@ class HelperSearch
'href' =>
$url
,
);
}
//搜索页已选中,返回空
if (self::checkSearch('style')) {
return array();
if (isset(self::
$params['style']
) && !empty(self::
$params['style']
)) {
self::
$selected['style']
= array(
'name' => rtrim(
$styleName
, '、'),
'href' => self::buildUrl(
$params
)
);
}
$data[0]
= array(
'attr' => 'style',
...
...
@@ -677,6 +679,10 @@ class HelperSearch
$style
= self::style(
$filter
);
$other
= self::standard(
$filter
);
$result
= array_merge(
$style
,
$other
);
//搜索页已选中,返回空
if (self::checkSearch('style') || self::checkSearch('parameter')) {
return array();
}
return
$result
;
}
...
...
@@ -1110,8 +1116,12 @@ class HelperSearch
public static function checkSearch(
$param
)
{
if (isset(self::
$params[$param]
) && isset(self::
$options['controller']
) && self::
$options['controller']
== 'Search') {
return true;
if (isset(self::
$options['controller']
) && self::
$options['controller']
== 'Search') {
foreach (self::
$params
as
$key
=>
$val
) {
if (strpos(
$key
,
$param
) !== false) {
return true;
}
}
}
}
...
...
Please
register
or
login
to post a comment