Authored by 周少峰

多选的品牌保留两个作为一个标签,第二个品牌截取字符

... ... @@ -392,17 +392,28 @@ class HelperSearch
//清空品牌参数
unset($params['brand']);
//设置已选中的品牌
$existBrandNum = 0;
$existName = '';
foreach ($brandIds as $key => $val) {
if (isset($brandAll[$val])) {
$brandParam = $brandIds;
unset($brandParam[$key]);
$params['brand'] = implode(',', $brandParam);
if ($existBrandNum === 0) {
$existName .= $brandAll[$val].'、';
}
if ($existBrandNum === 1){
$existName .= $brandAll[$val].'...';
}
$existBrandNum++;
}
if ($existBrandNum > 1) {
break;
}
}
self::$selected['brand'] = array(
'name' => $brandAll[$val],
'name' => $existName,
'href' => self::buildUrl($params)
);
}
}
ksort($brandList);
//品牌列表排序, 添加品牌索引
$index_key = array();
... ... @@ -903,20 +914,9 @@ class HelperSearch
{
$result = array();
$data = array();
$is_array_key = array(
'brand',
'style'
);
foreach (self::$selected as $key => $val) {
if (in_array($key, $is_array_key)) {
foreach ($val as $k => $v) {
$data[] = $v;
}
}
else {
$data[] = $val;
}
}
if ($data) {
$result['conditions'] = $data;
}
... ...