Index: /lib/wpsg_imagehandler.class.php
===================================================================
--- /lib/wpsg_imagehandler.class.php	(revision 6457)
+++ /lib/wpsg_imagehandler.class.php	(revision 6458)
@@ -27,11 +27,12 @@
         /**
 		 * Gibt die ID des Anhangs zu einem ProduktKey zurÃŒck
+		 * 
 		 * @author Daschmi
 		 * @param $product_key
 		 */
-		public function getAttachmentID($product_key)
+		public function getAttachmentID($product_key, $vari_id = false, $all = false)
 		{
 			
-			$arAttachmentIDs = $this->getAttachmentIDs($product_key);
+			$arAttachmentIDs = $this->getAttachmentIDs($product_key, $vari_id, $all);
 				
 			if (wpsg_isSizedArray($arAttachmentIDs)) return array_values($arAttachmentIDs)[0];
@@ -76,8 +77,20 @@
 		 * Beachtet die Reihenfolge aus der Spalte "postids"
 		 * 
+		 * - Alle Bilder anhand des ProduktKeys:
+		 * getAttachmentIDs('pv_1|1:1|2:3');
+		 * 
+		 * - Alle gesetzten Bilder einer speziellen Variation (Nur gesetzte in Reihenfolge)
+		 * - Hier darf $product_key nur die ID enthalten
+		 * getAttachmentIDs(1, 2)
+		 * 
+		 * - Alle Bilder einer speziellen Variation (In Reihenfolge)
+		 * - Hier darf $product_key nur die ID enthalten
+		 * getAttachmentIDs(1, 2, true)
+		 * 
+		 * 
 		 * @author Daschmi
 		 * @param String $product_key
 		 */
-		public function getAttachmentIDs($product_key, $vari_id = false)
+		public function getAttachmentIDs($product_key, $vari_id = false, $all = false)
 		{
 			
@@ -129,6 +142,6 @@
 				
 				// Daten der Produktvariation laden
-				$db_product_vari = $this->db->fetchRow("SELECT `images` FROM `".WPSG_TBL_PRODUCTS_VARIATION."` WHERE `product_id` = '".wpsg_q($product_id)."' AND `variation_id` = '".wpsg_q($vari_id)."' ");
-				$arAttachmentIDsProductVari = explode(',', $db_product_vari['images']);
+				list($images, $images_set) = array_values($this->db->fetchRow("SELECT `images`, `images_set` FROM `".WPSG_TBL_PRODUCTS_VARIATION."` WHERE `product_id` = '".wpsg_q($product_id)."' AND `variation_id` = '".wpsg_q($vari_id)."' "));
+				$arAttachmentIDsProductVari = explode(',', $images);
 				
 				// Die Elemente, in der Reihenfolge aus $arAttachmentIDs. die auch in $arAttachmentIDsProductVari enthalten sind
@@ -138,5 +151,29 @@
 				$arDiff = array_diff($arAttachmentIDs, $arAttachmentIDsProductVari);
 				$arAttachmentIDs = $arAttachmentIDsIntersect + $arDiff;
-				 				
+				 	
+				if ($all === true)
+				{
+					
+					return array_values($arAttachmentIDs);
+					
+				}
+				else
+				{
+					
+					// Jetzt noch aus der Reihenfolge die gesetzten filtern					
+					$arSet = wpsg_trim(explode(',', $images_set));
+					$arAttachmentIDsReturn = array();
+					
+					foreach ($arSet as $attachment_id)
+					{
+						
+						if (array_search($attachment_id, $arAttachmentIDs)) $arAttachmentIDsReturn[] = $attachment_id;
+						
+					}
+					
+					return array_values($arAttachmentIDsReturn);
+					
+				}
+				
 			}
 			
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6457)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6458)
@@ -2128,4 +2128,36 @@
 
 		/**
+		 * Ersetzt in einem ProduktKey den Wert einer Variante ($var_id) durch die Variation $vari_id
+		 * 
+		 * @param $product_key
+		 * @param $var_id
+		 * @param $vari_id
+		 * @return string
+		 */
+		public function getSimulatedVariKey($product_key, $var_id, $vari_id)
+		{
+			
+			$vari_info = $this->getVariantenInfoArray($product_key);
+			
+			$product_key_return = 'pv_'.$vari_info['product_id'];
+			
+			foreach ($vari_info as $k => $i)
+			{
+				
+				if (is_numeric($k))
+				{
+					
+					if ($var_id == $k) $product_key_return .= '|'.$k.':'.$vari_id;
+					else $product_key_return .= '|'.$k.':'.$i['vari_id'];
+					
+				}
+				
+			}
+			
+			return $product_key_return;			
+			
+		} // public function getSimulatedVariKey($product_key, $vari_id, $vari_value)
+		
+		/**
 		 * Liest die Informationen anhand eines VariantenschlÃŒssels aus
 		 */
