protected function _saveSubProducts( array $items )
	{
		$context = $this->_getContext();
		$default = array( 'attribute', 'price', 'text', 'product' );
		$domains = $context->getConfig()->get( 'mshop/catalog/manager/index/default/domains', $default );
		$size = $context->getConfig()->get( 'mshop/catalog/manager/index/default/chunksize', 1000 );

		$manager = MShop_Factory::createManager( $context, 'product' );
		$search = $manager->createSearch( true );
		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
		$search->setSlice( 0, $size );
		$defaultConditions = $search->getConditions();

		$prodList = array();
		$numSubProducts = 0;

		foreach( $items as $id => $product )
		{
			foreach( $product->getRefItems( 'product', null, 'default' ) as $subId => $subItem )
			{
				$prodList[$subId] = $id;
				$numSubProducts++;
			}

			if( $numSubProducts >= $size )
			{
				$expr = array(
					$search->compare( '==', 'product.id', array_keys( $prodList ) ),
					$defaultConditions,
				);
				$search->setConditions( $search->combine( '&&', $expr ) );

				$this->_saveSubProductsChunk( $search, $domains, $prodList, $size );

				$prodList = array();
				$numSubProducts = 0;
			}
		}

		if( $numSubProducts > 0 )
		{
			$expr = array(
				$search->compare( '==', 'product.id', array_keys( $prodList ) ),
				$defaultConditions,
			);
			$search->setConditions( $search->combine( '&&', $expr ) );

			$this->_saveSubProductsChunk( $search, $domains, $prodList, $size );
		}
	}
protected function _saveSubProducts( array $items )
	{
		$context = $this->_getContext();
		$default = array( 'attribute', 'price', 'text', 'product' );
		$domains = $context->getConfig()->get( 'mshop/catalog/manager/index/default/domains', $default );
		$size = $context->getConfig()->get( 'mshop/catalog/manager/index/default/chunksize', 1000 );

		$manager = MShop_Factory::createManager( $context, 'product' );
		$search = $manager->createSearch( true );
		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
		$search->setSlice( 0, $size );
		$defaultConditions = $search->getConditions();

		$prodList = array();
		$numSubProducts = 0;

		foreach( $items as $id => $product )
		{
			foreach( $product->getRefItems( 'product', null, 'default' ) as $subId => $subItem )
			{
				$prodList[$subId] = $id;
				$numSubProducts++;
			}

			if( $numSubProducts >= $size )
			{
				$expr = array(
					$search->compare( '==', 'product.id', array_keys( $prodList ) ),
					$defaultConditions,
				);
				$search->setConditions( $search->combine( '&&', $expr ) );

				$this->_saveSubProductsChunk( $search, $domains, $prodList, $size );

				$prodList = array();
				$numSubProducts = 0;
			}
		}

		if( $numSubProducts > 0 )
		{
			$expr = array(
				$search->compare( '==', 'product.id', array_keys( $prodList ) ),
				$defaultConditions,
			);
			$search->setConditions( $search->combine( '&&', $expr ) );

			$this->_saveSubProductsChunk( $search, $domains, $prodList, $size );
		}
	}
protected function _saveSubProducts ( array $ items ) { $ context = $ this -> _getContext ( ) ; $ default = array ( 'attribute' , 'price' , 'text' , 'product' ) ; $ domains = $ context -> getConfig ( ) -> get ( 'mshop/catalog/manager/index/default/domains' , $ default ) ; $ size = $ context -> getConfig ( ) -> get ( 'mshop/catalog/manager/index/default/chunksize' , 1000 ) ; $ manager = MShop_Factory :: createManager ( $ context , 'product' ) ; $ search = $ manager -> createSearch ( true ) ; $ search -> setSortations ( array ( $ search -> sort ( '+' , 'product.id' ) ) ) ; $ search -> setSlice ( 0 , $ size ) ; $ defaultConditions = $ search -> getConditions ( ) ; $ prodList = array ( ) ; $ numSubProducts = 0 ; foreach ( $ items as $ id => $ product ) { foreach ( $ product -> getRefItems ( 'product' , null , 'default' ) as $ subId => $ subItem ) { $ prodList [ $ subId ] = $ id ; $ numSubProducts ++ ; } if ( $ numSubProducts >= $ size ) { $ expr = array ( $ search -> compare ( '==' , 'product.id' , array_keys ( $ prodList ) ) , $ defaultConditions , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ this -> _saveSubProductsChunk ( $ search , $ domains , $ prodList , $ size ) ; $ prodList = array ( ) ; $ numSubProducts = 0 ; } } if ( $ numSubProducts > 0 ) { $ expr = array ( $ search -> compare ( '==' , 'product.id' , array_keys ( $ prodList ) ) , $ defaultConditions , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ this -> _saveSubProductsChunk ( $ search , $ domains , $ prodList , $ size ) ; } }
Saves catalog, price, text and attribute of subproduct.

@param array $items Associative list of product IDs and items implementing MShop_Product_Item_Interface
Saves catalog price text and attribute of subproduct .