protected function _saveAttributes( array $attributes, MShop_Order_Item_Base_Service_Interface $serviceItem, $type = 'payment/paypal' )
	{
		$attributeManager = MShop_Factory::createManager( $this->_getContext(), 'order/base/service/attribute' );

		$map = array();
		foreach( $serviceItem->getAttributes() as $attributeItem ) {
			$map[ $attributeItem->getCode() ] = $attributeItem;
		}

		foreach( $attributes as $code => $value )
		{
			if( array_key_exists( $code, $map ) !== true )
			{
				$attributeItem = $attributeManager->createItem();
				$attributeItem->setServiceId( $serviceItem->getId() );
				$attributeItem->setCode( $code );
				$attributeItem->setType( $type );
			}
			else
			{
				$attributeItem = $map[$code];
			}

			$attributeItem->setValue( $value );
			$attributeManager->saveItem( $attributeItem );
		}
	}
protected function _saveAttributes( array $attributes, MShop_Order_Item_Base_Service_Interface $serviceItem, $type = 'payment/paypal' )
	{
		$attributeManager = MShop_Factory::createManager( $this->_getContext(), 'order/base/service/attribute' );

		$map = array();
		foreach( $serviceItem->getAttributes() as $attributeItem ) {
			$map[ $attributeItem->getCode() ] = $attributeItem;
		}

		foreach( $attributes as $code => $value )
		{
			if( array_key_exists( $code, $map ) !== true )
			{
				$attributeItem = $attributeManager->createItem();
				$attributeItem->setServiceId( $serviceItem->getId() );
				$attributeItem->setCode( $code );
				$attributeItem->setType( $type );
			}
			else
			{
				$attributeItem = $map[$code];
			}

			$attributeItem->setValue( $value );
			$attributeManager->saveItem( $attributeItem );
		}
	}
protected function _saveAttributes ( array $ attributes , MShop_Order_Item_Base_Service_Interface $ serviceItem , $ type = 'payment/paypal' ) { $ attributeManager = MShop_Factory :: createManager ( $ this -> _getContext ( ) , 'order/base/service/attribute' ) ; $ map = array ( ) ; foreach ( $ serviceItem -> getAttributes ( ) as $ attributeItem ) { $ map [ $ attributeItem -> getCode ( ) ] = $ attributeItem ; } foreach ( $ attributes as $ code => $ value ) { if ( array_key_exists ( $ code , $ map ) !== true ) { $ attributeItem = $ attributeManager -> createItem ( ) ; $ attributeItem -> setServiceId ( $ serviceItem -> getId ( ) ) ; $ attributeItem -> setCode ( $ code ) ; $ attributeItem -> setType ( $ type ) ; } else { $ attributeItem = $ map [ $ code ] ; } $ attributeItem -> setValue ( $ value ) ; $ attributeManager -> saveItem ( $ attributeItem ) ; } }
Saves a list of attributes for the order service.

@param array $attributes Attributes which have to be saved
@param MShop_Order_Item_Base_Service_Interface $serviceItem Service Item which saves the attributes
Saves a list of attributes for the order service .