@@ -2138,10 +2170,12 @@
 			//$vp_data = $this->loadVarianten($produkt_id);
 			$vp_data = $this->getVariants($produkt_id, true, true, true);
+			
+			$arReturn = array(
+				'product_id' => $produkt_id
+			);
 			
 			$arKey = array();
 			$arAKey = array();
 			$arPics = array();
-
-			$arReturn = array();
 
 			// kein Produkt-Key dann keine Weiterarbeit nÃ¶tig
@@ -2170,5 +2204,5 @@
 
 				/* Bilder dieser Variation */
-				$arImagesVariation = explode(',', $vp_data[$var_id]['arVariation'][$var_value]['images_set']);
+				$arImagesVariation = explode(',', @$vp_data[$var_id]['arVariation'][$var_value]['images_set']);
 				
 				/* Schnittmenge */
Index: /views/mods/mod_productvariants/admin_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/admin_edit.phtml	(revision 6457)
+++ /views/mods/mod_productvariants/admin_edit.phtml	(revision 6458)
@@ -175,5 +175,5 @@
    				<?php 
 				 
-					$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id']);
+					$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['product_id'], $vari['id'], true);
 					
 				?>
Index: /views/mods/mod_productvariants/produkt.phtml
===================================================================
--- /views/mods/mod_productvariants/produkt.phtml	(revision 6457)
+++ /views/mods/mod_productvariants/produkt.phtml	(revision 6458)
@@ -62,30 +62,5 @@
 									<?php } ?>
 								<?php } ?>	
-								</select> 
-								<?php if ($this->get_option("wpsg_vp_showpic") == "1") { ?>
-									<span class="wpsg_vp_field_image">				
-										<?php foreach ($var['arVariation'] as $kv => $vari) { 
-											if ($vari['active'] == "1" && isset($vari['showpic'])) { ?>
-												<span class="wpsg_vp_image wpsg_vp_image_<?php echo $kv; ?>" style="display:<?php echo (($this->view['wpsg_mod_productvariants']['set'][$k] == $kv)?'block':'none'); ?>;">
-													
-													<?php 
-													if (isset($this->view['data']['product_key'])) {
-														$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
-														$attachmentID = $this->imagehandler->getAttachmentID($this->view['data']['product_key']);
-														
-														echo wp_get_attachment_image($attachmentID, 'medium');
-														
-													}
-													
-													$pbw = $this->get_option("wpsg_vp_showpic_width");
-													$pbh = $this->get_option("wpsg_vp_showpic_height");
-													$img_src = $vari['guid'];
-													?><img src="<?php echo $img_src; ?>" width="<?php echo $pbw; ?>" height="<?php echo $pbh; ?>" alt="" />
-																			
-												</span>
-											<?php } ?>
-										<?php } ?>
-									</span>
-								<?php } ?>		
+								</select>
 							</label>
 						<?php } /* SELECT-Box ENDE */ ?>
@@ -95,18 +70,15 @@
 							<div class="wpsg_mod_productvariants_imageselect wpsg_mod_productvariants_imageselect_<?php echo $k; ?>">
 							<span>
