protected function _storeProducts( MShop_Order_Item_Base_Interface $basket )
	{
		$position = 1;
		$manager = $this->getSubManager( 'product' );
		$attrManager = $manager->getSubManager( 'attribute' );

		foreach( $basket->getProducts() as $item )
		{
			$baseId = $basket->getId();
			$item->setBaseId( $baseId );

			if( ( $pos = $item->getPosition() ) === null ) {
				$item->setPosition( $position++ );
			} else {
				$position = ++$pos;
			}

			$manager->saveItem( $item );
			$productId = $item->getId();

			foreach( $item->getAttributes() as $attribute )
			{
				$attribute->setProductId( $productId );
				$attrManager->saveItem( $attribute );
			}

			// if the item is a bundle, it probably contains sub-products
			foreach( $item->getProducts() as $subProduct )
			{
				$subProduct->setBaseId( $baseId );
				$subProduct->setOrderProductId( $productId );

				if( ( $pos = $subProduct->getPosition() ) === null ) {
					$subProduct->setPosition( $position++ );
				} else {
					$position = ++$pos;
				}

				$manager->saveItem( $subProduct );
				$subProductId = $subProduct->getId();

				foreach( $subProduct->getAttributes() as $attribute )
				{
					$attribute->setProductId( $subProductId );
					$attrManager->saveItem( $attribute );
				}
			}
		}
	}
protected function _storeProducts( MShop_Order_Item_Base_Interface $basket )
	{
		$position = 1;
		$manager = $this->getSubManager( 'product' );
		$attrManager = $manager->getSubManager( 'attribute' );

		foreach( $basket->getProducts() as $item )
		{
			$baseId = $basket->getId();
			$item->setBaseId( $baseId );

			if( ( $pos = $item->getPosition() ) === null ) {
				$item->setPosition( $position++ );
			} else {
				$position = ++$pos;
			}

			$manager->saveItem( $item );
			$productId = $item->getId();

			foreach( $item->getAttributes() as $attribute )
			{
				$attribute->setProductId( $productId );
				$attrManager->saveItem( $attribute );
			}

			// if the item is a bundle, it probably contains sub-products
			foreach( $item->getProducts() as $subProduct )
			{
				$subProduct->setBaseId( $baseId );
				$subProduct->setOrderProductId( $productId );

				if( ( $pos = $subProduct->getPosition() ) === null ) {
					$subProduct->setPosition( $position++ );
				} else {
					$position = ++$pos;
				}

				$manager->saveItem( $subProduct );
				$subProductId = $subProduct->getId();

				foreach( $subProduct->getAttributes() as $attribute )
				{
					$attribute->setProductId( $subProductId );
					$attrManager->saveItem( $attribute );
				}
			}
		}
	}
protected function _storeProducts ( MShop_Order_Item_Base_Interface $ basket ) { $ position = 1 ; $ manager = $ this -> getSubManager ( 'product' ) ; $ attrManager = $ manager -> getSubManager ( 'attribute' ) ; foreach ( $ basket -> getProducts ( ) as $ item ) { $ baseId = $ basket -> getId ( ) ; $ item -> setBaseId ( $ baseId ) ; if ( ( $ pos = $ item -> getPosition ( ) ) === null ) { $ item -> setPosition ( $ position ++ ) ; } else { $ position = ++ $ pos ; } $ manager -> saveItem ( $ item ) ; $ productId = $ item -> getId ( ) ; foreach ( $ item -> getAttributes ( ) as $ attribute ) { $ attribute -> setProductId ( $ productId ) ; $ attrManager -> saveItem ( $ attribute ) ; } // if the item is a bundle, it probably contains sub-products foreach ( $ item -> getProducts ( ) as $ subProduct ) { $ subProduct -> setBaseId ( $ baseId ) ; $ subProduct -> setOrderProductId ( $ productId ) ; if ( ( $ pos = $ subProduct -> getPosition ( ) ) === null ) { $ subProduct -> setPosition ( $ position ++ ) ; } else { $ position = ++ $ pos ; } $ manager -> saveItem ( $ subProduct ) ; $ subProductId = $ subProduct -> getId ( ) ; foreach ( $ subProduct -> getAttributes ( ) as $ attribute ) { $ attribute -> setProductId ( $ subProductId ) ; $ attrManager -> saveItem ( $ attribute ) ; } } } }
Saves the ordered products to the storage.

@param MShop_Order_Item_Base_Interface $basket Basket containing ordered products or bundles
Saves the ordered products to the storage .