SaleController.php 3.84 KB
<?php
class SaleController extends QLib_Controller_Adaption_Action 
{
	public function init() {
		
	}
	
	public function indexAction() {
		$this->QLayoutLink()->offsetSetStylesheet(5,$this->_css('goods'));
		
		$params = $this->_request->getParams();
		foreach ($params as $key=>$val) {
		    $params[$key] = QINLib_Utils::Wasc($val);
		}
		$match = new QINSearch_Tyr_Match('search_outlet', 'search_outlet');

		$parameter = $match->getStandardValue($params);
		if(!empty($parameter)){
			$params['parameter'] = $parameter;
		}
		//删除outlet的商品
		$params['outlets'] = 2;
		//每页显示数量
		$size = empty($params['num']) ? 59 : ($params['num'] - 1);
		//每页显示数
		$this->view->num = $size + 1;
		//每页显示行数
		$this->view->row = empty($params['row']) ? 4 : $params['row'];
		//排序
		$this->view->order = empty($params['order']) ? '' : $params['order'];
		$query = '';
		if(empty($params['p_d'])){
			$params['p_d'] = '0,0.9';
		}
		//性别
		$this->view->gender = empty($params['gender']) ? '' : $params['gender'];
		//颜色
		$this->view->color = empty($params['color']) ? 0 : $params['color'];
		//完整分页
		$paging = $this->helpPaging('Newyoho')->setSize($size);
		//排序
		$search = $match->search();
        $orderParamResult = array();
		$filterParamResult = array();
        if (empty($params['order'])) {
            $search->setMultiOrder();
        } else {
            $search->setSortModes($params, $orderParamResult);
        }
		//获得结果
		$_result = $search->setFilters($params, $filterParamResult)->setLimits((int)$paging->getNewCurrent(), (int)$paging->getSize())->query();
		
		$filter = array(
			'gender' => empty($params['gender']) ? '' : $params['gender'],
            'outlets' => 2		        
		);
		
		$filter['p_d'] = '0.1,0.9';
		//大分类
		$_result['groupSort'] = $match->getSortGroup($filter);
		//折扣
		$_result['discount'] = $match->getDiscount($filter);
		//小分类
		$filter['msort'] = empty($params['msort']) ? 0 : $params['msort'];
		$filter['misort'] = empty($params['misort']) ? 0 : $params['misort'];
		$_result['sort'] = $match->getSmallSort($filter);
		//尺码
		$_result['size'] = $match->getSize($params);
		//颜色
		$_result['color'] = $match->getColor($params);
		//价格区间
		$_result['priceRange'] = $match->priceRange($params);
		//品牌
		$brandFilter = $params;
		if(!empty($brandFilter['brand'])){
			unset($brandFilter['brand']);
		}
		$_result['brand'] = $match->getBrand($brandFilter);
		//风格
		$styleFilter = $params;
		if(!empty($styleFilter['style'])){
			unset($styleFilter['style']);
		}
		$_result['style'] = $match->getStyle($styleFilter);
		//命中参数
		$_result['param'] = $filterParamResult['_param'];
		if(!empty($_result['param']['p_d'])){
			unset($_result['param']['p_d']);
		}
		$this->view->result = $_result;
		
		//分页
		$paging->setTotal($_result['total']);
		$this->view->paging = $paging;
		//mini分页
		$this->view->page = $page = $this->helpPaging('newmini')->setTotal($_result['total'])->setSize($size);
		//下一页
		$this->view->nextpage = $nextpage = $paging->getPageNum() != $paging->getCurrent() ? '/outlet' . $paging->getUrl($paging->getNext()) : '';
		$this->view->max_sort_id = !empty($params['msort']) ? $params['msort'] : 0;
		$this->view->middle_sort_id = !empty($params['misort']) ? $params['misort'] : 0;
		
		$title = '潮流商品 | YOHO!有货';
		$keywords = 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流';
		$description = '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜';
		$this->setMetaInfo($title, $keywords, $description);
	}
}