protected function _getProductVariants( MShop_Product_Item_Interface $productItem, array $variantAttributeIds,
		array $domains = array( 'attribute', 'media', 'price', 'text' ) )
	{
		$subProductIds = array();
		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
			$subProductIds[] = $item->getId();
		}

		if( count( $subProductIds ) === 0 ) {
			return array();
		}

		$productManager = MShop_Factory::createManager( $this->_getContext(), 'product' );
		$search = $productManager->createSearch( true );

		$expr = array(
			$search->compare( '==', 'product.id', $subProductIds ),
			$search->getConditions(),
		);

		if( count( $variantAttributeIds ) > 0 )
		{
			$listTypeItem = $this->_getProductListTypeItem( 'attribute', 'variant' );

			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
			$cmpfunc = $search->createFunction( 'product.contains', $param );

			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
		}

		$search->setConditions( $search->combine( '&&', $expr ) );

		return $productManager->searchItems( $search, $domains );
	}
protected function _getProductVariants( MShop_Product_Item_Interface $productItem, array $variantAttributeIds,
		array $domains = array( 'attribute', 'media', 'price', 'text' ) )
	{
		$subProductIds = array();
		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
			$subProductIds[] = $item->getId();
		}

		if( count( $subProductIds ) === 0 ) {
			return array();
		}

		$productManager = MShop_Factory::createManager( $this->_getContext(), 'product' );
		$search = $productManager->createSearch( true );

		$expr = array(
			$search->compare( '==', 'product.id', $subProductIds ),
			$search->getConditions(),
		);

		if( count( $variantAttributeIds ) > 0 )
		{
			$listTypeItem = $this->_getProductListTypeItem( 'attribute', 'variant' );

			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
			$cmpfunc = $search->createFunction( 'product.contains', $param );

			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
		}

		$search->setConditions( $search->combine( '&&', $expr ) );

		return $productManager->searchItems( $search, $domains );
	}
protected function _getProductVariants ( MShop_Product_Item_Interface $ productItem , array $ variantAttributeIds , array $ domains = array ( 'attribute' , 'media' , 'price' , 'text' ) ) { $ subProductIds = array ( ) ; foreach ( $ productItem -> getRefItems ( 'product' , 'default' , 'default' ) as $ item ) { $ subProductIds [ ] = $ item -> getId ( ) ; } if ( count ( $ subProductIds ) === 0 ) { return array ( ) ; } $ productManager = MShop_Factory :: createManager ( $ this -> _getContext ( ) , 'product' ) ; $ search = $ productManager -> createSearch ( true ) ; $ expr = array ( $ search -> compare ( '==' , 'product.id' , $ subProductIds ) , $ search -> getConditions ( ) , ) ; if ( count ( $ variantAttributeIds ) > 0 ) { $ listTypeItem = $ this -> _getProductListTypeItem ( 'attribute' , 'variant' ) ; $ param = array ( 'attribute' , $ listTypeItem -> getId ( ) , $ variantAttributeIds ) ; $ cmpfunc = $ search -> createFunction ( 'product.contains' , $ param ) ; $ expr [ ] = $ search -> compare ( '==' , $ cmpfunc , count ( $ variantAttributeIds ) ) ; } $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; return $ productManager -> searchItems ( $ search , $ domains ) ; }
Returns the product variants of a selection product that match the given attributes.

@param MShop_Product_Item_Interface $productItem Product item including sub-products
@param array $variantAttributeIds IDs for the variant-building attributes
@param array $domains Names of the domain items that should be fetched too
@return array List of products matching the given attributes
Returns the product variants of a selection product that match the given attributes .