public function createProductFilterDefault( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
	{
		$sortations = array();
		$context = $this->_getContext();

		$search = MShop_Factory::createManager( $context, 'catalog/index' )->createSearch( true );
		$expr = array( $search->compare( '!=', 'catalog.index.catalog.id', null ) );

		switch( $sort )
		{
			case 'code':
				$sortations[] = $search->sort( $direction, 'product.code' );
				break;

			case 'name':
				$langid = $context->getLocale()->getLanguageId();

				$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 'price':
				$currencyid = $context->getLocale()->getCurrencyId();

				$cmpfunc = $search->createFunction( 'catalog.index.price.value', array( $listtype, $currencyid, 'default' ) );
				$expr[] = $search->compare( '>=', $cmpfunc, '0.00' );

				$sortfunc = $search->createFunction( 'sort:catalog.index.price.value', array( $listtype, $currencyid, 'default' ) );
				$sortations[] = $search->sort( $direction, $sortfunc );
				break;
		}

		$expr[] = $search->getConditions();

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

		return $search;
	}
public function createProductFilterDefault( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' )
	{
		$sortations = array();
		$context = $this->_getContext();

		$search = MShop_Factory::createManager( $context, 'catalog/index' )->createSearch( true );
		$expr = array( $search->compare( '!=', 'catalog.index.catalog.id', null ) );

		switch( $sort )
		{
			case 'code':
				$sortations[] = $search->sort( $direction, 'product.code' );
				break;

			case 'name':
				$langid = $context->getLocale()->getLanguageId();

				$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 'price':
				$currencyid = $context->getLocale()->getCurrencyId();

				$cmpfunc = $search->createFunction( 'catalog.index.price.value', array( $listtype, $currencyid, 'default' ) );
				$expr[] = $search->compare( '>=', $cmpfunc, '0.00' );

				$sortfunc = $search->createFunction( 'sort:catalog.index.price.value', array( $listtype, $currencyid, 'default' ) );
				$sortations[] = $search->sort( $direction, $sortfunc );
				break;
		}

		$expr[] = $search->getConditions();

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

		return $search;
	}
public function createProductFilterDefault ( $ sort = null , $ direction = '+' , $ start = 0 , $ size = 100 , $ listtype = 'default' ) { $ sortations = array ( ) ; $ context = $ this -> _getContext ( ) ; $ search = MShop_Factory :: createManager ( $ context , 'catalog/index' ) -> createSearch ( true ) ; $ expr = array ( $ search -> compare ( '!=' , 'catalog.index.catalog.id' , null ) ) ; switch ( $ sort ) { case 'code' : $ sortations [ ] = $ search -> sort ( $ direction , 'product.code' ) ; break ; case 'name' : $ langid = $ context -> getLocale ( ) -> getLanguageId ( ) ; $ 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 'price' : $ currencyid = $ context -> getLocale ( ) -> getCurrencyId ( ) ; $ cmpfunc = $ search -> createFunction ( 'catalog.index.price.value' , array ( $ listtype , $ currencyid , 'default' ) ) ; $ expr [ ] = $ search -> compare ( '>=' , $ cmpfunc , '0.00' ) ; $ sortfunc = $ search -> createFunction ( 'sort:catalog.index.price.value' , array ( $ listtype , $ currencyid , 'default' ) ) ; $ sortations [ ] = $ search -> sort ( $ direction , $ sortfunc ) ; break ; } $ expr [ ] = $ search -> getConditions ( ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ search -> setSortations ( $ sortations ) ; $ search -> setSlice ( $ start , $ size ) ; return $ search ; }
Returns the default product filter.

@param string|null $sort Sortation of the product list like "name", "code", "price" and "position", null for no sortation
@param string $direction Sort direction of the product list ("+", "-")
@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 Type of the product list, e.g. default, promotion, etc.
@return MW_Common_Criteria_Interface Criteria object containing the conditions for searching
Returns the default product filter .