public function searchItems( MW_Common_Criteria_Interface $search, array $ref = array(), &$total = null )
	{
		$items = $ids = array();
		$context = $this->_getContext();

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$level = MShop_Locale_Manager_Abstract::SITE_ALL;
			$cfgPathSearch = 'mshop/catalog/manager/index/text/default/item/search';
			$cfgPathCount = 'mshop/catalog/manager/index/text/default/item/count';
			$required = array( 'product' );

			$results = $this->_searchItems( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );

			while( ( $row = $results->fetch() ) !== false )	{
				$ids[] = $row['id'];
			}

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		$manager = MShop_Factory::createManager( $context, 'product' );
		$search = $manager->createSearch();
		$search->setConditions( $search->compare('==', 'product.id', $ids) );
		$products = $manager->searchItems( $search, $ref, $total );

		foreach( $ids as $id )
		{
			if( isset( $products[$id] ) ) {
				$items[ $id ] = $products[ $id ];
			}
		}

		return $items;
	}
public function searchItems( MW_Common_Criteria_Interface $search, array $ref = array(), &$total = null )
	{
		$items = $ids = array();
		$context = $this->_getContext();

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$level = MShop_Locale_Manager_Abstract::SITE_ALL;
			$cfgPathSearch = 'mshop/catalog/manager/index/text/default/item/search';
			$cfgPathCount = 'mshop/catalog/manager/index/text/default/item/count';
			$required = array( 'product' );

			$results = $this->_searchItems( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );

			while( ( $row = $results->fetch() ) !== false )	{
				$ids[] = $row['id'];
			}

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		$manager = MShop_Factory::createManager( $context, 'product' );
		$search = $manager->createSearch();
		$search->setConditions( $search->compare('==', 'product.id', $ids) );
		$products = $manager->searchItems( $search, $ref, $total );

		foreach( $ids as $id )
		{
			if( isset( $products[$id] ) ) {
				$items[ $id ] = $products[ $id ];
			}
		}

		return $items;
	}
public function searchItems ( MW_Common_Criteria_Interface $ search , array $ ref = array ( ) , & $ total = null ) { $ items = $ ids = array ( ) ; $ context = $ this -> _getContext ( ) ; $ dbm = $ context -> getDatabaseManager ( ) ; $ dbname = $ this -> _getResourceName ( ) ; $ conn = $ dbm -> acquire ( $ dbname ) ; try { $ level = MShop_Locale_Manager_Abstract :: SITE_ALL ; $ cfgPathSearch = 'mshop/catalog/manager/index/text/default/item/search' ; $ cfgPathCount = 'mshop/catalog/manager/index/text/default/item/count' ; $ required = array ( 'product' ) ; $ results = $ this -> _searchItems ( $ conn , $ search , $ cfgPathSearch , $ cfgPathCount , $ required , $ total , $ level ) ; while ( ( $ row = $ results -> fetch ( ) ) !== false ) { $ ids [ ] = $ row [ 'id' ] ; } $ dbm -> release ( $ conn , $ dbname ) ; } catch ( Exception $ e ) { $ dbm -> release ( $ conn , $ dbname ) ; throw $ e ; } $ manager = MShop_Factory :: createManager ( $ context , 'product' ) ; $ search = $ manager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'product.id' , $ ids ) ) ; $ products = $ manager -> searchItems ( $ search , $ ref , $ total ) ; foreach ( $ ids as $ id ) { if ( isset ( $ products [ $ id ] ) ) { $ items [ $ id ] = $ products [ $ id ] ; } } return $ items ; }
Searches for items matching the given criteria.

@param MW_Common_Criteria_Interface $search Search criteria
@param array $ref List of domains to fetch list items and referenced items for
@param integer &$total Total number of items matched by the given criteria
@return array List of items implementing MShop_Product_Item_Interface with ids as keys
Searches for items matching the given criteria .