Showing
3 changed files
with
30 additions
and
22 deletions
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | -// use LibModels\Wap\Product\SearchData; | ||
5 | -// use Plugin\DataProcess\ListProcess; | 4 | +use LibModels\Wap\Product\SearchData; |
5 | +use Plugin\DataProcess\ListProcess; | ||
6 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
7 | 7 | ||
8 | /** | 8 | /** |
@@ -39,6 +39,7 @@ class SearchController extends AbstractAction | @@ -39,6 +39,7 @@ class SearchController extends AbstractAction | ||
39 | 'shop' => FILTER_DEFAULT, | 39 | 'shop' => FILTER_DEFAULT, |
40 | 'categoryId' => FILTER_DEFAULT, | 40 | 'categoryId' => FILTER_DEFAULT, |
41 | 'subCategoryId' => FILTER_DEFAULT, | 41 | 'subCategoryId' => FILTER_DEFAULT, |
42 | + 'title' => FILTER_DEFAULT, | ||
42 | 'query' => FILTER_DEFAULT, | 43 | 'query' => FILTER_DEFAULT, |
43 | 'brand' => FILTER_DEFAULT, | 44 | 'brand' => FILTER_DEFAULT, |
44 | 'sort' => FILTER_DEFAULT, | 45 | 'sort' => FILTER_DEFAULT, |
@@ -151,13 +152,11 @@ class SearchController extends AbstractAction | @@ -151,13 +152,11 @@ class SearchController extends AbstractAction | ||
151 | if ($isQueryFirstClass) { | 152 | if ($isQueryFirstClass) { |
152 | $this->setTitle('全部' . $query); | 153 | $this->setTitle('全部' . $query); |
153 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); | 154 | $this->setNavHeader('全部' . $query, true, SITE_MAIN); |
154 | - } | ||
155 | - // 搜索是二级品类 | 155 | + } // 搜索是二级品类 |
156 | elseif ($isQuerySecondClass) { | 156 | elseif ($isQuerySecondClass) { |
157 | $this->setTitle($query); | 157 | $this->setTitle($query); |
158 | $this->setNavHeader($query, true, SITE_MAIN); | 158 | $this->setNavHeader($query, true, SITE_MAIN); |
159 | - } | ||
160 | - // 搜索其它内容 | 159 | + } // 搜索其它内容 |
161 | else { | 160 | else { |
162 | $from = $this->get('from'); | 161 | $from = $this->get('from'); |
163 | if ($haveQuery || $from) { | 162 | if ($haveQuery || $from) { |
@@ -196,6 +195,11 @@ class SearchController extends AbstractAction | @@ -196,6 +195,11 @@ class SearchController extends AbstractAction | ||
196 | $listData = array(); | 195 | $listData = array(); |
197 | } | 196 | } |
198 | 197 | ||
198 | + if($condition['title']){ | ||
199 | + $this->setTitle($condition['title']); | ||
200 | + $this->setNavHeader($condition['title'], true, SITE_MAIN); | ||
201 | + } | ||
202 | + | ||
199 | $this->_view->display('list', $data); | 203 | $this->_view->display('list', $data); |
200 | } | 204 | } |
201 | 205 | ||
@@ -254,8 +258,7 @@ class SearchController extends AbstractAction | @@ -254,8 +258,7 @@ class SearchController extends AbstractAction | ||
254 | // 为了兼容现在运营在用的p_d | 258 | // 为了兼容现在运营在用的p_d |
255 | if (isset($condition['p_d'])) { | 259 | if (isset($condition['p_d'])) { |
256 | $condition['p_d'] = rawurldecode($condition['p_d']); | 260 | $condition['p_d'] = rawurldecode($condition['p_d']); |
257 | - } | ||
258 | - // 转换折扣 | 261 | + } // 转换折扣 |
259 | elseif (isset($condition['discount'])) { | 262 | elseif (isset($condition['discount'])) { |
260 | $condition['p_d'] = rawurldecode($condition['discount']); | 263 | $condition['p_d'] = rawurldecode($condition['discount']); |
261 | unset($condition['discount']); | 264 | unset($condition['discount']); |
@@ -345,8 +348,7 @@ class SearchController extends AbstractAction | @@ -345,8 +348,7 @@ class SearchController extends AbstractAction | ||
345 | // 为了兼容现在运营在用的p_d | 348 | // 为了兼容现在运营在用的p_d |
346 | if (isset($condition['p_d'])) { | 349 | if (isset($condition['p_d'])) { |
347 | $condition['p_d'] = rawurldecode($condition['p_d']); | 350 | $condition['p_d'] = rawurldecode($condition['p_d']); |
348 | - } | ||
349 | - // 转换折扣 | 351 | + } // 转换折扣 |
350 | elseif (isset($condition['discount'])) { | 352 | elseif (isset($condition['discount'])) { |
351 | $condition['p_d'] = rawurldecode($condition['discount']); | 353 | $condition['p_d'] = rawurldecode($condition['discount']); |
352 | unset($condition['discount']); | 354 | unset($condition['discount']); |
@@ -350,10 +350,11 @@ class ListModel | @@ -350,10 +350,11 @@ class ListModel | ||
350 | 350 | ||
351 | /** | 351 | /** |
352 | * @param $data | 352 | * @param $data |
353 | + * @param $shop_id | ||
353 | * @return array 返回的处理好的数据 | 354 | * @return array 返回的处理好的数据 |
354 | * @author chengyao.guo | 355 | * @author chengyao.guo |
355 | */ | 356 | */ |
356 | - public static function categoryData($data) | 357 | + public static function categoryData($data , $shop_id) |
357 | { | 358 | { |
358 | $result = array(); | 359 | $result = array(); |
359 | $result['class'] = array(); | 360 | $result['class'] = array(); |
@@ -361,9 +362,13 @@ class ListModel | @@ -361,9 +362,13 @@ class ListModel | ||
361 | foreach ($data as &$item) { | 362 | foreach ($data as &$item) { |
362 | array_push($result['class'], array('name' => $item['category_name'])); | 363 | array_push($result['class'], array('name' => $item['category_name'])); |
363 | foreach ($item['sub'] as &$item2) { | 364 | foreach ($item['sub'] as &$item2) { |
364 | - $item2['url'] = Helpers::url('/search/list',array( | ||
365 | - 'shop' => '326' | ||
366 | - )); // tar mark 还有其他参数 | 365 | + $item2['url'] = Helpers::url('/search/list', array( |
366 | + 'shop' => $shop_id, | ||
367 | + 'categoryId' => $item['category_id'], | ||
368 | + 'subCategoryId' => $item2['category_id'], | ||
369 | + 'title' => $item2['category_name'], | ||
370 | + 'query' => $item2['category_name'], | ||
371 | + )); | ||
367 | } | 372 | } |
368 | array_push($result['category'], array('subcategory' => $item['sub'])); | 373 | array_push($result['category'], array('subcategory' => $item['sub'])); |
369 | } | 374 | } |
@@ -374,18 +379,22 @@ class ListModel | @@ -374,18 +379,22 @@ class ListModel | ||
374 | * 店铺所有品牌信息处理 | 379 | * 店铺所有品牌信息处理 |
375 | * @author chengyao.guo | 380 | * @author chengyao.guo |
376 | * @param $data | 381 | * @param $data |
382 | + * @param $shop_id | ||
377 | * @return mixed | 383 | * @return mixed |
378 | */ | 384 | */ |
379 | - public static function brandData($data) | 385 | + public static function brandData($data,$shop_id) |
380 | { | 386 | { |
381 | // 处理图片链接 | 387 | // 处理图片链接 |
382 | foreach ($data as &$item) { | 388 | foreach ($data as &$item) { |
383 | $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0); | 389 | $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0); |
384 | - $item['url'] = Helpers::url('',array(),$item['brand_domain']); | 390 | + $item['url'] = Helpers::url('/search/list', array( |
391 | + 'shop' => $shop_id, | ||
392 | + 'brand' => $item['brand_id'], | ||
393 | + 'title' => $item['brand_name'], | ||
394 | + )); | ||
385 | } | 395 | } |
386 | return $data; | 396 | return $data; |
387 | } | 397 | } |
388 | - | ||
389 | /** | 398 | /** |
390 | * 新店铺首页 | 399 | * 新店铺首页 |
391 | * @param int $shopId 店铺id | 400 | * @param int $shopId 店铺id |
@@ -255,9 +255,8 @@ class IndexController extends AbstractAction | @@ -255,9 +255,8 @@ class IndexController extends AbstractAction | ||
255 | $result = array(); | 255 | $result = array(); |
256 | $resource = ShopData::getShopBrands($requestData['shop_id']); | 256 | $resource = ShopData::getShopBrands($requestData['shop_id']); |
257 | if($resource['code'] === 200){ | 257 | if($resource['code'] === 200){ |
258 | - $result = ListModel::brandData($resource['data']); | 258 | + $result = ListModel::brandData($resource['data'],$requestData['shop_id']); |
259 | } | 259 | } |
260 | -// ShopData::debugOut($resource); | ||
261 | if(Mobile::isMobile()){ | 260 | if(Mobile::isMobile()){ |
262 | $this->setTitle('品牌'); | 261 | $this->setTitle('品牌'); |
263 | }else{ | 262 | }else{ |
@@ -285,14 +284,13 @@ class IndexController extends AbstractAction | @@ -285,14 +284,13 @@ class IndexController extends AbstractAction | ||
285 | $result = array(); | 284 | $result = array(); |
286 | $resource = ShopData::getShopCategory($requestData['shop_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie()); | 285 | $resource = ShopData::getShopCategory($requestData['shop_id'], Helpers::getChannelByCookie(), Helpers::getGenderByCookie()); |
287 | if ($resource['code'] === 200) { | 286 | if ($resource['code'] === 200) { |
288 | - $result = ListModel::categoryData($resource['data']); | 287 | + $result = ListModel::categoryData($resource['data'],$requestData['shop_id']); |
289 | } | 288 | } |
290 | if(Mobile::isMobile()){ | 289 | if(Mobile::isMobile()){ |
291 | $this->setTitle('品类'); | 290 | $this->setTitle('品类'); |
292 | }else{ | 291 | }else{ |
293 | $this->setNavHeader('品类', true, SITE_MAIN); | 292 | $this->setNavHeader('品类', true, SITE_MAIN); |
294 | } | 293 | } |
295 | -// ShopData::debugOut($resource); | ||
296 | return $this->_view->display('category', array( | 294 | return $this->_view->display('category', array( |
297 | 'productCategoryPage' => true, | 295 | 'productCategoryPage' => true, |
298 | 'content' => $result, | 296 | 'content' => $result, |
@@ -322,7 +320,6 @@ class IndexController extends AbstractAction | @@ -322,7 +320,6 @@ class IndexController extends AbstractAction | ||
322 | }else{ | 320 | }else{ |
323 | $this->setNavHeader('店铺简介', true, SITE_MAIN); | 321 | $this->setNavHeader('店铺简介', true, SITE_MAIN); |
324 | } | 322 | } |
325 | -// ShopData::debugOut($resource); | ||
326 | return $this->_view->display('intro', array( | 323 | return $this->_view->display('intro', array( |
327 | 'content' => $result, | 324 | 'content' => $result, |
328 | )); | 325 | )); |
-
Please register or login to post a comment