public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' )
	{
		$locale = $this->_getContext()->getLocale();
		$langid = $locale->getLanguageId();

		$search = MShop_Factory::createManager( $this->_getContext(), 'catalog/index/text' )->createSearch( true );

		$expr = array(
			$search->compare( '>', $search->createFunction( 'catalog.index.text.relevance', array( $listtype, $langid, $input ) ), 0 ),
			$search->compare( '>', $search->createFunction( 'catalog.index.text.value', array( $listtype, $langid, $type, 'product' ) ), '' ),
		);

		$sortations = array();

		switch( $sort )
		{
			case 'name':
				$cmpfunc = $search->createFunction( 'catalog.index.text.value', array( $listtype, $langid, 'name', 'product' ) );
				$expr[] = $search->compare( '>=', $cmpfunc, '' );

				$sortfunc = $search->createFunction( 'sort:catalog.index.text.value', array( $listtype, $langid, 'name' ) );
				$sortations[] = $search->sort( $direction, $sortfunc );
				break;

			case 'relevance':
				// we don't need to sort by 'sort:catalog.index.text.relevance' because it's a boolean match (relevance is either 0 or 1)
		}

		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSortations( $sortations );
		$search->setSlice( $start, $size );

		return $search;
	}
public function createTextFilter( $input, $sort = null, $direction = '+', $start = 0, $size = 25, $listtype = 'default', $type = 'name' )
	{
		$locale = $this->_getContext()->getLocale();
		$langid = $locale->getLanguageId();

		$search = MShop_Factory::createManager( $this->_getContext(), 'catalog/index/text' )->createSearch( true );

		$expr = array(
			$search->compare( '>', $search->createFunction( 'catalog.index.text.relevance', array( $listtype, $langid, $input ) ), 0 ),
			$search->compare( '>', $search->createFunction( 'catalog.index.text.value', array( $listtype, $langid, $type, 'product' ) ), '' ),
		);

		$sortations = array();

		switch( $sort )
		{
			case 'name':
				$cmpfunc = $search->createFunction( 'catalog.index.text.value', array( $listtype, $langid, 'name', 'product' ) );
				$expr[] = $search->compare( '>=', $cmpfunc, '' );

				$sortfunc = $search->createFunction( 'sort:catalog.index.text.value', array( $listtype, $langid, 'name' ) );
				$sortations[] = $search->sort( $direction, $sortfunc );
				break;

			case 'relevance':
				// we don't need to sort by 'sort:catalog.index.text.relevance' because it's a boolean match (relevance is either 0 or 1)
		}

		$search->setConditions( $search->combine( '&&', $expr ) );
		$search->setSortations( $sortations );
		$search->setSlice( $start, $size );

		return $search;
	}
public function createTextFilter ( $ input , $ sort = null , $ direction = '+' , $ start = 0 , $ size = 25 , $ listtype = 'default' , $ type = 'name' ) { $ locale = $ this -> _getContext ( ) -> getLocale ( ) ; $ langid = $ locale -> getLanguageId ( ) ; $ search = MShop_Factory :: createManager ( $ this -> _getContext ( ) , 'catalog/index/text' ) -> createSearch ( true ) ; $ expr = array ( $ search -> compare ( '>' , $ search -> createFunction ( 'catalog.index.text.relevance' , array ( $ listtype , $ langid , $ input ) ) , 0 ) , $ search -> compare ( '>' , $ search -> createFunction ( 'catalog.index.text.value' , array ( $ listtype , $ langid , $ type , 'product' ) ) , '' ) , ) ; $ sortations = array ( ) ; switch ( $ sort ) { case 'name' : $ cmpfunc = $ search -> createFunction ( 'catalog.index.text.value' , array ( $ listtype , $ langid , 'name' , 'product' ) ) ; $ expr [ ] = $ search -> compare ( '>=' , $ cmpfunc , '' ) ; $ sortfunc = $ search -> createFunction ( 'sort:catalog.index.text.value' , array ( $ listtype , $ langid , 'name' ) ) ; $ sortations [ ] = $ search -> sort ( $ direction , $ sortfunc ) ; break ; case 'relevance' : // we don't need to sort by 'sort:catalog.index.text.relevance' because it's a boolean match (relevance is either 0 or 1) } $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ search -> setSortations ( $ sortations ) ; $ search -> setSlice ( $ start , $ size ) ; return $ search ; }
Returns text filter for the given search string.

@param string $input Search string entered by the user
@param string|null $sort Sortation of the product list like "name" and "relevance", null for no sortation
@param string $direction Sort direction of the product list ("asc", "desc")
@param integer $start Position in the list of found products where to begin retrieving the items
@param integer $size Number of products that should be returned
@param string $listtype List type of the text associated to the product, usually "default"
@param string $type Type of the text like "name", "short", "long", etc.
@return MW_Common_Criteria_Interface Criteria object containing the conditions for searching
Returns text filter for the given search string .