Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6264)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6265)
@@ -217,5 +217,6 @@
 			
 			$product_data['arVariant'] = $this->getVariants($product_data['product_id'], true, true, true);
-
+			$this->unserializeVariant($product_data['arVariant']);
+			
 			if (wpsg_isSizedArray($product_data['arVariant']))
 			{
@@ -261,7 +262,17 @@
 						if ($arProductKey['arVari'][$var_id] == $vari_id)
 						{
-							if (isset($vari_data['images']['pic'])) {
-								if (wpsg_isSizedArray($arProductImagesPossible)) $arProductImagesPossible = array_intersect($arProductImagesPossible, $vari_data['images']['pic']);
-								else if (wpsg_isSizedArray($vari_data['images']['pic'])) $arProductImagesPossible = $vari_data['images']['pic'];
+
+							$pics = unserialize($vari_data['images']);
+							$pic = explode(',', $pics['pic']);
+							unset($pic[0]);
+							//$vari_data['images'] = array('pic' => array());
+							//$vari_data['images']['pic'] = $pic;
+							$vari_data['pics'] = $pic;
+							$test = array();
+							$test = array_intersect($test, $vari_data['images']['pic']);
+							
+							if (isset($vari_data['pics'])) {
+								if (wpsg_isSizedArray($arProductImagesPossible)) $arProductImagesPossible = array_intersect($arProductImagesPossible, $vari_data['pics']);
+								else if (wpsg_isSizedArray($vari_data['pics'])) $arProductImagesPossible = $vari_data['pics'];
 			
 							}
Index: /mods/wpsg_mod_produktbilder.class.php
===================================================================
--- /mods/wpsg_mod_produktbilder.class.php	(revision 6264)
+++ /mods/wpsg_mod_produktbilder.class.php	(revision 6265)
@@ -546,4 +546,9 @@
 							$this->shop->view['ProduktBilder_MT'][$i]['guid'] = $guid;
 							
+							$file = $arrf['basename'];
+							$pos1 = strrpos($file, '-');
+							$pos2 = strrpos($file, '.');
+							$this->shop->view['ProduktBilder_MT'][$i]['basenameori']= substr_replace($file, '', $pos1, $pos2 - $pos1);
+							
 						}
 					}
@@ -626,5 +631,5 @@
 			$product_id = $this->shop->getProduktID($product_key);
 			
-			$data = $this->db->fetchAssoc("SELECT * FROM `".$wpdb->prefix."postmeta` WHERE `meta_key` = '".wpsg_q('wpsg_produkt_id')."' AND `meta_value` = '".wpsg_q($product_id)."' ");
+			$data = $this->db->fetchAssoc("SELECT * FROM `".$wpdb->prefix."postmeta` WHERE `meta_key` = '".wpsg_q('wpsg_produkt_id')."' AND `meta_value` = '".wpsg_q($product_id)."' ORDER BY `post_id`");
 				
 			if (!wpsg_isSizedArray($data)) return false;
@@ -632,6 +637,45 @@
 			$p = wp_get_attachment_image_src($data[0]['post_id'], $size);	// Array mit Full-Path, Width, Height
 					
+			// Umsortiert, wenn Feld postids existiert
+			$postids = $this->db->fetchOne("SELECT `postids` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id`=".wpsg_q($product_id));
+			$arPostids = explode(',', $postids);
+			$postid = $arPostids[0];
+			if (wpsg_isSizedString($postids)) {
+					
+					for ($i = 0; $i < count($data); $i++) {
+						if ($data[$i]['post_id'] == $postid) {
+							
+							$p = wp_get_attachment_image_src($data[$i]['post_id'], $size);	// Array mit Full-Path, Width, Height
+						}
+					}
+				
+			}
+			
+			// Wenn product_key dann das Bild der Variation holen.
+			if (!is_integer($product_key)) {
+				
+				$ap = explode(':', $product_key);
+				$vid = $ap[count($ap) - 1];
+				$images = $this->db->fetchOne("SELECT `images` FROM `".WPSG_TBL_PRODUCTS_VARIATION."` WHERE `variation_id`=".wpsg_q($vid));
+				$ai = explode(',', $images);
+				$af = pathinfo($ai[count($ai) - 1], PATHINFO_FILENAME);
+				
+				$sql = "SELECT
+					P.`ID`, P.`post_title`, P.`guid`, PM.`post_id`, PM.`meta_key`, PM.`meta_value`
+					FROM `".$wpdb->prefix."posts` AS P
+					LEFT JOIN `".$wpdb->prefix."postmeta` AS PM ON (P.`ID` = PM.`post_id`)
+					WHERE
+					PM.`meta_key` = 'wpsg_produkt_id' AND
+					PM.`meta_value` = '".wpsg_q($product_id)."' AND
+					P.`post_title` = '".$af."'
+				";
+				$arr = $this->db->fetchAssoc($sql);
+				
+				$p = wp_get_attachment_image_src($arr[0]['ID'], 'medium');
+				
+			}
+			
 			$img_url = $p[0];
-				
+			
 			return $img_url;
 				
@@ -703,4 +747,9 @@
 							$arFiles[$i]['post_id'] = $data[$i]['post_id'];
 							$arFiles[$i]['basename'] = $arrf['basename'];
+							$file = $arrf['basename'];
+							$pos1 = strrpos($file, '-');
+							$pos2 = strrpos($file, '.');
+							$arFiles[$i]['basenameori']= substr_replace($file, '', $pos1, $pos2 - $pos1);
+							
 							$arFiles[$i]['url'] = $guid;
 							$arFiles[$i]['path'] = str_replace($ud['baseurl'], $ud['basedir'], $guid);
Index: /views/mods/mod_productvariants/admin_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/admin_edit.phtml	(revision 6264)
+++ /views/mods/mod_productvariants/admin_edit.phtml	(revision 6265)
@@ -182,9 +182,5 @@
 					<?php $j = 0; foreach ($temp as $b) { $j ++; ?>
 							<?php // $this->view['variant']['id']	$vari  $var  $kv  $_REQUEST['pic']
-							$file = $b['basename'];
-							$pos1 = strrpos($file, '-');
-							$pos2 = strrpos($file, '.');
-							$file2 = substr_replace($file, '', $pos1, $pos2 - $pos1);
-
+							$file2 = $b['basenameori'];
 							$href = wp_get_attachment_image_src($b['post_id'], Array(25, 25));
 							?>	
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 6264)
+++ /views/warenkorb/basket.phtml	(revision 6265)
@@ -73,7 +73,13 @@
 					<div class="wpsg_basket_productimage">
 						<?php if (wpsg_isSizedString($arBilder[0]['guid'])) { ?>
+						/*
 						<?php $href = wp_get_attachment_image_src($arBilder[0]['post_id'], Array(30, 30)); ?>
 						<?php $imgtag = wp_get_attachment_image($arBilder[0]['post_id'], Array(30, 30)); ?>
 						<img src="<?php echo $href[0]; ?>" width="30" height="30" alt="<?php echo wpsg_hspc((($p['detailname'] != '')?$p['detailname']:$p['name'])); ?>" />
+						*/
+						
+						$url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'medium'));
+						echo "<img src=".$url." alt='' />";
+						
 						<?php } ?>
 					</div>
Index: /views/warenkorb/overview.phtml
===================================================================
--- /views/warenkorb/overview.phtml	(revision 6264)
+++ /views/warenkorb/overview.phtml	(revision 6265)
@@ -146,8 +146,16 @@
 						?>
 						<div class="wpsg_overview_productimage">
+							
 							<?php if (wpsg_isSizedString($arBilder[0]['guid'])) { ?>
+							/*
 							<?php $href = wp_get_attachment_image_src($arBilder[0]['post_id'], Array(30, 30)); ?>
 							<?php $imgtag = wp_get_attachment_image($arBilder[0]['post_id'], Array(30, 30)); ?>
-							<img src="<?php echo $href[0]; ?>" width="30" height="30" alt="<?php echo wpsg_hspc((($p['detailname'] != '')?$p['detailname']:$p['name'])); ?>" />
+							*/
+							
+							<?php $img_url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'thumbnail')); ?>
+							<?php if ($img_url !== false) { ?>
+							   <img class="theme_border_color_2 theme_color_2" src="<?php echo $img_url; ?>" alt="<?php echo wpsg_translate(__('Produktbilder von Produkte #1#', 'wspg'), $p['name']); ?>" />
+							<?php } ?>
+							
 							<?php } ?>
 						</div>
