Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 6295)
+++ /model/wpsg_order.class.php	(revision 6297)
@@ -548,5 +548,5 @@
 			 
 			if ($this->adress_data === false) return $this->customer->getFirstName();
-			else return $this->adress_data['vname']; 
+			else return wpsg_getStr($this->adress_data['vname']); 
 			
 		} // public function getInvoiceFirstName()
@@ -560,5 +560,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getName();
-			else return $this->adress_data['name'];
+			else return wpsg_getStr($this->adress_data['name']);
 			
 		} // public function getInvoiceName()
@@ -571,5 +571,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getFax();
-			else return $this->adress_data['fax'];
+			else return wpsg_getStr($this->adress_data['fax']);
 			
 		} // public function getInvoiceFax()
@@ -582,5 +582,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getPhone();
-			else return $this->adress_data['tel'];
+			else return wpsg_getStr($this->adress_data['tel']);
 			
 		} // public function getInvoicePhone()
@@ -594,5 +594,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getStreet();
-			else return trim($this->adress_data['strasse'].' '.$this->adress_data['nr']);
+			else return trim(wpsg_getStr($this->adress_data['strasse']).' '.wpsg_getStr($this->adress_data['nr']));
 			
 		} // public function getInvoiceStreet()
@@ -651,5 +651,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getZip();
-			else return $this->adress_data['plz'];
+			else return wpsg_getStr($this->adress_data['plz']);
 			
 		} // public function getInvoiceZip()
@@ -663,5 +663,5 @@
 			
 			if ($this->adress_data === false) return $this->customer->getCity();
-			else return $this->adress_data['ort'];
+			else return wpsg_getStr($this->adress_data['ort']);
 						 
 		} // public function getInvoiceCity()
@@ -675,5 +675,5 @@
 				
 			if ($this->adress_data === false) return $this->customer->getCountryID();
-			else return $this->adress_data['land'];
+			else return wpsg_getStr($this->adress_data['land']);
 						
 		} // public function getInvoiceCountry()
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6295)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6297)
@@ -599,7 +599,9 @@
         				
         			$arPic = explode(",", $vp_data[$_REQUEST['var_id']]['arVariation'][$_REQUEST['iid']]['pic']);
-        				
+        			$arPostid = explode(",", $vp_data[$_REQUEST['var_id']]['arVariation'][$_REQUEST['iid']]['postid']);
+        			
         			$pic = $_REQUEST['pic'];
-
+        			$postid = $_REQUEST['post_id'];
+        			
         			$pic = preg_replace('/\-(\d+)x(\d+)\./', '.', $pic);
         			
@@ -607,12 +609,15 @@
         			{
         				unset($arPic[array_search($pic, $arPic)]);
+        				unset($arPostid[array_search($postid, $arPostid)]);
         			}
         			else
         			{
         				$arPic[] = $pic;
+        				$arPostid[] = $postid;
         			}
         				
         			$vp_data[$_REQUEST['var_id']]['arVariation'][$_REQUEST['iid']]['pic'] = implode(",", $arPic);
-        				
+        			$vp_data[$_REQUEST['var_id']]['arVariation'][$_REQUEST['iid']]['postid'] = implode(",", $arPostid);
+        			
         		}
         		else
@@ -829,6 +834,9 @@
         
         	$temp = wpsg_q(serialize($vp_data));
-        	$vdata['pic'] = $vp_data[wpsg_q($_REQUEST['var_id'])]['arVariation'][wpsg_q($_REQUEST['iid'])]['pic'];
+        	$vdata['pic'] = '';
+        	if (isset($vp_data[wpsg_q($_REQUEST['var_id'])]['arVariation'][wpsg_q($_REQUEST['iid'])]['pic']))
+        		$vdata['pic'] = $vp_data[wpsg_q($_REQUEST['var_id'])]['arVariation'][wpsg_q($_REQUEST['iid'])]['pic'];
         	$vdata['picOrder'] = $vp_data[wpsg_q($_REQUEST['var_id'])]['arVariation'][wpsg_q($_REQUEST['iid'])]['picOrder'];
