admin/jqadm/src/Admin/JQAdm/Product/Media/Standard.php
protected function addMediaAttributes( \Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems )
	{
		$listManager = \Aimeos\MShop::create( $this->getContext(), 'media/lists' );
		$listItems = $mediaItem->getListItems( 'attribute', 'variant', null, false );

		foreach( $attrListItems as $listItem )
		{
			if( ( $litem = $mediaItem->getListItem( 'attribute', 'variant', $listItem->getRefId(), false ) ) !== null )
			{
				unset( $listItems[$litem->getId()] );
				continue;
			}

			$litem = $listManager->createItem()->setType( 'variant' )->setRefId( $listItem->getRefId() );
			$mediaItem->addListItem( 'attribute', $litem );
		}

		return $mediaItem->deleteListItems( $listItems );
	}
protected function addMediaAttributes( \Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems )
	{
		$listManager = \Aimeos\MShop::create( $this->getContext(), 'media/lists' );
		$listItems = $mediaItem->getListItems( 'attribute', 'variant', null, false );

		foreach( $attrListItems as $listItem )
		{
			if( ( $litem = $mediaItem->getListItem( 'attribute', 'variant', $listItem->getRefId(), false ) ) !== null )
			{
				unset( $listItems[$litem->getId()] );
				continue;
			}

			$litem = $listManager->createItem()->setType( 'variant' )->setRefId( $listItem->getRefId() );
			$mediaItem->addListItem( 'attribute', $litem );
		}

		return $mediaItem->deleteListItems( $listItems );
	}
protected function addMediaAttributes ( \ Aimeos \ MShop \ Media \ Item \ Iface $ mediaItem , array $ attrListItems ) { $ listManager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'media/lists' ) ; $ listItems = $ mediaItem -> getListItems ( 'attribute' , 'variant' , null , false ) ; foreach ( $ attrListItems as $ listItem ) { if ( ( $ litem = $ mediaItem -> getListItem ( 'attribute' , 'variant' , $ listItem -> getRefId ( ) , false ) ) !== null ) { unset ( $ listItems [ $ litem -> getId ( ) ] ) ; continue ; } $ litem = $ listManager -> createItem ( ) -> setType ( 'variant' ) -> setRefId ( $ listItem -> getRefId ( ) ) ; $ mediaItem -> addListItem ( 'attribute' , $ litem ) ; } return $ mediaItem -> deleteListItems ( $ listItems ) ; }
Adds the product variant attributes to the media item
Then, the images will only be shown if the customer selected the product variant

@param \Aimeos\MShop\Media\Item\Iface $mediaItem Media item, maybe with referenced attribute items
@param \Aimeos\MShop\Common\Item\Lists\Iface[] $attrListItems Product list items referencing variant attributes
@return \Aimeos\MShop\Media\Item\Iface Modified media item
Adds the product variant attributes to the media item Then the images will only be shown if the customer selected the product variant