protected function _getAttributeIds( array $colors )
	{
		$context = $this->_getContext();


		$attrTypeItem = $this->_getTypeItem( 'attribute/type', 'product', 'color' );
		$mediaTypeItem = $this->_getTypeItem( 'media/type', 'attribute', 'default' );
		$attrListTypeItem = $this->_getTypeItem( 'attribute/list/type', 'media', 'default' );


		$mediaManager = MShop_Factory::createManager( $context, 'media' );

		$mediaItem = $mediaManager->createItem();
		$mediaItem->setTypeId( $mediaTypeItem->getId() );
		$mediaItem->setDomain( 'attribute' );
		$mediaItem->setStatus( 1 );
		$mediaItem->setUrl( '' );


		$attrManager = MShop_Factory::createManager( $context, 'attribute' );

		$attrItem = $attrManager->createItem();
		$attrItem->setTypeId( $attrTypeItem->getId() );
		$attrItem->setDomain( 'product' );
		$attrItem->setStatus( 1 );


		$attrListManager = MShop_Factory::createManager( $context, 'attribute/list' );

		$attrListItem = $attrListManager->createItem();
		$attrListItem->setTypeId( $attrListTypeItem->getId() );
		$attrListItem->setDomain( 'media' );
		$attrListItem->setStatus( 1 );


		$pos = 0;
		$mime = '';
		$attrList = array();

		foreach( $colors as $code => $name )
		{
			$imageData = $this->_getImageData( $code, $mime );

			$attrItem->setId( null );
			$attrItem->setCode( $code );
			$attrItem->setLabel( $name );
			$attrItem->setPosition( $pos++ );
			$attrManager->saveItem( $attrItem );

			$mediaItem->setId( null );
			$mediaItem->setLabel( $name );
			$mediaItem->setMimetype( $mime );
			$mediaItem->setPreview( $imageData );
			$mediaManager->saveItem( $mediaItem );

			$attrListItem->setId( null );
			$attrListItem->setParentId( $attrItem->getId() );
			$attrListItem->setRefId( $mediaItem->getId() );
			$attrListManager->saveItem( $attrListItem, false );

			$attrList[] = $attrItem->getId();
		}

		return $attrList;
	}
protected function _getAttributeIds( array $colors )
	{
		$context = $this->_getContext();


		$attrTypeItem = $this->_getTypeItem( 'attribute/type', 'product', 'color' );
		$mediaTypeItem = $this->_getTypeItem( 'media/type', 'attribute', 'default' );
		$attrListTypeItem = $this->_getTypeItem( 'attribute/list/type', 'media', 'default' );


		$mediaManager = MShop_Factory::createManager( $context, 'media' );

		$mediaItem = $mediaManager->createItem();
		$mediaItem->setTypeId( $mediaTypeItem->getId() );
		$mediaItem->setDomain( 'attribute' );
		$mediaItem->setStatus( 1 );
		$mediaItem->setUrl( '' );


		$attrManager = MShop_Factory::createManager( $context, 'attribute' );

		$attrItem = $attrManager->createItem();
		$attrItem->setTypeId( $attrTypeItem->getId() );
		$attrItem->setDomain( 'product' );
		$attrItem->setStatus( 1 );


		$attrListManager = MShop_Factory::createManager( $context, 'attribute/list' );

		$attrListItem = $attrListManager->createItem();
		$attrListItem->setTypeId( $attrListTypeItem->getId() );
		$attrListItem->setDomain( 'media' );
		$attrListItem->setStatus( 1 );


		$pos = 0;
		$mime = '';
		$attrList = array();

		foreach( $colors as $code => $name )
		{
			$imageData = $this->_getImageData( $code, $mime );

			$attrItem->setId( null );
			$attrItem->setCode( $code );
			$attrItem->setLabel( $name );
			$attrItem->setPosition( $pos++ );
			$attrManager->saveItem( $attrItem );

			$mediaItem->setId( null );
			$mediaItem->setLabel( $name );
			$mediaItem->setMimetype( $mime );
			$mediaItem->setPreview( $imageData );
			$mediaManager->saveItem( $mediaItem );

			$attrListItem->setId( null );
			$attrListItem->setParentId( $attrItem->getId() );
			$attrListItem->setRefId( $mediaItem->getId() );
			$attrListManager->saveItem( $attrListItem, false );

			$attrList[] = $attrItem->getId();
		}

		return $attrList;
	}
protected function _getAttributeIds ( array $ colors ) { $ context = $ this -> _getContext ( ) ; $ attrTypeItem = $ this -> _getTypeItem ( 'attribute/type' , 'product' , 'color' ) ; $ mediaTypeItem = $ this -> _getTypeItem ( 'media/type' , 'attribute' , 'default' ) ; $ attrListTypeItem = $ this -> _getTypeItem ( 'attribute/list/type' , 'media' , 'default' ) ; $ mediaManager = MShop_Factory :: createManager ( $ context , 'media' ) ; $ mediaItem = $ mediaManager -> createItem ( ) ; $ mediaItem -> setTypeId ( $ mediaTypeItem -> getId ( ) ) ; $ mediaItem -> setDomain ( 'attribute' ) ; $ mediaItem -> setStatus ( 1 ) ; $ mediaItem -> setUrl ( '' ) ; $ attrManager = MShop_Factory :: createManager ( $ context , 'attribute' ) ; $ attrItem = $ attrManager -> createItem ( ) ; $ attrItem -> setTypeId ( $ attrTypeItem -> getId ( ) ) ; $ attrItem -> setDomain ( 'product' ) ; $ attrItem -> setStatus ( 1 ) ; $ attrListManager = MShop_Factory :: createManager ( $ context , 'attribute/list' ) ; $ attrListItem = $ attrListManager -> createItem ( ) ; $ attrListItem -> setTypeId ( $ attrListTypeItem -> getId ( ) ) ; $ attrListItem -> setDomain ( 'media' ) ; $ attrListItem -> setStatus ( 1 ) ; $ pos = 0 ; $ mime = '' ; $ attrList = array ( ) ; foreach ( $ colors as $ code => $ name ) { $ imageData = $ this -> _getImageData ( $ code , $ mime ) ; $ attrItem -> setId ( null ) ; $ attrItem -> setCode ( $ code ) ; $ attrItem -> setLabel ( $ name ) ; $ attrItem -> setPosition ( $ pos ++ ) ; $ attrManager -> saveItem ( $ attrItem ) ; $ mediaItem -> setId ( null ) ; $ mediaItem -> setLabel ( $ name ) ; $ mediaItem -> setMimetype ( $ mime ) ; $ mediaItem -> setPreview ( $ imageData ) ; $ mediaManager -> saveItem ( $ mediaItem ) ; $ attrListItem -> setId ( null ) ; $ attrListItem -> setParentId ( $ attrItem -> getId ( ) ) ; $ attrListItem -> setRefId ( $ mediaItem -> getId ( ) ) ; $ attrListManager -> saveItem ( $ attrListItem , false ) ; $ attrList [ ] = $ attrItem -> getId ( ) ; } return $ attrList ; }
Creates and returns the attribute IDs for the given attribute codes.

@param array $colors List of attribute codes
@throws Exception If a type isn't found
Creates and returns the attribute IDs for the given attribute codes .