Showing
3 changed files
with
14 additions
and
6 deletions
@@ -16,12 +16,12 @@ class ListProcess | @@ -16,12 +16,12 @@ class ListProcess | ||
16 | * @param $data | 16 | * @param $data |
17 | * @return array 处理之后的商品数据 | 17 | * @return array 处理之后的商品数据 |
18 | */ | 18 | */ |
19 | - public static function getListData($data, $returnFilter = true) | 19 | + public static function getListData($data, $returnFilter = true, $showTag = true, $tagNew = true, $tagSale = true) |
20 | { | 20 | { |
21 | $result = array(); | 21 | $result = array(); |
22 | 22 | ||
23 | if (isset($data['product_list'])) { | 23 | if (isset($data['product_list'])) { |
24 | - $result['new'] = self::getProductData($data['product_list']); | 24 | + $result['new'] = self::getProductData($data['product_list'], $showTag, $tagNew, $tagSale); |
25 | } | 25 | } |
26 | if ($returnFilter && isset($data['filter'])) { | 26 | if ($returnFilter && isset($data['filter'])) { |
27 | $result['filter'] = self::getFilterData($data['filter']); | 27 | $result['filter'] = self::getFilterData($data['filter']); |
@@ -291,7 +291,15 @@ class SearchController extends AbstractAction | @@ -291,7 +291,15 @@ class SearchController extends AbstractAction | ||
291 | $type = $this->get('type', ''); | 291 | $type = $this->get('type', ''); |
292 | $order = $this->get('order', 0); | 292 | $order = $this->get('order', 0); |
293 | $condition['order'] = Helpers::transOrder($order, $type); | 293 | $condition['order'] = Helpers::transOrder($order, $type); |
294 | - | 294 | + //标签显示控制 |
295 | + $showTag = $this->get('showTag', 0); | ||
296 | + $showTag = $showTag === 0 ? true : false; | ||
297 | + //显示标签new | ||
298 | + $tagNew = $this->get('newTag', 0); | ||
299 | + $tagNew = $tagNew === 0 ? true : false; | ||
300 | + //显示标签sale | ||
301 | + $tagSale = $this->get('saleTag', 0); | ||
302 | + $tagSale = $tagSale === 0 ? true : false; | ||
295 | // 过滤掉值为空的条件 | 303 | // 过滤掉值为空的条件 |
296 | $condition = array_filter($condition); | 304 | $condition = array_filter($condition); |
297 | 305 | ||
@@ -311,7 +319,7 @@ class SearchController extends AbstractAction | @@ -311,7 +319,7 @@ class SearchController extends AbstractAction | ||
311 | // /* 精确搜索品类 */ | 319 | // /* 精确搜索品类 */ |
312 | // $data = Product\ListModel::getClassData($condition); | 320 | // $data = Product\ListModel::getClassData($condition); |
313 | 321 | ||
314 | - $data = Product\SearchModel::getSearchData($condition); | 322 | + $data = Product\SearchModel::getSearchData($condition, $showTag, $tagNew, $tagSale); |
315 | } while (false); | 323 | } while (false); |
316 | 324 | ||
317 | if (empty($data['new'])) { | 325 | if (empty($data['new'])) { |
@@ -26,7 +26,7 @@ class SearchModel | @@ -26,7 +26,7 @@ class SearchModel | ||
26 | * @param array $condition 查询条件 | 26 | * @param array $condition 查询条件 |
27 | * @return array | 27 | * @return array |
28 | */ | 28 | */ |
29 | - public static function getSearchData($condition) | 29 | + public static function getSearchData($condition, $showTag = true, $tagNew = true, $tagSale = true) |
30 | { | 30 | { |
31 | $result = array(); | 31 | $result = array(); |
32 | 32 | ||
@@ -48,7 +48,7 @@ class SearchModel | @@ -48,7 +48,7 @@ class SearchModel | ||
48 | // $listData = SearchData::searchByCondition($condition); | 48 | // $listData = SearchData::searchByCondition($condition); |
49 | // 处理返回的数据 | 49 | // 处理返回的数据 |
50 | if (isset($listData['code']) && $listData['code'] === 200) { | 50 | if (isset($listData['code']) && $listData['code'] === 200) { |
51 | - $result = ListProcess::getListData($listData['data'], false); | 51 | + $result = ListProcess::getListData($listData['data'], false, $showTag, $tagNew, $tagSale); |
52 | } | 52 | } |
53 | 53 | ||
54 | if (USE_CACHE) { | 54 | if (USE_CACHE) { |
-
Please register or login to post a comment