-								<input type="hidden" name="wpsg_vp[<?php echo $k; ?>]" id="wpsg_vp_<?php echo $k; ?>" value="<?php echo wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]); ?>" />
+								<input type="hidden" name="wpsg_vp[<?php echo $k; ?>]" id="wpsg_vp_<?php echo $k; ?>" value="<?php echo wpsg_getStr($this->view['vp_info'][$k]['vari_id']); ?>" />
 								<?php $kkv = -1; foreach ($var['arVariation'] as $kv => $vari) { $kkv++;
 									if ($vari['active'] == '1' && (!$this->hasMod('wpsg_mod_stock') || $vari['stock'] > 0)) { ?>
 
-										<?php
-										if (isset($this->view['data']['product_key'])) {
-											$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
-											$attachmentID = $this->imagehandler->getAttachmentID($this->view['data']['product_key']);
-											?>
-											<a data-wpsg-id="<?php echo $kv; ?>" class="wpsg_vp_update_image image <?php echo ((wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]) == $kv)?'akt':''); ?>" href="#">
-												<?php echo wp_get_attachment_image($attachmentID, 'thumbnail'); ?>
-											</a>
-											
-										<?php } ?>
+										<?php $simulated_product_key = $this->callMod('wpsg_mod_productvariants', 'getSimulatedVariKey', array($this->view['data']['product_key'], $var['id'], $vari['id'])); ?>
+										<?php $attachmentID = $this->imagehandler->getAttachmentID($simulated_product_key); ?>
+										
+										<a data-wpsg-id="<?php echo $kv; ?>" class="wpsg_vp_update_image image <?php echo ((wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$k]) == $kv)?'akt':''); ?>" href="#">
+											<?php echo wp_get_attachment_image($attachmentID, 'thumbnail'); ?>
+										</a>
+											 
 										
 									<?php } ?>
@@ -123,5 +95,5 @@
 									
 										<?php if (!$this->hasMod('wpsg_mod_stock') || $vari['stock'] > 0) { ?>
-											<input <?php echo ((wpsg_getStr($this->view['wpsg_mod_productvariants']['set'][$kk]) == $kv)?'checked="checked"':''); ?> 
+											<input <?php echo ((wpsg_getStr($this->view['vp_info'][$k]['vari_id']) == $kv)?'checked="checked"':''); ?> 
 											id="wpsg_vpfield_<?php echo $this->getProduktId($this->view['data']['id']); ?>_<?php echo $k; ?>_<?php echo $j; ?>" 
 											onclick="wpsg_vp_switch(<?php echo $this->getProduktId($this->view['data']['id']); ?>, <?php echo $this->view['product_index']; ?>, this);" 
@@ -144,15 +116,4 @@
 										<?php /* Abfrage ENDE */ ?>
 											
-											<?php if ($this->get_option("wpsg_vp_showpic") == "1" && isset($vari['showpic']) && $vari['showpic'] != false) { ?>
-											<span class="wpsg_vp_field_image">
-											
-												<?php 
-												$pbw = $this->get_option("wpsg_vp_showpic_width");
-												$pbh = $this->get_option("wpsg_vp_showpic_height");
-												$img_src = $vari['guid'];
-												?><img src="<?php echo $img_src; ?>" width="<?php echo $pbw; ?>" height="<?php echo $pbh; ?>" alt="" />
-												
-											</span>
-											<?php } /* if image */ ?>		
 									</label>
 								<?php } /* If aktiv && stock */ ?>
Index: /views/produkttemplates/standard.phtml
===================================================================
--- /views/produkttemplates/standard.phtml	(revision 6457)
+++ /views/produkttemplates/standard.phtml	(revision 6458)
@@ -13,5 +13,5 @@
 	$arAttachmentIDs = $this->imagehandler->getAttachmentIDs($this->view['data']['product_key']);
 	$arAttachmentIDsAll = $this->imagehandler->getAttachmentIDs($this->view['data']['product_id']);
-		
+
 ?>
 
