BoxSearch.php 1.14 KB
<?php

/**
 * BoxSearch helper
 *
 * @uses viewHelper Zend_View_Helper
 */
class Web_View_Helper_BoxSearch extends Zend_View_Helper_Abstract {
	
	private $conditionSelectMap = array(
		'discount',
		'gender',
		'brand', 
		'price', 
		'size'
	);
	private $conditionDefaultSelectMap = array(
		'discount',
		'gender',
		'brand', 
		'price'
	);
	/**
	 * @var Zend_View_Interface 
	 */
	public $view;
	
	/**
	 * 
	 */
	public function boxSearch(array $sort_ids, array $selectMap = array(), $brand_id = 0, $url='/search?', $hideOpt=array()) {
		if (empty($selectMap) && isset($sort_ids['sort'])) {
		//	$conditionSelect = QModels_Search_Client::getConditionSelectOne($sort_ids['sort']);
			$conditionSelect = array();
			$selectMap = empty($conditionSelect) ? $this->conditionDefaultSelectMap : $conditionSelect;
		}
		$this->view->brand_id = $brand_id;
		$this->view->boxConditionSelect = $selectMap;
		$this->view->url = $url;
		$this->view->hideOpt = $hideOpt;
		return $this->view->render('box/search.phtml');
	}
	
	/**
	 * Sets the view field 
	 * @param $view Zend_View_Interface
	 */
	public function setView(Zend_View_Interface $view) {
		$this->view = $view;
	}

}