Index: /lib/wpsg_imagehandler.class.php
===================================================================
--- /lib/wpsg_imagehandler.class.php	(revision 6688)
+++ /lib/wpsg_imagehandler.class.php	(revision 6689)
@@ -116,5 +116,8 @@
 			  		P.`ID` IS NOT NULL
 			");
-			
+
+            // Keine Sortierung, dann nach IDs, Sortierung kommt weiter unten
+            asort($arAttachmentIDs);
+            
 			// Die Sortierung steht in der Spalte postids im Produkt
 			$postids = $this->db->fetchOne("SELECT `postids` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($product_id)."' ");
@@ -133,5 +136,5 @@
 				
 				
-			} 
+			}  
 			 
 			// Jetzt sind in $arAttachmentIDs alle Bilder dieses Produktes
@@ -198,58 +201,5 @@
         {
             
-            global $wpdb;
-			
-			$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`");
-			$postids = $this->db->fetchOne("SELECT `postids` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id`=".wpsg_q($product_id));
-			$arPostids = explode(',', $postids);
-			
-			$wp_upload_dir = wp_upload_dir();
-			$url = $wp_upload_dir['url'];
-			$i = 0;
-			
-			if (wpsg_isSizedString($postids)) {
-				foreach ($arPostids as $postid) {
-					
-					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
-							$guid = $p[0];
-							$arrf = pathinfo($guid);
-							$this->shop->view['ProduktBilder_MT'][$i]['pid'] = $data[$i]['post_id'];
-							$this->shop->view['ProduktBilder_MT'][$i]['fname'] = $arrf['basename'];
-							$this->shop->view['ProduktBilder_MT'][$i]['guid'] = $guid;
-							
-							$file = $arrf['basename'];
-							$pos1 = strrpos($file, '-');
-							if ($pos1 !== false) {
-								$pos2 = strrpos($file, '.');
-								//$file = substr_replace($file, '', $pos1, $pos2 - $pos1);
-							}
-							$file = preg_replace('/\-(\d+)x(\d+)\./', '.', $file);
-							$this->shop->view['ProduktBilder_MT'][$i]['basenameori']= $file;
-							
-						}
-					}
-				}
-				
-			} else {
-				foreach ($data as $key => $val) {
-					/*
-					$p1 = wp_get_attachment_url($val['ID']);
-					$arrf = pathinfo($p1);
-					$this->shop->view['ProduktBilder_MT'][$i]['fname'] = $arrf['basename'];
-					$guid = $arrf['dirname'].'/'.$arrf['filename'].'-150x150.'.$arrf['extension'];
-					*/
-					$p = wp_get_attachment_image_src($val['post_id'], $size);	// Array mit Full-Path, Width, Height
-					$guid = $p[0];
-					$arrf = pathinfo($guid);
-					$this->shop->view['ProduktBilder_MT'][$i]['pid'] = $val['post_id'];
-					$this->shop->view['ProduktBilder_MT'][$i]['fname'] = $arrf['basename'];
-					$this->shop->view['ProduktBilder_MT'][$i]['guid'] = $guid;
-					$file = preg_replace('/\-(\d+)x(\d+)\./', '.', $arrf['basename']);
-					$this->shop->view['ProduktBilder_MT'][$i]['basenameori']= $file;
-					$i++;
-				}
-			}
+            $this->shop->view['productImages'] = $this->getAttachmentIDs($product_id);
             
 			return $this->shop->render(WPSG_PATH_VIEW.'/produkt/images_list.phtml', false);
Index: /views/produkt/images_list.phtml
===================================================================
--- /views/produkt/images_list.phtml	(revision 6688)
+++ /views/produkt/images_list.phtml	(revision 6689)
@@ -7,15 +7,15 @@
 ?>
 
-<?php if (isset($this->view['ProduktBilder_MT']) && (sizeof($this->view['ProduktBilder_MT']) > 0)) { ?>
+<?php if (wpsg_isSizedArray($this->view['productImages'])) { ?>
 
-	<?php foreach ($this->view['ProduktBilder_MT'] as $b) { ?>
+	<?php foreach ($this->view['productImages'] as $attachment_id) { ?>
 	
-		<div id="produktbild_div_<?php echo $b['pid']; ?>" class="wpsg_mod_produktbilder_admin_bild">
+		<div id="produktbild_div_<?php echo $attachment_id; ?>" class="wpsg_mod_produktbilder_admin_bild">
 
-			<a id="produktbild_<?php echo $b['pid']; ?>" onclick="return wpsg_remove_bild_MT('<?php echo $b['pid']; ?>');" href="#" title="<?php echo __('Dieses Bild lÃ¶schen.', 'wpsg'); ?>">
+			<a id="produktbild_<?php echo $attachment_id; ?>" onclick="return wpsg_remove_bild_MT('<?php echo $attachment_id; ?>');" href="#" title="<?php echo __('Dieses Bild lÃ¶schen.', 'wpsg'); ?>">
 				
 				<div class="box_img_wrap wpsg_be_imagelist_image">
 												
-					<?php echo wp_get_attachment_image($b['pid'], 'medium'); ?>
+					<?php echo wp_get_attachment_image($attachment_id, 'medium'); ?>
 						
 				</div>