+        	$vdata['postid'] = $vp_data[wpsg_q($_REQUEST['var_id'])]['arVariation'][wpsg_q($_REQUEST['iid'])]['postid'];
         	
         	$this->db->UpdateQuery(WPSG_TBL_PRODUCTS_VARIATION, array(
@@ -967,9 +975,9 @@
         	$_REQUEST['var_id'] = $var_id;
         	$_REQUEST['vari_id'] = $vari_id;
-        	 
+        	
         	//$vp_data = $this->loadVarianten($product_id);
         	$vp_data = $this->getVariants($product_id, true, true, true);
         	$this->unserializeVariant($vp_data); 
-        	 
+        	
         	$arProductBilder = $this->shop->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($product_id));
         
@@ -979,7 +987,7 @@
         	//if (!wpsg_isSizedArray($vp_data[$var_id]['vari'][$vari_id]['picOrder']) && !wpsg_isSizedArray($vp_data[$var_id]['picOrder'])) return $arProductBilder;
         	if (!wpsg_isSizedArray($vp_data[$var_id]['arVariation'][$vari_id]['picOrder'])) return $arProductBilder;
-        	 
+        	
         	// Sortierung
-        	// Bilder in Reihenfolge
+        	// Bilder in Reihenfolge von picOrder
         	if (isset($vp_data[$var_id]['typ']) && ($vp_data[$var_id]['typ'] == 'checkbox') && wpsg_isSizedArray($vp_data[$var_id]['picOrder'])) $arReturn = $vp_data[$var_id]['picOrder'];
         	else if (wpsg_isSizedArray($vp_data[$var_id]['arVariation'][$vari_id]['picOrder'])) $arReturn = $vp_data[$var_id]['arVariation'][$vari_id]['picOrder'];
@@ -998,5 +1006,5 @@
         	$arProductBilderSort = Array();
         	foreach ($arProductBilder as $v) {
-        		$k = array_search($v['basename'], $arReturn);
+        		$k = array_search($v['basenameori'], $arReturn);
         		if ($k !== false)
         			$arProductBilderSort[$k] = $v;
@@ -1009,7 +1017,11 @@
         	{
         
-        		$arReturn[] = $v;
-        
+        		//$arReturn[] = $v['basenameori'];
+        		$k = array_search($v['basenameori'], $arReturn);
+        		if ($k === false)
+        			$arProductBilderSort[] = $v;
+        			
         	}
+        	//$arReturn = array_unique($arReturn);
         	
         	$arImageSelect = array();
Index: /mods/wpsg_mod_produktbilder.class.php
===================================================================
--- /mods/wpsg_mod_produktbilder.class.php	(revision 6295)
+++ /mods/wpsg_mod_produktbilder.class.php	(revision 6297)
@@ -673,5 +673,5 @@
 				//$file = pathinfo($ar2[count($ar2) - 1], PATHINFO_FILENAME);
 				$ar3 = pathinfo($ar2[count($ar2) - 1]);
-				$file =$ar3['basename'];
+				$file = $ar3['basename'];
 				$af = $file;
 				$pos1 = strrpos($file, '-');
Index: /views/mods/mod_productvariants/admin_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/admin_edit.phtml	(revision 6295)
+++ /views/mods/mod_productvariants/admin_edit.phtml	(revision 6297)
@@ -186,5 +186,5 @@
 							?>	
 							<a class="<?php echo ((in_array($file2, explode(",", $vari['pic'])))?'mark':''); ?> pic" id="<?php echo $file2; ?>" 
-							onclick="return wpsg_vp_vari_setPic(this, <?php echo $k; ?>, <?php echo $kv; ?>, '<?php echo $file2; ?>', <?php echo $j; ?>);">
+							onclick="return wpsg_vp_vari_setPic(this, <?php echo $k; ?>, <?php echo $kv; ?>, '<?php echo $file2; ?>', <?php echo $j; ?>, <?php echo $b['post_id']; ?>);">
 							<img src="<?php echo $href[0]; ?>" alt="" width="25px" height="25px"/>
 							</a>
@@ -244,5 +244,5 @@
 	<script type="text/javascript">/* <![CDATA[ */
 
-	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, pic, pic_index)
+	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, pic, pic_index, post_id)
 	{
 
@@ -260,4 +260,6 @@
 				vari_id: vari_id,
 				iid: iid,
+				pic_index: pic_index,
+				post_id: post_id,
 				pic: pic
 			},
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 6295)
+++ /views/warenkorb/basket.phtml	(revision 6297)
@@ -77,5 +77,9 @@
 						
 						<?php
-						$url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'medium'));
+						if (isset($p['product_key'])) {
+							$url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'medium'));
+						} else {
+							$url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['productkey'], 'medium'));
+						}
 						echo "<img src=".$url." alt='' />";
 						?>
Index: /views/warenkorb/overview.phtml
===================================================================
--- /views/warenkorb/overview.phtml	(revision 6295)
+++ /views/warenkorb/overview.phtml	(revision 6297)
@@ -149,5 +149,10 @@
 							<?php if (wpsg_isSizedString($arBilder[0]['guid'])) { ?>
 							
-							<?php $img_url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'thumbnail')); ?>
+							<?php
+							if (isset($p['product_key'])) {
+								$img_url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['product_key'], 'thumbnail'));
+							} else {
+								$img_url = $this->callMod('wpsg_mod_produktbilder', 'getProductImage_MT', array($p['productkey'], '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']); ?>" />
