Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 6091)
+++ /lib/install.php	(revision 6094)
@@ -83,5 +83,5 @@
  	
 	/**
-	 * Kundentabelle
+	 * Kundentabelle ALT
 	 */
 	$sql = "CREATE TABLE ".WPSG_TBL_KU." (
@@ -94,5 +94,6 @@
    		custom TEXT NOT NULL,
    		adress_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_ADRESS (Kundenadresse)',
-   		KEY adress_id (adress_id),
+   		deleted INT(11) NOT NULL COMMENT 'Markierung fÃŒr gelÃ¶schte Kunden',
+		KEY adress_id (adress_id),
    		PRIMARY KEY  (id)
    	) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 6091)
+++ /lib/wpsg_basket.class.php	(revision 6094)
@@ -592,5 +592,5 @@
 				// Berechnen
 				$arBasket = $this->toArray();
-			 
+
 				// Keine Produkte nix speichern 
 				// Sonst wurden schon beim Betreten des leeren Warenkorb (Bots) leere Bestellungen erzeugt 
@@ -603,12 +603,13 @@
 					'ustidnr' 	=> wpsg_q(wpsg_getStr($this->arCheckout['ustidnr']))
 				);	
-							
+				
 				$this->shop->callMods('basket_save_kunde', array(&$data, &$this->arCheckout));
 				
 				$saved_order_db = array();
+				$k_id = wpsg_getStr($this->arCheckout['id']);
 				
 				if (wpsg_isSizedInt($_SESSION['wpsg']['order_id']))
 				{
-								
+					
 					$saved_order_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($_SESSION['wpsg']['order_id'])."' ");
 					
@@ -635,5 +636,5 @@
 					if (wpsg_isSizedInt($k_id) && $k_id != $_SESSION['wpsg']['checkout']['id'])
 					{
-							
+						
 						$k_id = $_SESSION['wpsg']['checkout']['id'];
 				
@@ -645,5 +646,5 @@
 				
 				if (isset($this->arCheckout['custom']) && wpsg_isSizedArray($this->arCheckout)) $data['custom'] = $this->arCheckout['custom'];
-						
+				
 				if (wpsg_isSizedInt($k_id))
 				{
@@ -657,9 +658,9 @@
 						
 						$data['custom'] = wpsg_array_merge($custom_old, (array)$this->arCheckout['custom']);
-												
-					}
-					
-				}
-				 
+						
+					}
+					
+				}
+				
 				$data['custom'] = serialize($data['custom']);
 				
@@ -685,10 +686,10 @@
 						
 					}
-	
+
 					$k_id = $this->db->ImportQuery(WPSG_TBL_KU, $data);					
 					$knr = $this->shop->buildKNR($k_id);
 					
 					$update_customer_data['knr'] = wpsg_q($knr);
-									 
+					
 					$this->shop->callMods('customer_created', array(&$k_id, &$this->arCheckout['password']));				
 					
@@ -711,8 +712,21 @@
 					'land' => wpsg_q(wpsg_getStr($this->arCheckout['land']))
 				);
-				
+				$adress_data['cdate'] = 'NOW()';
+				
+				$re_adress_id = 0;
+				if ($finish_order === true) {
+					
+					// Adresse als Rechnungsadresse anlegen
+					$re_adress_id = wpsg_q($this->db->ImportQuery(WPSG_TBL_ADRESS, $adress_data));
+					
+					if (!wpsg_isSizedInt($customer_data['adress_id']))
+						$update_customer_data['adress_id'] = $re_adress_id;
+					
+				}
+				
+				/*
 				if (!wpsg_isSizedInt($customer_data['adress_id']))
 				{
-				 
+				
 					$adress_data['cdate'] = 'NOW()';
 					
@@ -727,4 +741,5 @@
 					
 				}
+				*/
 				
 				// Kundendaten ggf. aktualisieren
@@ -733,5 +748,5 @@
 				$arBasket['checkout']['k_id'] = $k_id;
 				$arBasket['checkout']['knr'] = $knr;
-							
+				
 				// Produkte letztmalig ÃŒberprÃŒfen			
 				foreach ($arBasket['produkte'] as $p_id => $p)
@@ -743,13 +758,13 @@
 						if (!$this->shop->callMod('wpsg_mod_stock', 'checkBestand', array($p['id'], $p['menge'])) && $this->shop->get_option('wpsg_mod_stock_allow') == '1')
 						{
-								
+						
 							$p['menge'] = $this->shop->callMod('wpsg_mod_stock', 'getBestand', array($p['id']));
-				
+
 						}
-							
-					}
-					
-				}
-					 
+						
+					}
+					
+				}
+				
 				$data = array(
 					'cdate' 			=> 'NOW()',
@@ -779,5 +794,5 @@
 						'wpsg_kleinunternehmer' => $this->shop->get_option('wpsg_kleinunternehmer'),
 						'wpsg_kleinunternehmer_text' => $this->shop->get_option('wpsg_kleinunternehmer_text')
-					)				
+					)
 				);
 				
@@ -792,5 +807,5 @@
 					
 				}
-				 
+				
 				/** Gutschein speichern */
 				if ($this->gs_id !== false && $this->gs_id > 0)
@@ -803,5 +818,5 @@
 					$data['gs_id'] = wpsg_q($this->gs_id);
 					$data['price_gs'] = wpsg_q($arBasket['sum']['gs']);
-									
+					
 				}
 				
@@ -841,10 +856,11 @@
 					}
 					
-				}
+				} $_REQUEST
 				*/
+				
 				$this->shop->callMods('basket_save_order', array(&$data, &$this->arCheckout, &$arBasket, $finish_order));
 				
-				if (($finish_order === true) && (wpsg_getStr($checkout['diff_shippingadress']) == '1'))
-				{	//TODO Gesonderte Lieferadresse speichern
+				if (($finish_order === true) && (wpsg_getStr($this->arCheckout['diff_shippingadress']) == '1'))
+				{	// Gesonderte Lieferadresse speichern
 					
 					$adata['cdate'] = 'NOW()';
@@ -860,14 +876,21 @@
 					
 					$data['shipping_adress_id'] = wpsg_q($this->db->ImportQuery(WPSG_TBL_ADRESS, $adata));
-						
-				}
-				$data['adress_id'] = $customer_data['adress_id'];
+					
+					// Daten fÃŒr BestellbestÃ€tigungsmail bereitstellen
+					$arBasket['checkout']['shipping_title'] = $data['shipping_title'];
+					$arBasket['checkout']['shipping_vname'] = $data['shipping_vname'];
+					$arBasket['checkout']['shipping_name'] = $data['shipping_name'];
+					$arBasket['checkout']['shipping_strasse'] = $data['shipping_strasse'];
+					$arBasket['checkout']['shipping_plz'] = $data['shipping_plz'];
+					$arBasket['checkout']['shipping_ort'] = $data['shipping_ort'];
+					$arBasket['checkout']['shipping_firma'] = $data['shipping_firma'];
+					$arBasket['checkout']['shipping_land'] = $data['shipping_land'];
+						
+				}
+				$data['adress_id'] = $re_adress_id;
 				
 				$data['custom_data']['basket']['oOrder'] = Array();
 				//unset($data['custom_data']['basket']['oOrder']['shop']);
 				
-				$sw = wpsg_q(serialize($data['custom_data']));
-				$sl = strlen($sw);
-				//echo "<b>wpsg_q:</B><br />".$sw;
 				$data['custom_data'] = wpsg_q(serialize($data['custom_data']));
 				
@@ -891,7 +914,7 @@
 						'onr' => wpsg_q($o_nr)
 					), "`id` = '".wpsg_q($o_id)."'");
-									
-				}
-					
+					
+				}
+				
 				$arBasket['checkout']['onr'] = $o_nr;			
 				$arBasket['checkout']['o_id'] = $o_id;
@@ -907,7 +930,7 @@
 						if ($gs_db['multi'] != '1')
 						{
-								
+						
 							$this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, array('o_id' => $o_id), "`id` = '".wpsg_q($this->gs_id)."'");
-								
+						
 						}
 					
@@ -928,5 +951,5 @@
 					// AufdrÃ¶selung der Varianten damit in der DB die korrekt Produkt ID steht
 					$produkt_id = $this->shop->getProduktID($p['id']);
-					  
+
 					$data = array(
 						'o_id' => wpsg_q($o_id),
@@ -984,5 +1007,5 @@
 					
 				}
-								
+				
 				if ($finish_order === true)
 				{
@@ -990,5 +1013,5 @@
 					$this->shop->callMods('basket_save_done', array(&$o_id, &$k_id, &$this));
 					$this->shop->callMods('basket_save_done_array', array(&$o_id, &$k_id, &$arBasket));
-		
+
 					// Wenn CrefoPay aktiv, werden die Mails spÃ€ter versendet
 					if (!$this->shop->hasMod('wpsg_mod_crefopay')) $this->sendOrderSaveMails($o_id, $arBasket);
@@ -1031,5 +1054,5 @@
 			
 			return $o_id;
-						
+			
 		} // public function save()
 		
@@ -1945,5 +1968,5 @@
 					
 					$id = $this->arOrder['type_shipping'];
-					$tax_keys = $this->shop->arShipping[$id]['mwst_key'];
+					$tax_keys = wpsg_getStr($this->shop->arShipping[$id]['mwst_key']);
 					$mb->setShippingKosten($arReturn, 'x', $prices, $tax_keys);
 					$taxs = $arReturn['shipping']['mwst'];
Index: /mods/wpsg_mod_deliverynote.class.php
===================================================================
--- /mods/wpsg_mod_deliverynote.class.php	(revision 6091)
+++ /mods/wpsg_mod_deliverynote.class.php	(revision 6094)
@@ -214,5 +214,5 @@
 			{
 				 
-				// Vorschau einer Rechnung aus der Bestellverwaltung
+				// Vorschau eines Lieferscheines aus der Bestellverwaltung
 				$this->writeDeliverynote(
 					$_REQUEST['edit_id'], 
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6091)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6094)
@@ -79,5 +79,5 @@
 				$this->db->UpdateQuery(WPSG_TBL_KU, array(
 					'status' => '1'
-				), '1');
+				), " `deleted` != '1' ");
 
 				$this->shop->addBackendMessage(__('Alle Kunden wurden auf Aktiv gesetzt.', 'wpsg'));
@@ -90,5 +90,5 @@
 				$this->db->UpdateQuery(WPSG_TBL_KU, array(
 					'status' => '0'
-				), '1');
+				), " `deleted` != '1' ");
 				
 				$this->shop->addBackendMessage(__('Alle Kunden wurden auf Inaktiv gesetzt.', 'wpsg'));
@@ -983,5 +983,5 @@
 					{
 						
-						$this->shop->view['data']['custom'][$k] = $this->shop->view['custom_values'][$k];						
+						$this->shop->view['data']['custom'][$k] = wpsg_getStr($this->shop->view['custom_values'][$k]);						
 						
 					}
@@ -1403,4 +1403,5 @@
 			// Export WPSG_TBL_KU und WPSG_TBL_ADRESS
 			//$arData = $this->db->fetchAssoc("SELECT * FROM `".wpsg_q(WPSG_TBL_KU)."` ");
+			/*
 			$arData = $this->db->fetchAssoc("
 					SELECT
@@ -1410,4 +1411,27 @@
 						 	LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = C.`adress_id`)
 				");
+			*/
+			
+			$arData = $this->db->fetchAssoc("
+				SELECT
+					C.*, C.`id` AS kid, 
+					IF (CA.`id` > 0, CA.`title`, C.`title`) AS `title`,
+					IF (CA.`id` > 0, CA.`name`, C.`name`) AS `name`,
+					IF (CA.`id` > 0, CA.`vname`, C.`vname`) AS `vname`,
+					IF (CA.`id` > 0, CA.`firma`, C.`firma`) AS `firma`,
+					IF (CA.`id` > 0, CA.`fax`, C.`fax`) AS `fax`,
+					IF (CA.`id` > 0, CA.`strasse`, C.`strasse`) AS `strasse`,
+					IF (CA.`id` > 0, CA.`nr`, '') AS `nr`,
+					IF (CA.`id` > 0, CA.`plz`, C.`plz`) AS `plz`,
+					IF (CA.`id` > 0, CA.`ort`, C.`ort`) AS `ort`,
+					IF (CA.`id` > 0, CA.`land`, C.`land`) AS `land`,
+					IF (CA.`id` > 0, CA.`tel`, C.`tel`) AS `tel`,
+					CA.`id`
+			  	FROM
+			  		`".wpsg_q(WPSG_TBL_KU)."` AS C
+			  		 	LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = C.`adress_id`)
+				WHERE
+					C.`deleted` != '1'
+			");
 			
 			if (!wpsg_isSizedArray($arData)) { $this->addBackendError(__('Keine Daten zum Exportieren vorhanden.', 'wpsg')); $this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Customer&amp;action=index'); return; }
@@ -1417,5 +1441,5 @@
 			
 			$fp = fopen($path.'/wpsg_customerexport.csv', 'w');
-			fputcsv($fp, array_keys($arData[0]), ';');
+			fputcsv($fp, array_keys($arData[0]), ',');
 			foreach ($arData as $e)
 			{
@@ -1431,6 +1455,6 @@
 				}
 				
-				//fputcsv($fp, $e, ',', '"');
-				fputcsv($fp, $e, ';', '"');
+				fputcsv($fp, $e, ',', '"');
+				//fputcsv($fp, $e, ';', '"');
 				
 			}
@@ -1465,5 +1489,5 @@
 				
 				$i = 0;
-				while (($row = fgetcsv ($handle, 0, ";")) !== FALSE ) 
+				while (($row = fgetcsv ($handle, 0, ",")) !== FALSE ) 
 				{
 					
@@ -1722,4 +1746,6 @@
 			
 			$data['custom'] = @serialize($_REQUEST['custom']);
+
+			if (isset($_REQUEST['deleted'])) $data['deleted'] = $_REQUEST['deleted'];
 			
 			if ($_REQUEST['password1'] == $_REQUEST['password2'] && trim($_REQUEST['password1']) != '')
@@ -1817,5 +1843,5 @@
 		private function be_indexAction()
 		{
-
+			
 			$nPerPage = $this->shop->get_option('wpsg_mod_kundenverwaltung_perpage');
 			if ($nPerPage <= 0) $nPerPage = 10;
@@ -1860,5 +1886,183 @@
 
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_kundenverwaltung/index.phtml');
-
+			
+			  
+			/*
+			// NEU von Shop V3  $strQuery ist unvollstÃ€ndig
+			$strQueryWHERE = "";
+				
+			if (isset($_REQUEST['s']) && $_REQUEST['s'] != '')
+			{
+			
+				$strQueryWHERE .= "
+					AND (
+						IF (CA.`id` > 0, CA.`name`, K.`name`) LIKE '%".wpsg_q($_REQUEST['s'])."%' OR
+						IF (CA.`id` > 0, CA.`vname`, K.`vname`) LIKE '%".wpsg_q($_REQUEST['s'])."%' OR
+						K.`email` LIKE '%".wpsg_q($_REQUEST['s'])."%' OR
+						K.`id` = '".wpsg_q($_REQUEST['s'])."' OR
+						K.`knr` LIKE '%".wpsg_q($_REQUEST['s'])."%'
+					)
+				";
+			
+			}
+			
+			if ($this->shop->hasMod('wpsg_mod_customergroup'))
+			{
+					
+				if (isset($_REQUEST['customergroup']) && $_REQUEST['customergroup'] > 0)
+				{
+						
+					$strQueryWHERE .= " AND `group_id` = '".wpsg_q($_REQUEST['customergroup'])."' ";
+						
+				}
+				else if (isset($_REQUEST['customergroup']) && $_REQUEST['customergroup'] === '0')
+				{
+						
+					$strQueryWHERE .= " AND (`group_id` = 0 OR `group_id` IS NULL) ";
+						
+				}
+			
+			}
+				
+			// Damit "Geisterkunden" aus unvollstÃ€ndigen Bestellungen nicht erscheinen
+			//$strQueryWHERE .= " AND K.`email` != '' ";
+				
+			$nPerPage = $this->shop->get_option('wpsg_mod_kundenverwaltung_perpage');
+			if ($nPerPage <= 0) $nPerPage = 10;
+				
+			if (isset($_REQUEST['seite'])) $seite = $_REQUEST['seite']; else $seite = 1;
+				
+			$this->shop->view['count'] = $this->db->fetchOne("
+				SELECT
+					COUNT(*)
+				FROM
+					(
+						SELECT
+							K.`id`,
+							(SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` AS O WHERE O.`k_id` = K.`id` AND O.`status` != '".wpsg_q(wpsg_ShopController::STATUS_UNVOLLSTAENDIG)."') AS order_count,
+							(SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` AS O WHERE O.`k_id` = K.`id` AND O.`status` = '".wpsg_q(wpsg_ShopController::STATUS_UNVOLLSTAENDIG)."') AS order_count_incomplete
+						FROM
+							`".WPSG_TBL_KU."` AS K
+								LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = K.`adress_id`)
+						WHERE
+							(
+								IF (CA.`id` > 0, CA.`vname`, K.`vname`) != '' OR
+								IF (CA.`id` > 0, CA.`name`, K.`name`) != '' OR
+								K.`email` != ''
+							)
+							AND K.`deleted` != '1'
+							".$strQueryWHERE."
+					) AS OUTER_TABLE
+			");
+			
+			$this->shop->view['seite'] = $seite;
+			$this->shop->view['pages'] = ceil($this->shop->view['count'] / $nPerPage);
+			if ($this->shop->view['seite'] <= 0 || $this->shop->view['seite'] > $this->shop->view['pages']) $this->shop->view['seite'] = 1;
+			
+			if (isset($_REQUEST['filter']))
+				$this->shop->view['filter'] = $_REQUEST['filter'];
+			else
+				$this->shop->view['filter'] = array();
+					
+				$strQueryORDER = '';
+					
+				if (!isset($this->shop->view['filter']['order']))
+				{
+						
+					$this->shop->view['filter']['order'] = 'nr';
+						
+				}
+					
+				switch ($this->shop->view['filter']['order'])
+				{
+						
+					case 'name': $strQueryORDER .= "`order_name`"; break;
+					case 'adress': $strQueryORDER = "`order_adress`"; break;
+					case 'status': $strQueryORDER = "`order_count`"; break;
+					default: $strQueryORDER = " `order_nr` "; break;
+						
+				}
+						
+				if (!isset($this->shop->view['filter']['ascdesc']))
+				{
+						
+					$this->shop->view['filter']['ascdesc'] = 'DESC';
+						
+				}
+					
+				if (wpsg_isSizedString($this->shop->get_option('wpsg_order_knr'), '1')) $strQueryORDERNR = " `knr` AS `order_nr` ";
+				else $strQueryORDERNR = " CAST(`knr` AS UNSIGNED) AS `order_nr` ";
+		
+				// Das HAVING ist so "kompliziert" weil ich erreichen wollte das Kunden die gÃ€nzlich keine Bestellungen haben dennoch angezeigt werden
+				// Kunden die aber nur unvollstÃ€ndige Bestellungen haben aber nicht
+				$strQuery = "
+				SELECT
+					K.*,
+					IF (CA.`id` > 0, CA.`title`, K.`title`) AS `title`,
+					IF (CA.`id` > 0, CA.`name`, K.`name`) AS `name`,
+					IF (CA.`id` > 0, CA.`vname`, K.`vname`) AS `vname`,
+					IF (CA.`id` > 0, CA.`firma`, K.`firma`) AS `firma`,
+					IF (CA.`id` > 0, CA.`fax`, K.`fax`) AS `fax`,
+					IF (CA.`id` > 0, CA.`strasse`, K.`strasse`) AS `strasse`,
+					IF (CA.`id` > 0, CA.`nr`, '') AS `nr`,
+					IF (CA.`id` > 0, CA.`plz`, K.`plz`) AS `plz`,
+					IF (CA.`id` > 0, CA.`ort`, K.`ort`) AS `ort`,
+					IF (CA.`id` > 0, CA.`land`, K.`land`) AS `land`,
+					IF (CA.`id` > 0, CA.`tel`, K.`tel`) AS `tel`,
+					IF (CA.`id` > 0, CAL.`kuerzel`, L.`kuerzel`) AS land_kuerzel,
+					IF (CA.`id` > 0, CONCAT(CA.`firma`, ' ', CA.`strasse`, ' ', CA.`plz`, ' ', CA.`ort`), CONCAT(K.`firma`, ' ', K.`strasse`, ' ', K.`plz`, ' ', K.`ort`)) AS `order_adress`,
+					IF (CA.`id` > 0, CONCAT(CA.`vname`, ' ', CA.`name`), CONCAT(K.`vname`, ' ', K.`name`)) AS `order_name`,
+					".$strQueryORDERNR.",
+					(SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` AS O WHERE O.`k_id` = K.`id` AND O.`status` != '".wpsg_q(wpsg_ShopController::STATUS_UNVOLLSTAENDIG)."') AS order_count,
+					(SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` AS O WHERE O.`k_id` = K.`id` AND O.`status` = '".wpsg_q(wpsg_ShopController::STATUS_UNVOLLSTAENDIG)."') AS order_count_incomplete,
+					(SELECT SUM(`price_gesamt`) FROM `".WPSG_TBL_ORDER."` AS O WHERE O.`k_id` = K.`id` AND O.`status` IN (100, 110)) as order_umsatz
+				FROM
+					`".WPSG_TBL_KU."` AS K
+						LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = K.`adress_id`)
+						LEFT JOIN `".WPSG_TBL_LAND."` AS CAL ON (CAL.`id` = CA.`land`)
+						LEFT JOIN `".WPSG_TBL_LAND."` AS L ON (K.`land` = L.`id`)
+				WHERE
+					(
+						IF (CA.`id` > 0, CA.`vname`, K.`vname`) != '' OR
+						IF (CA.`id` > 0, CA.`name`, K.`name`) != '' OR
+						K.`email` != ''
+					)
+					AND K.`deleted` != '1'
+					".$strQueryWHERE."
+				ORDER BY
+					".$strQueryORDER." ".wpsg_q($this->shop->view['filter']['ascdesc']).", K.`id` DESC
+				LIMIT
+					".(($this->shop->view['seite'] - 1) * $nPerPage).", ".$nPerPage."
+			";
+			
+				$this->shop->view['data'] = $this->db->fetchAssoc($strQuery);
+		
+				// Kundengruppen laden
+				if ($this->shop->hasMod('wpsg_mod_customergroup'))
+				{
+							
+					$this->shop->view['arCustomergroup'] = $this->db->fetchAssocField("
+					SELECT
+						KG.`id`, CONCAT(KG.`name`, ' (ID:', KG.`id`, ')') AS `name`
+					FROM
+						`".WPSG_TBL_KG."` AS KG
+					ORDER BY
+						KG.`name` ASC
+				", "id", "name");
+			
+				}
+			
+				foreach ($this->shop->view['data'] as $k => $customer_db)
+				{
+		
+					$this->shop->view['data'][$k]['oCustomer'] = new wpsg_customer();
+					$this->shop->view['data'][$k]['oCustomer']->load($customer_db['id']);
+					$this->shop->view['data'][$k]['order_umsatz'] = $this->shop->view['data'][$k]['oCustomer']->getOrderAmount(array(100, 110));
+		
+				}
+					
+				$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_kundenverwaltung/index.phtml');
+				*/
+			
 		} // private function be_indexAction()
 				
@@ -1894,15 +2098,54 @@
 			$kunde = $this->db->fetchRow("
 				SELECT
-					K.`firma`, K.`title`, K.`vname`, K.`name`, K.`geb`,
-					K.`fax`, K.`tel`, K.`strasse`, K.`ort`, K.`plz`, K.`land`,
-					K.`ustidnr`, K.`email`, K.`id`, K.`wp_user_id`
+					C.`id`,
+					IF (CA.`id` > 0, CA.`title`, C.`title`) AS `title`,
+					IF (CA.`id` > 0, CA.`name`, C.`name`) AS `name`,
+					IF (CA.`id` > 0, CA.`vname`, C.`vname`) AS `vname`,
+					IF (CA.`id` > 0, CA.`firma`, C.`firma`) AS `firma`,
+					IF (CA.`id` > 0, CA.`fax`, C.`fax`) AS `fax`,
+					IF (CA.`id` > 0, CA.`strasse`, C.`strasse`) AS `strasse`,
+					IF (CA.`id` > 0, CA.`nr`, '') AS `nr`,
+					IF (CA.`id` > 0, CA.`plz`, C.`plz`) AS `plz`,
+					IF (CA.`id` > 0, CA.`ort`, C.`ort`) AS `ort`,
+					IF (CA.`id` > 0, CA.`land`, C.`land`) AS `land`,
+					IF (CA.`id` > 0, CA.`tel`, C.`tel`) AS `tel`,
+					C.`geb`, C.`ustidnr`, C.`email`, C.`id`, C.`wp_user_id`
 				FROM
-					`".WPSG_TBL_KU."` AS K
+					`".WPSG_TBL_KU."` AS C
+						LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = C.`adress_id`)
 				WHERE
-					K.`id` = '".wpsg_q($kunde_id)."'			
+					C.`id` = '".wpsg_q($kunde_id)."' AND
+					C.`deleted` != '1'
 			");
+				
+			if ($kunde['id'] != $kunde_id) return;
 			
 			if (!is_array($_SESSION['wpsg']['checkout'])) $_SESSION['wpsg']['checkout'] = array();
-									
+		
+			if (wpsg_isSizedInt($_SESSION['wpsg']['order_id']))
+			{
+			
+				$temp_k_id = $this->db->fetchOne("SELECT `k_id` FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($_SESSION['wpsg']['order_id'])."' ");
+			
+				if (wpsg_isSizedInt($temp_k_id) && $temp_k_id != $kunde_id)
+				{
+			
+					// TemporÃ€ren Kunden lÃ¶schen
+					// Zur Sicherheit check ich mal ob es Bestellungen mit ihm gibt.
+					$count_order = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` WHERE `k_id` = '".wpsg_q($temp_k_id)."'  AND `id` != '".wpsg_q($_SESSION['wpsg']['order_id'])."' ");
+			
+					if ($count_order > 0) $this->shop->throwErrorCode('3100_1');
+					else
+					{
+			
+						$oCustomer = wpsg_customer::getInstance($temp_k_id);
+						$oCustomer->delete();
+			
+					}
+			
+				}
+			
+			}
+			
 			$_SESSION['wpsg']['checkout'] = wpsg_array_merge($_SESSION['wpsg']['checkout'], wpsg_xss(array(
 				'id' => $kunde['id'],
@@ -1917,4 +2160,5 @@
 				'tel' => $kunde['tel'],
 				'strasse' => $kunde['strasse'],
+				'nr' => $kunde['nr'],
 				'plz' => $kunde['plz'],
 				'ort' => $kunde['ort'],
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6091)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6094)
@@ -285,6 +285,590 @@
         } // public function getProductKeyFromRequest($product_id, $form_data)
         
+        public function produkt_ajax()
+        {
+        		
+        	//error_reporting(E_ALL);
+        		
+        	if (isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'wpsg_vp_add')
+        	{
+        			
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		$data = array(
+        				"name" => $_REQUEST['name'],
+        				"typ" => $_REQUEST['typ'],
+        				"aktiv" => "1"
+        		);
+        
+        		if ($_REQUEST['typ'] == "checkbox")
+        		{
+        			$data['preis'] = "0";
+        		}
+        		else
+        		{
+        			$data['vari'] = array();
+        		}
+        
+        		$vp_data[] = $data;
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		$this->shop->view['message'] = array(0, __("Variante erfolgreich angelegt.", "wpsg"));
+        
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_var_reorder')
+        	{
+        
+        		parse_str($_REQUEST['wpsg_reorder'], $wpsg_reorder);
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        		$vp_data_neu = array();
+        		 
+        		foreach ($wpsg_reorder['variante'] as $order)
+        		{
+        				
+        			if (array_key_exists($order, $vp_data))
+        			{
+        
+        				$vp_data_neu[] = $vp_data[$order];
+        				unset($vp_data[$order]);
+        
+        			}
+        			else
+        			{
+        
+        				$this->shop->throwErrorCode('98_1');
+        
+        			}
+        				
+        		}
+        
+        		if (wpsg_isSizedArray($vp_data))
+        		{
+        
+        			$this->shop->throwErrorCode('98_2');
+        
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data_neu);
+        
+        		$this->shop->view['message'] = array(0, __('Variantenreihenfolge gespeichert.', 'wpsg'));
+        
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_vari_reorder')
+        	{
+        
+        		parse_str($_REQUEST['wpsg_reorder'], $wpsg_reorder);
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        			
+        		foreach ($wpsg_reorder as $var_key => $order)
+        		{
+        				
+        			$var_id = preg_replace('/^variorder\_/', '', $var_key);
+        
+        			wpsg_array_reorder($vp_data[$var_id]['vari'], $order);
+        				
+        			if (wpsg_isSizedArray($vp_data[$var_id]['lang']))
+        			{
+        
+        				foreach ($vp_data[$var_id]['lang'] as $lang_key => $lang_vari)
+        				{
+        						
+        					wpsg_array_reorder($vp_data[$var_id]['lang'][$lang_key]['vari'], $order);
+        						
+        				}
+        
+        			}
+        				
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		$this->shop->view['message'] = array(0, __("Variationenreihenfolge gespeichert.", "wpsg"));
+        
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_vp_refreh')
+        	{
+        
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == "wpsg_vp_del")
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		unset($vp_data[$_REQUEST['var_id']]);
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		$this->shop->view['message'] = array(0, __("Variante wurde erfolgreich gelÃ¶scht.", "wpsg"));
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == "wpsg_vp_deaktiv")
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		if ($_REQUEST['status'] == "1")
+        		{
+        				
+        			$vp_data[$_REQUEST['var_id']]['aktiv'] = 1;
+        			$this->shop->view['message'] = array(0, __("Variante wurde erfolgreich aktiviert.", "wpsg"));
+        
+        		}
+        		else
+        		{
+        				
+        			$vp_data[$_REQUEST['var_id']]['aktiv'] = 0;
+        			$this->shop->view['message'] = array(0, __("Variante wurde erfolgreich deaktiviert.", "wpsg"));
+        				
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == "wpsg_vp_addVariation")
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		$vp_data[$_REQUEST['var_id']]['vari'][] = array(
+        				"name" => $_REQUEST['vari_name'],
+        				"preis" => wpsg_tf($_REQUEST['vari_preis']),
+        				"aktiv" => "1"
+        		);
+        
+        		$this->shop->view['message'] = array(0, __("Variation wurde erfolgreich angelegt.", "wpsg"));
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == "wpsg_vp_vari_del")
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		unset($vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]);
+        
+        		if (wpsg_isSizedArray($vp_data[$_REQUEST['var_id']]['lang']))
+        		{
+        
+        			foreach ($vp_data[$_REQUEST['var_id']]['lang'] as $lang_key => $lang_vari)
+        			{
+        
+        				unset($vp_data[$_REQUEST['var_id']]['lang'][$lang_key]['vari'][$_REQUEST['vari_id']]);
+        
+        			}
+        				
+        		}
+        
+        		$this->shop->view['message'] = array(0, __("Variation wurde erfolgreich gelÃ¶scht.", "wpsg"));
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == "wpsg_vp_vari_deaktiv")
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		if ($_REQUEST['status'] == "1")
+        		{
+        				
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['aktiv'] = 1;
+        			$this->shop->view['message'] = array(0, __("Variation wurde erfolgreich aktiviert.", "wpsg"));
+        
+        		}
+        		else
+        		{
+        				
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['aktiv'] = 0;
+        			$this->shop->view['message'] = array(0, __("Variation wurde erfolgreich deaktiviert.", "wpsg"));
+        				
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        		die($this->drawVarianten($_REQUEST['edit_id']));
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_var_setImageOrder')
+        	{
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		if ($_REQUEST['vari_id'] == -1)
+        		{
+        				
+        			$vp_data[$_REQUEST['var_id']]['picOrder'] = $_REQUEST['wpsg_reorder'];
+        				
+        		}
+        		else
+        		{
+        
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['picOrder'] = $_REQUEST['wpsg_reorder'];
+        				
+        		}
+        			
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		die("1");
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_vp_vari_setPic')
+        	{
+        		//die('wpsg_vp_vari_setPic');
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        
+        		if ($_REQUEST['vari_id'] >= 0)
+        		{
+        				
+        			$arPic = explode(",", $vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['pic']);
+        				
+        			if (in_array($_REQUEST['pic'], $arPic))
+        			{
+        				unset($arPic[array_search($_REQUEST['pic'], $arPic)]);
+        			}
+        			else
+        			{
+        				$arPic[] = $_REQUEST['pic'];
+        			}
+        				
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['pic'] = implode(",", $arPic);
+        				
+        		}
+        		else
+        		{
+        				
+        			$arPic = explode(",", $vp_data[$_REQUEST['var_id']]['pic']);
+        				
+        			if (in_array($_REQUEST['pic'], $arPic))
+        			{
+        				unset($arPic[array_search($_REQUEST['pic'], $arPic)]);
+        			}
+        			else
+        			{
+        				$arPic[] = $_REQUEST['pic'];
+        			}
+        				
+        			$vp_data[$_REQUEST['var_id']]['pic'] = implode(",", $arPic);
+        
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		die("1");
+        
+        	}
+        	else if ($_REQUEST['cmd'] == 'wpsg_vp_vari_inlineEdit')
+        	{
+        
+        
+        		$vp_data = $this->loadVarianten($_REQUEST['edit_id']);
+        		$product_data = $this->shop->cache->loadProduct($_REQUEST['edit_id']);
+        			
+        		if ($_REQUEST['typ'] == "vari_name")
+        		{
+        				
+        			if (wpsg_isSizedString($_REQUEST['wpsg_lang']))
+        			{
+        				$vp_data[$_REQUEST['var_id']]['lang'][$_REQUEST['wpsg_lang']]['vari'][$_REQUEST['vari_id']]['name'] = wpsg_q($_REQUEST['value']);
+        			}
+        			else
+        			{
+        				$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['name'] = wpsg_q($_REQUEST['value']);
+        			}
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "vari_artnr")
+        		{
+        				
+        			if (wpsg_isSizedString($_REQUEST['wpsg_lang']))
+        			{
+        				$vp_data[$_REQUEST['var_id']]['lang'][$_REQUEST['wpsg_lang']]['vari'][$_REQUEST['vari_id']]['artnr'] = wpsg_q($_REQUEST['value']);
+        			}
+        			else
+        			{
+        				$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['artnr'] = wpsg_q($_REQUEST['value']);
+        			}
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "vari_preis")
+        		{
+        				
+        			$_REQUEST['value'] = wpsg_tf($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['preis'] = $_REQUEST['value'];
+        			$_REQUEST['value'] = wpsg_ff($_REQUEST['value'], $this->shop->get_option('wpsg_currency'));
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "vari_fmenge")
+        		{
+        
+        			$arFeinheiten = explode(',', $this->shop->get_option('wpsg_mod_fuellmenge_einheit'));
+        				
+        			$_REQUEST['value'] = wpsg_ff(wpsg_tf($_REQUEST['value']), $arFeinheiten[$product_data['feinheit']]);
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['fmenge'] = wpsg_tf($_REQUEST['value']);
+        
+        		}
+        		else if ($_REQUEST['typ'] == "vari_weight")
+        		{
+        				
+        			$_REQUEST['value'] = wpsg_tf($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['weight'] = $_REQUEST['value'];
+        
+        		}
+        		else if ($_REQUEST['typ'] == "vari_stock")
+        		{
+        				
+        			$_REQUEST['value'] = intval($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['vari'][$_REQUEST['vari_id']]['stock'] = $_REQUEST['value'];
+        
+        		}
+        		else if ($_REQUEST['typ'] == "var_name")
+        		{
+        				
+        			if (wpsg_isSizedString($_REQUEST['wpsg_lang']))
+        			{
+        				$vp_data[$_REQUEST['var_id']]['lang'][$_REQUEST['wpsg_lang']]['name'] = $_REQUEST['value'];
+        			}
+        			else
+        			{
+        				$vp_data[$_REQUEST['var_id']]['name'] = $_REQUEST['value'];
+        			}
+        
+        		}
+        		else if ($_REQUEST['typ'] == "var_preis")
+        		{
+        				
+        			$_REQUEST['value'] = wpsg_tf($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['preis'] = $_REQUEST['value'];
+        			$_REQUEST['value'] = wpsg_ff($_REQUEST['value'], $this->shop->get_option('wpsg_currency'));
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "var_weight")
+        		{
+        
+        			$_REQUEST['value'] = wpsg_tf($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['weight'] = $_REQUEST['value'];
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "var_fmenge")
+        		{
+        				
+        			$arFeinheiten = explode(',', $this->shop->get_option('wpsg_mod_fuellmenge_einheit'));
+        
+        			$_REQUEST['value'] = wpsg_ff(wpsg_tf($_REQUEST['value']), $arFeinheiten[$product_data['feinheit']]);
+        			$vp_data[$_REQUEST['var_id']]['fmenge'] = wpsg_tf($_REQUEST['value']);
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "var_artnr")
+        		{
+        				
+        			if (wpsg_isSizedString($_REQUEST['wpsg_lang']))
+        			{
+        				$vp_data[$_REQUEST['var_id']]['lang'][$_REQUEST['wpsg_lang']]['artnr'] = wpsg_q($_REQUEST['value']);
+        			}
+        			else
+        			{
+        				$vp_data[$_REQUEST['var_id']]['artnr'] = wpsg_q($_REQUEST['value']);
+        			}
+        				
+        		}
+        		else if ($_REQUEST['typ'] == "var_stock")
+        		{
+        
+        			$_REQUEST['value'] = intval($_REQUEST['value']);
+        			$vp_data[$_REQUEST['var_id']]['stock'] = $_REQUEST['value'];
+        				
+        		}
+        
+        		$this->saveVarianten($_REQUEST['edit_id'], $vp_data);
+        
+        		die(strval($_REQUEST['value']));
+        
+        	}
+        		
+        } // public function produkt_ajax()
+        
 		/* Modulfunktionen */
 		
+        /**
+         * Speichert die Varianten
+         */
+        public function saveVarianten($produkt_id, $vp_data)
+        {
+        
+        	$vp_data = $this->clearArrayForSerialization($vp_data);
+        		
+        	$this->db->UpdateQuery(WPSG_TBL_PRODUCTS, array(
+        			"mod_varianten" => wpsg_q(serialize($vp_data))
+        	), "`id` = '".wpsg_q($produkt_id)."'");
+        
+        } // public function saveVarianten($produkt_id, $vp_data)
+        
+        /**
+         * LÃ€dt die Varianteninformationen aus dem serialisierten Array
+         * @param $noTrans Wird diese Variable auf true gesetzt, so wird die Ãbersetzung nicht geladen (Wie Backend) Wichtig wenn die Varianten wieder gespeichert werden sollen!
+         */
+        public function loadVarianten($produkt_id, $noTrans = false, $noCache = false)
+        {
+        		
+        	if (is_admin()) $noCache = true;
+        		
+        	if (!$noCache && array_key_exists($produkt_id.$noTrans, $this->cache_variData)) return $this->cache_variData[$produkt_id.$noTrans];
+        		
+        	// Ãbersetzung verarbeiten
+        	if (is_admin() || $noTrans === true)
+        	{
+        
+        		$vp_data = @unserialize($this->db->fetchOne("SELECT `mod_varianten` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($produkt_id)."'"));
+        		if (!is_array($vp_data)) $vp_data = array();
+        
+        	}
+        	else
+        	{
+        			
+        		// Im Frontend geht es nach der Sprache auf der der Shop aktuell lÃ€uft
+        		if ($this->shop->isOtherLang())
+        		{
+        
+        			$parent_lang_id = $this->db->fetchOne("SELECT `lang_parent` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($produkt_id)."'");
+        			if (!wpsg_isSizedInt($parent_lang_id)) $parent_lang_id = $produkt_id;
+        				
+        			$vp_data = @unserialize($this->db->fetchOne("SELECT `mod_varianten` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($parent_lang_id)."'"));
+        			if (!is_array($vp_data)) $vp_data = array();
+        				
+        			foreach ($vp_data as $k => $v)
+        			{
+        
+        				// Den Namen der Variante auf die aktuelle Sprache stellen
+        				if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'])) $vp_data[$k]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'];
+        
+        				if (wpsg_isSizedArray($vp_data[$k]['vari']))
+        				{
+        						
+        					foreach ($vp_data[$k]['vari'] as $k2 => $vari)
+        					{
+        
+        						// Den Namen der Variation auf die aktuelle Sprache korrigieren
+        						if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'])) $vp_data[$k]['vari'][$k2]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'];
+        
+        					}
+        						
+        				}
+        
+        			}
+        				
+        		}
+        		else
+        		{
+        				
+        			$vp_data = @unserialize($this->db->fetchOne("SELECT `mod_varianten` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($produkt_id)."'"));
+        			if (!is_array($vp_data)) $vp_data = array();
+        				
+        		}
+        
+        	}
+        
+        	$this->cache_variData[$produkt_id.$noTrans] = $vp_data;
+        		
+        	return $vp_data;
+        		
+        } // public function loadVarianten($produkt_id)
+                
+        private function clearArrayForSerialization($ar)
+        {
+        		
+        	foreach ((array)$ar as $k => $v)
+        	{
+        
+        		if (wpsg_isSizedArray($v))
+        		{
+        				
+        			$ar[$k] = $this->clearArrayForSerialization($v);
+        				
+        		}
+        		else
+        		{
+        				
+        			$ar[$k] = preg_replace('/\'|\`|\ÂŽ|\"/', '', $v);
+        				
+        		}
+        
+        	}
+        		
+        	return $ar;
+        		
+        } // private function clearArrayForSerialization($ar)
+        
+        /**
+         * Gibt die Bilder als Array fÃŒr die Variation zurÃŒck
+         * Beachtet die Reihenfolge die im Backend ÃŒber Drag&Drop definiert ist
+         * @param int $var_id Key der Variante
+         * @param int $vari_id Key der Variation
+         */
+        public function getVariImages($product_id, $var_id, $vari_id)
+        {
+        	
+        	$vp_data = $this->loadVarianten($product_id);
+        	
+        	$arProductBilder = $this->shop->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($product_id));
+        
+        	$arReturn = array();
+        
+        	// Bilder in Reihenfolge
+        	//if ($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]['vari'][$vari_id]['picOrder'])) $arReturn = $vp_data[$var_id]['vari'][$vari_id]['picOrder'];
+        	
+        	// PrÃŒfen ob die Bilder noch in Produktbilder Array drin sind
+        	foreach ($arReturn as $k => $v)
+        	{
+        
+        		if (!in_array($v, $arProductBilder)) unset($arReturn[$k]);
+        		else unset($arProductBilder[array_search($v, $arProductBilder)]);
+        
+        	}
+        	
+        	// Bilder aus dem ProduktArray noch hinzufÃŒgen, die eventuell nicht im sortierten Array enthalten sind
+        	foreach ($arProductBilder as $k => $v)
+        	{
+        
+        		$arReturn[] = $v;
+        
+        	}
+        	
+        	$arImageSelect = array();
+        	
+        	// Sind die Bilder in der Variante ausgewÃ€hlt?
+        	if (!is_admin())
+        	{
+        	
+        		if ($vp_data[$var_id]['typ'] == 'checkbox' && wpsg_isSizedString($vp_data[$var_id]['pic'])) $arImageSelect = explode(',', $vp_data[$var_id]['pic']);
+        		else if (wpsg_isSizedString($vp_data[$var_id]['vari'][$vari_id]['pic'])) $arImageSelect = explode(',', $vp_data[$var_id]['vari'][$vari_id]['pic']);
+        	
+        		foreach ($arReturn as $k => $v)
+        		{
+        
+        			if (!in_array($v, $arImageSelect)) unset($arReturn[$k]);
+        
+        		}
+        
+        	}
+        
+        	return $arReturn;
+        	
+        } // public function getVariImages($product_id, $var_id, $vari_id)
+        
 		/**
 		 * PrÃŒft ob das Produkt ein Variantenprodukt ist oder nicht
Index: /mods/wpsg_mod_produktbilder.class.php
===================================================================
--- /mods/wpsg_mod_produktbilder.class.php	(revision 6091)
+++ /mods/wpsg_mod_produktbilder.class.php	(revision 6094)
@@ -201,5 +201,5 @@
 				
 			}
-			else if ($_REQUEST['cmd'] == 'upload2')
+			else if ($_REQUEST['cmd'] == 'upload_mt')
 			{
 				// Mediathek
@@ -229,11 +229,16 @@
 				
 				// Tests
-				$p1 = wp_get_attachment_url($attachment_id);
-				$p2 = get_attached_file( $attachment_id ); // Full path
-				$p3 = get_attachment_link( $attachment_id );
-				$p4 = get_the_title( $attachment_id );
-				$p5 = get_post_type($attachment_id);
-				$p6 = get_post($attachment_id);
-				$p7 = wp_get_attachment_image_src($attachment_id, 'thumbnail');	// Array mit Full-Path, Width, Height
+				$p1 = wp_get_attachment_url($attachment_id);	// http://shop4.home/wp-content/uploads/2017/03/hdrechteckig.png
+				$p2 = get_attached_file( $attachment_id ); 		// C:\xampp\htdocs\wp2/wp-content/uploads/2017/03/hdrechteckig.png
+				$p3 = get_attachment_link( $attachment_id );	// http://shop4.home/hdrechteckig/
+				$p4 = get_the_title( $attachment_id );			// hdrechteckig
+				$p5 = get_post_type($attachment_id);			// attachment
+				$p6 = get_post($attachment_id);					// WP_Post
+				$p7 = wp_get_attachment_image_src($attachment_id, 'thumbnail');	// Array mit Full-URL, Width, Height
+				
+				add_image_size('s_40_40', 40, 40);
+				$ht = wp_get_attachment_image( $attachment_id, Array(40, 40));
+				$p8 = wp_get_attachment_image_src($attachment_id, Array(40, 40));
+				$p80 = $p8[0];
 				
 				//$rw = add_post_meta( $attachment_id, 'wpsg_produkt_id', '6' );
@@ -262,13 +267,15 @@
 				
 			}
-			else if ($_REQUEST['cmd'] == 'remove2')
+			else if ($_REQUEST['cmd'] == 'removemt')
 			{
 			
 				//unlink($this->getPicPath($_REQUEST['edit_id']).'/'.$_REQUEST['file']);
-				if ($_REQUEST['delmt'] == true)	// Auch in der Mediathek lÃ¶schen
+				if ($_REQUEST['delmt'] === 'true') {	// Auch in der Mediathek lÃ¶schen
 					wp_delete_post( $_REQUEST['pid'], true );
-				
-				if ($_REQUEST['del'] == true)	// Zuordnung lÃ¶schen
+				}
+				
+				if ($_REQUEST['del'] === 'true') {	// Zuordnung lÃ¶schen
 					delete_post_meta( $_REQUEST['pid'], 'wpsg_produkt_id', $_REQUEST['edit_id'] );
+				}
 				
 				$this->shop->view['data']['id'] = $_REQUEST['edit_id'];
@@ -276,5 +283,5 @@
 				if ($this->shop->hasMod('wpsg_mod_produktartikel')) $this->shop->callMod('wpsg_mod_produktartikel', 'updatePostThumbnail', array($_REQUEST['edit_id']));
 			
-				die($this->getProduktBilderListe2($_REQUEST['edit_id']));
+				die($this->getProduktBilderListe_MT($_REQUEST['edit_id']));
 			
 			}
@@ -286,13 +293,13 @@
 				
 				$this->shop->view['data']['id'] = $_REQUEST['edit_id'];
-				die($this->getProduktBilderListe2($_REQUEST['edit_id']));
-				
-			}
-			else if ($_REQUEST['cmd'] == 'produktbilder_liste2')
+				die($this->getProduktBilderListe_MT($_REQUEST['edit_id']));
+				
+			}
+			else if ($_REQUEST['cmd'] == 'produktbilder_liste_MT')
 			{
 			
 				$this->shop->view['data']['id'] = $_REQUEST['edit_id'];
 				//$content = $this->getProduktBilderListe($_REQUEST['edit_id']);
-				die($this->getProduktBilderListe2($_REQUEST['edit_id']));
+				die($this->getProduktBilderListe_MT($_REQUEST['edit_id']));
 				
 			}
@@ -362,5 +369,5 @@
 				$this->shop->view['ProduktList'] = $this->getProduktBilderListe($product_data['id']);
 			
-				$this->shop->view['ProduktList2'] = $this->getProduktBilderListe2($product_data['id']);
+				$this->shop->view['ProduktList_MT'] = $this->getProduktBilderListe_MT($product_data['id']);
 				
 			}
@@ -439,5 +446,5 @@
 		 * Zeichnet die Liste mit den Produktbildern
 		 */
-		public function getProduktBilderListe2($produkt_id)
+		public function getProduktBilderListe_MT($produkt_id, $size = 'thumbnail')
 		{
 			global $wpdb;
@@ -453,19 +460,19 @@
 				$p1 = wp_get_attachment_url($val['ID']);
 				$arrf = pathinfo($p1);
-				$this->shop->view['ProduktBilder2'][$i]['fname'] = $arrf['basename'];
+				$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'], 'thumbnail');	// Array mit Full-Path, Width, Height
+				$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['ProduktBilder2'][$i]['pid'] = $val['post_id'];
-				$this->shop->view['ProduktBilder2'][$i]['fname'] = $arrf['basename'];
-				$this->shop->view['ProduktBilder2'][$i]['guid'] = $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;
 				$i++;
 			}
 			
-			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktbilder/produkt_edit_list2.phtml', false);
-				
-		} // public function getProduktBilderListe2($produkt_id)
+			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktbilder/produkt_edit_list_MT.phtml', false);
+				
+		} // public function getProduktBilderListe_MT($produkt_id)
 		
 		/**
@@ -547,4 +554,41 @@
 			
 		} // public function getProduktBilder($produkt_id)
+		
+		/**
+		 * Gibt ein Array mit den Produktbildern zurÃŒck
+		 */
+		public function getProduktBilder_MT($produkt_id)
+		{
+				
+			$arFiles = array();
+		
+			global $wpdb;
+			$data = $this->db->fetchAssoc("SELECT * FROM `".$wpdb->prefix."postmeta` WHERE `meta_key`='".wpsg_q('wpsg_produkt_id')."' AND `meta_value`='".wpsg_q($produkt_id)."' ");
+			
+			$i = 0;
+			foreach ($data as $key => $val) {
+				$p = wp_get_attachment_image_src($val['post_id'], 'full');	// 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;
+				$arFiles[$i]['guid'] = $guid;
+				$arFiles[$i]['post_id'] = $val['post_id'];
+				$arFiles[$i]['basename'] = $arrf['basename'];
+				
+				$i++;
+			}
+			/*	
+			wpsg_asort($arFiles);
+				
+			$arReturn = array();
+			foreach ($arFiles as $k => $v) $arReturn[] = $v;
+		
+			return $arReturn;
+			*/
+			return $arFiles;
+			
+		} // public function getProduktBilder_MT($produkt_id)
 		
 		/*
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 6091)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 6094)
@@ -386,12 +386,5 @@
 				if (trim($this->shop->view['order']['language']) != '') $this->shop->setTempLocale($this->shop->view['order']['language']);
 				
-				$this->shop->view['kunde'] = $this->db->fetchRow("
-					SELECT
-						K.*
-					FROM
-						`".WPSG_TBL_KU."` AS K
-					WHERE
-						K.`id` = '".wpsg_q($this->shop->view['order']['k_id'])."'
-				");
+				$this->getAdresse($this->shop->view['order']['k_id']);
 				
 				$email = $this->shop->view['kunde']['email'];
@@ -574,4 +567,42 @@
 			
 		} // public function order_ajax() 
+		
+		private function getAdresse($kid)
+		{
+			/*
+			$this->shop->view['kunde'] = $this->db->fetchRow("
+					SELECT
+						K.*
+					FROM
+						`".WPSG_TBL_KU."` AS K
+					WHERE
+						K.`id` = '".wpsg_q($kid)."'
+			");
+			*/
+			
+			$this->shop->view['kunde'] = $this->db->fetchRow("
+				SELECT
+					C.`id`,
+					IF (CA.`id` > 0, CA.`title`, C.`title`) AS `title`,
+					IF (CA.`id` > 0, CA.`name`, C.`name`) AS `name`,
+					IF (CA.`id` > 0, CA.`vname`, C.`vname`) AS `vname`,
+					IF (CA.`id` > 0, CA.`firma`, C.`firma`) AS `firma`,
+					IF (CA.`id` > 0, CA.`fax`, C.`fax`) AS `fax`,
+					IF (CA.`id` > 0, CA.`strasse`, C.`strasse`) AS `strasse`,
+					IF (CA.`id` > 0, CA.`nr`, '') AS `nr`,
+					IF (CA.`id` > 0, CA.`plz`, C.`plz`) AS `plz`,
+					IF (CA.`id` > 0, CA.`ort`, C.`ort`) AS `ort`,
+					IF (CA.`id` > 0, CA.`land`, C.`land`) AS `land`,
+					IF (CA.`id` > 0, CA.`tel`, C.`tel`) AS `tel`,
+					C.`geb`, C.`ustidnr`, C.`email`, C.`id`, C.`knr`, C.`wp_user_id`
+				FROM
+					`".WPSG_TBL_KU."` AS C
+						LEFT JOIN `".WPSG_TBL_ADRESS."` AS CA ON (CA.`id` = C.`adress_id`)
+				WHERE
+					C.`id` = '".wpsg_q($kid)."' AND
+					C.`deleted` != '1'
+			");
+				
+		}
 		
 		public function admin_emailconf_save()
@@ -629,12 +660,5 @@
 			if (trim($this->shop->view['data']['language']) != '') $this->shop->setTempLocale($this->shop->view['data']['language']);
 			
-			$this->shop->view['kunde'] = $this->db->fetchRow("
-				SELECT
-					K.*
-				FROM
-					`".WPSG_TBL_KU."` AS K
-				WHERE
-					K.`id` = '".wpsg_q($this->shop->view['data']['k_id'])."'
-			");
+			$this->getAdresse($this->shop->view['data']['k_id']);
 			
 			$custom_data = @unserialize($this->shop->view['data']['custom_data']);
@@ -846,12 +870,5 @@
 			if (trim($this->shop->view['data']['language']) != '') $this->shop->setTempLocale($this->shop->view['data']['language']);
 			
-			$this->shop->view['kunde'] = $this->db->fetchRow("
-				SELECT
-					K.*
-				FROM
-					`".WPSG_TBL_KU."` AS K
-				WHERE
-					K.`id` = '".wpsg_q($this->shop->view['data']['k_id'])."'
-			");
+			$this->getAdresse($this->shop->view['data']['k_id']);
 			
 			$custom_data = @unserialize($this->shop->view['data']['custom_data']);
Index: /mods/wpsg_mod_shippingadress.class.php
===================================================================
--- /mods/wpsg_mod_shippingadress.class.php	(revision 6091)
+++ /mods/wpsg_mod_shippingadress.class.php	(revision 6094)
@@ -13,5 +13,5 @@
 
 		/**
-		 * Costructor
+		 * Constructor
 		 */
 		public function __construct()
@@ -185,10 +185,9 @@
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			
-			if ($this->check_different_shippingadress($order_data['k_id'], $order_id) === true)
+			if ($this->check_different_shippingadress($order_data['k_id'], $order_id) === false)
 			{
 
 				$this->shop->view['wpsg_mod_shippingadress'] = Array();
 				//$this->shop->view['wpsg_mod_shippingadress'] = $order_data;
-				
 				//$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_shippingadress/wpsg_order_view_customerdata.phtml');
 				
@@ -282,7 +281,7 @@
 												`id` = '".wpsg_q($o_id)."'");
 
-			if ($arrAdr['shipping_adress_id'] == 0) return true;
-			if ($arrAdr['shipping_adress_id'] != $arrAdr['adress_id']) return false;
-			return true;
+			if ($arrAdr['shipping_adress_id'] == 0) return false;
+			if ($arrAdr['shipping_adress_id'] != $arrAdr['adress_id']) return true;
+			return false;
 			
 		} // public function check_different_shippingadress()
Index: /system/intern/mods/wpsg_mod_varianten.class.php
===================================================================
--- /system/intern/mods/wpsg_mod_varianten.class.php	(revision 6091)
+++ /system/intern/mods/wpsg_mod_varianten.class.php	(revision 6094)
@@ -1050,8 +1050,8 @@
 		public function getVariImages($product_id, $var_id, $vari_id)
 		{
-			
+			die('getVariImages');
 			$vp_data = $this->loadVarianten($product_id);
 			
-			$arProductBilder = $this->shop->callMod('wpsg_mod_produktbilder', 'getProduktBilder', array($product_id));
+			$arProductBilder = $this->shop->callMod('wpsg_mod_produktbilder', 'getProduktBilder2', array($product_id));
 			 
 			$arReturn = array();
Index: /views/mods/mod_kundenverwaltung/index.phtml
===================================================================
--- /views/mods/mod_kundenverwaltung/index.phtml	(revision 6091)
+++ /views/mods/mod_kundenverwaltung/index.phtml	(revision 6094)
@@ -17,5 +17,5 @@
 				<ul class="nav navbar-nav">
 					<li role="presentation" class="wpsg-customer-tab-a active"><a href="#" onclick="return false;"><?php echo __("Kundenverwaltung", "wpsg"); ?></a></li>
-					<li role="presentation" class="wpsg-customer-tab-a wpsg_showhide_filter <?php echo (($this->view['hasFilter'])?'active':''); ?>" id="wpsg-customer-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
+					<li role="presentation" class="wpsg-customer-tab-a wpsg_showhide_filter <?php echo ((wpsg_isTrue($this->view['hasFilter']))?'active':''); ?>" id="wpsg-customer-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
                     <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("HinzufÃŒgen", "wpsg"); ?></a></li>
 				</ul>
@@ -29,5 +29,5 @@
 		</div>
 
-        <div class="wpsg-filter wpsg-customer-tab wpsg-customer-tab-0 container-fluid form-horizontal" style="display:<?php echo (($this->view['hasFilter'] === true)?'block':'none'); ?>;">
+        <div class="wpsg-filter wpsg-customer-tab wpsg-customer-tab-0 container-fluid form-horizontal" style="display:<?php echo ((wpsg_isTrue($this->view['hasFilter']))?'block':'none'); ?>;">
             <div class="row">
 				<div class="col-lg-4">
Index: /views/mods/mod_productvariants/admin_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/admin_edit.phtml	(revision 6091)
+++ /views/mods/mod_productvariants/admin_edit.phtml	(revision 6094)
@@ -133,4 +133,22 @@
     			<td class="col_image" colspan="<?php echo $colspan; ?>">
     				TODO: Bilder
+    				<?php 
+					$pbArr = $this->callMod('wpsg_mod_produktbilder', 'getProduktBilder_MT', array($this->view['product_id']));
+					$k = $this->view['variant']['id'];
+					$kv = $vari['id'];
+					$temp = $this->callMod('wpsg_mod_productvariants', 'getVariImages', array($this->view['product_id'], $k, $kv));
+					?>
+					<?php $j = 0; foreach ($pbArr as $b) { $j ++; ?>
+							<?php // $this->view['variant']['id']	$vari  $var  $kv  $_REQUEST['pic']
+							$file = $b['basename'];
+							$href = wp_get_attachment_image_src($b['post_id'], Array(25, 25));
+							?>	
+							<a class="<?php //echo ((in_array($file, explode(",", $vari['pic'])))?'mark':''); ?> pic" id="<?php echo $file; ?>" 
+							onclick="return wpsg_vp_vari_setPic(this, <?php echo $k; ?>, <?php echo $kv; ?>, '<?php echo $file; ?>', <?php echo $j; ?>);" href="">
+							<img src="<?php echo $href[0]; ?>" alt="" width="25px" height="25px"/>
+							</a>
+        			<?php } ?>
+					
+    				
     			</td>
     		</tr>
@@ -143,4 +161,77 @@
 	<script type="text/javascript">/* <![CDATA[ */
 
+	function wpsg_vp_vari_setPic(htmlElement, var_id, vari_id, pic, pic_index)
+	{
+
+		<?php if (!isset($_REQUEST['wpsg_lang'])) { ?>
+
+		wpsg_vp_ajaxloading_show();
+		
+		jQuery.ajax( {
+			url: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_productvariants&cmd=wpsg_vp_vari_setPic&noheader=1&edit_id=<?php echo $this->view['product_id']; ?>",
+			async: false,
+			data: {				
+				var_id: var_id,
+				vari_id: vari_id,
+				pic: pic
+			},
+			success: function(data) { 
+				if (vari_id >= 0)
+				{
+					
+					if (jQuery(htmlElement).hasClass('mark'))
+					{
+						jQuery(htmlElement).removeClass('mark');
+					}
+					else
+					{
+						jQuery(htmlElement).addClass('mark');
+					}
+					
+				}
+				else
+				{
+					
+					if (jQuery(htmlElement).hasClass('mark'))
+					{
+						jQuery(htmlElement).removeClass('mark');
+					}
+					else
+					{
+						jQuery(htmlElement).addClass('mark');
+					}
+					
+				}
+
+				wpsg_vp_ajaxloading_hide();
+				
+			}
+		} ); 
+
+		<?php } ?>
+		
+		return false;
+		
+	}
+		
+	function wpsg_vp_ajaxloading_show()
+	{
+
+		jQuery('.wpsg_mod_varianten_ajaxloading').show();
+		
+	}
+
+	function wpsg_vp_ajaxloading_hide()
+	{
+
+		jQuery('.wpsg_mod_varianten_ajaxloading').hide();
+		
+	} 
+
+
+		<?php 
+		$p1 = wpsg_getInt($this->view['product_id']);
+		$p2 = ($this->view['variant']['product_id']);
+		?>
 		<?php if (!wpsg_isSizedInt($this->view['product_id']) || wpsg_isSizedInt($this->view['variant']['product_id'])) { ?>
 
Index: /views/mods/mod_produktbilder/produkt_addedit_content.phtml
===================================================================
--- /views/mods/mod_produktbilder/produkt_addedit_content.phtml	(revision 6091)
+++ /views/mods/mod_produktbilder/produkt_addedit_content.phtml	(revision 6094)
@@ -8,5 +8,5 @@
 ?>
 
-<!-- Modal fÃŒr FTP Pfad anzeige -->
+<!-- Modal fÃŒr FTP Pfad Anzeige -->
 <div class="modal fade" id="wpsg_mod_produktbilder_ftppath" tabindex="-1" role="dialog">
   <div class="modal-dialog" role="document">
@@ -26,4 +26,5 @@
 </div>
 
+<!-- Modal fÃŒr LÃ¶schabfrage -->
 <div class="modal fade" tabindex="-1" role="dialog" id="wpsg_produktbilder_remove">
     <div class="modal-dialog" role="document">
@@ -41,5 +42,5 @@
             <div class="modal-footer">
                 <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Abbrechen', 'wpsg'); ?></button>
-                <button type="button" class="btn btn-primary" onclick="return wpsg_remove_bild2OK();"><?php echo __('LÃ¶schen', 'wpsg'); ?></button>
+                <button type="button" class="btn btn-primary" onclick="return wpsg_remove_bild_MT_OK();"><?php echo __('LÃ¶schen', 'wpsg'); ?></button>
             </div>
         </div>
@@ -56,6 +57,4 @@
 		<?php if ($this->view['data']['id'] > 0) { ?>
 		
-			<div id="produktbilder_target"><?php echo $this->view['ProduktList']; ?></div>
-		
 			<?php if (get_option("wpsg_classicupload") == "1") { ?>
 				
@@ -67,123 +66,25 @@
 				
 			<?php } else { ?>
-		
+
+			<!--  Mediathek -->
+
+			<div id="produktbilder_target_MT"><?php echo $this->view['ProduktList_MT']; ?></div>
+
+			<div class="wpsg_clear"></div>
+			<div><?php echo __("Bitte klicken Sie auf Mediathek um ein Bild hochzuladen. Um ein Bild zu lÃ¶schen klicken Sie einfach auf das Bild.", "wpsg"); ?></div>
 			<div class="wpsg_clear"></div><br />
-			<div><?php echo __("Bitte klicken Sie auf Upload um ein Bild hochzuladen. Um ein Bild zu lÃ¶schen klicken Sie einfach auf das Bild.", "wpsg"); ?></div>
-			<div class="wpsg_clear"></div><br />
-			
-			<input value="Upload" type="text" style="text-align:center;" size="10" id="upload_button" />
-			
+		
+			<input value="Mediathek" class="button" type="text" style="text-align:center;" size="10" id="btnAddImgLink" />
+			<!-- <input value="UploadMT" class="button" type="text" style="text-align:center;" size="10" id="upload_button_mt" /> -->
+
 			<script type="text/javascript">/* <![CDATA[ */
-						   
+				/*
 				jQuery(document).ready(function() {									
 					new AjaxUpload(
-						"upload_button", {
-							action: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=upload&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1",
+						"upload_button_mt", {
+							action: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=upload_mt&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1",
 							onSubmit: function(file, extension) {
 
-								jQuery('#produktbilder_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-								
-							},
-							onComplete: function(file, response) {
-
-								if (response == '1')
-								{
-									
-									jQuery("#produktbilder_target").load("<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=produktbilder_liste&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1");
-
-									if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
-									
-								}
-								else
-								{
-									alert(response);
-								}
-								
-							}										
-						}
-					);					   
-			   	});
-			
-			/* ]]> */</script>
-			
-			<?php } ?> 
-			
-			<script type="text/javascript">/* <![CDATA[ */
-
-				/**
-				 * LÃ¶scht den Bildercache dieses Produktes
-				 */
-				function wpsg_clearImageCache()
-				{
-
-					jQuery.ajax( {
-						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=clearProductCache&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
-						async: true,						
-						success: function(data) { alert(data); }
-					} );
-					
-					return false;
-
-				} // function wpsg_clearImageCache()					
-            
-				/**
-				 * Wird beim lÃ¶schen eines Bilds (anklicken) aufgerufen
-				 */
-				function wpsg_remove_bild(strBild)
-				{
-
-					if (!confirm('<?php echo __('Sind Sie sicher, das Sie dieses Bild lÃ¶schen mÃ¶chten?', 'wpsg'); ?>')) return false;
-
-					jQuery('#produktbilder_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-					
-					jQuery.ajax( {
-						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=remove&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
-						async: true,
-						data: {
-							file: strBild
-						},
-						success: function(data) {
-							
-							jQuery('#produktbilder_target').html(data);
-
-							if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
-							
-						}
-					} );
-
-					return false;
-					
-				}
-			
-			/* ]]> */</script>
-			
-		<?php } else { ?>
-		<p><?php echo __('Das Hochladen von Produktbildern ist erst nach erstmaligem speichern mÃ¶glich.', 'wpsg'); ?></p>
-		<?php } ?> 
-	
-		<div class="wpsg_clear"></div><br />
-		
-		<?php if (wpsg_isSizedInt($this->view['data']['id'])) { ?>
-		<a href="#" data-toggle="modal" data-target="#wpsg_mod_produktbilder_ftppath"><span class="wpsg-glyphicon glyphicon glyphicon-folder-open"></span><?php echo __('FTP Pfad anzeigen', 'wpsg'); ?></a><br />
-		<a href="#" onclick="return wpsg_clearImageCache();"><span class="wpsg-glyphicon glyphicon glyphicon-trash"></span><?php echo __('Bildercache dieses Produktes lÃ¶schen', 'wpsg'); ?></a><br />
-		<?php } ?>
-			
-		<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_produktbilder"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Konfiguration der Produktbilder', 'wpsg'); ?></a>
-		
-		<!--  Mediathek -->
-		<hr>
-			<div id="produktbilder_target2"><?php echo $this->view['ProduktList2']; ?></div>
-			
-			<input value="WPmedia" class="button" type="text" style="text-align:center;" size="10" id="btnAddImgLink" />
-			<input value="Upload2" class="button" type="text" style="text-align:center;" size="10" id="upload_button2" />
-
-			<script type="text/javascript">/* <![CDATA[ */
-				jQuery(document).ready(function() {									
-					new AjaxUpload(
-						"upload_button2", {
-							action: "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=upload2&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1",
-							onSubmit: function(file, extension) {
-
-								jQuery('#produktbilder_target2').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+								jQuery('#produktbilder_target_MT').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
 								
 							},
@@ -194,7 +95,7 @@
 								{
 									
-									jQuery("#produktbilder_target2").load("<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=produktbilder_liste2&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1");
-
-									//jQuery('#produktbilder_target2').html(data);
+									jQuery("#produktbilder_target_MT").load("<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=produktbilder_liste_MT&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1");
+
+									//jQuery('#produktbilder_target_MT').html(data);
 									//if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
 									
@@ -209,10 +110,12 @@
 					);					   
 			   	});
-
+				*/
+				
 				var post_id;
+				
 				/**
 				 * Wird beim lÃ¶schen eines Bilds (anklicken) aufgerufen
 				 */
-				function wpsg_remove_bild2(pid) {
+				function wpsg_remove_bild_MT(pid) {
 
 					post_id = pid;
@@ -223,5 +126,5 @@
 				}
 				
-				function wpsg_remove_bild2OK() {
+				function wpsg_remove_bild_MT_OK() {
 
 					delmt = jQuery('#dialog_produktbilder_delmt').is(':checked');
@@ -230,8 +133,8 @@
 					jQuery('#wpsg_produktbilder_remove').modal('hide');
 
-					jQuery('#produktbilder_target2').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+					jQuery('#produktbilder_target_MT').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
 					
 					jQuery.ajax( {
-						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=remove2&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=removemt&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
 						async: true,
 						data: {
@@ -242,5 +145,5 @@
 						success: function(data) {
 							
-							jQuery('#produktbilder_target2').html(data);
+							jQuery('#produktbilder_target_MT').html(data);
 
 							//if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
@@ -308,5 +211,5 @@
 								success: function(data) {
 									
-									jQuery('#produktbilder_target2').html(data);
+									jQuery('#produktbilder_target_MT').html(data);
 
 								}
@@ -337,4 +240,70 @@
 				
 			/* ]]> */</script>
+
+			
+			<?php } ?> 
+			
+			<script type="text/javascript">/* <![CDATA[ */
+
+				/**
+				 * LÃ¶scht den Bildercache dieses Produktes
+				 */
+				function wpsg_clearImageCache()
+				{
+
+					jQuery.ajax( {
+						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=clearProductCache&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+						async: true,						
+						success: function(data) { alert(data); }
+					} );
+					
+					return false;
+
+				} // function wpsg_clearImageCache()					
+            
+				/**
+				 * Wird beim lÃ¶schen eines Bilds (anklicken) aufgerufen
+				 */
+				function wpsg_remove_bild(strBild)
+				{
+
+					if (!confirm('<?php echo __('Sind Sie sicher, das Sie dieses Bild lÃ¶schen mÃ¶chten?', 'wpsg'); ?>')) return false;
+
+					jQuery('#produktbilder_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+					
+					jQuery.ajax( {
+						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_produktbilder&cmd=remove&noheader=1&edit_id=<?php echo $this->view['data']['id']; ?>',
+						async: true,
+						data: {
+							file: strBild
+						},
+						success: function(data) {
+							
+							jQuery('#produktbilder_target').html(data);
+
+							if (typeof wpsg_vp_refresh == "function") wpsg_vp_refresh();
+							
+						}
+					} );
+
+					return false;
+					
+				}
+			
+			/* ]]> */</script>
+			
+		<?php } else { ?>
+		<p><?php echo __('Das Hochladen von Produktbildern ist erst nach erstmaligem speichern mÃ¶glich.', 'wpsg'); ?></p>
+		<?php } ?> 
+	
+		<div class="wpsg_clear"></div><br />
+		
+		<?php if (false && wpsg_isSizedInt($this->view['data']['id'])) { ?>
+		<a href="#" data-toggle="modal" data-target="#wpsg_mod_produktbilder_ftppath"><span class="wpsg-glyphicon glyphicon glyphicon-folder-open"></span><?php echo __('FTP Pfad anzeigen', 'wpsg'); ?></a><br />
+		<a href="#" onclick="return wpsg_clearImageCache();"><span class="wpsg-glyphicon glyphicon glyphicon-trash"></span><?php echo __('Bildercache dieses Produktes lÃ¶schen', 'wpsg'); ?></a><br />
+		<?php } ?>
+			
+		<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_produktbilder"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Konfiguration der Produktbilder', 'wpsg'); ?></a>
+		
 						
 	</div>
Index: /views/mods/mod_produktbilder/produkt_edit_list_MT.phtml
===================================================================
--- /views/mods/mod_produktbilder/produkt_edit_list_MT.phtml	(revision 6094)
+++ /views/mods/mod_produktbilder/produkt_edit_list_MT.phtml	(revision 6094)
@@ -0,0 +1,27 @@
+<?php
+	
+	/**
+	 * Template fÃŒr die Liste der Bilder eines Produkts
+	 */
+
+?>
+
+  <?php if (isset($this->view['ProduktBilder_MT']) && (sizeof($this->view['ProduktBilder_MT']) > 0)) { ?>
+
+	<?php foreach ($this->view['ProduktBilder_MT'] as $b) { ?>
+	
+		<div class="wpsg_mod_produktbilder_admin_bild">
+
+			<a onclick="return wpsg_remove_bild_MT('<?php echo $b['pid']; ?>');" href="#" title="<?php echo __('Dieses Bild lÃ¶schen.', 'wpsg'); ?>">
+				<img src="<?php echo $b['guid']; ?>" alt="<?php echo wpsg_hspc($b['fname']); ?>" />
+				<span><span class="glyphicon glyphicon-trash"></span></span>
+			</a>
+			
+		</div>
+	
+	<?php } ?>
+	<div class="wpsg_clear"></div>
+
+  <?php } else { ?>
+    <p><?php echo __('Bisher keine Produktbilder hochgeladen.', 'wpsg'); ?></p>
+  <?php } ?>
Index: /views/mods/mod_shippingadress/wpsg_order_view_customerdata.phtml
===================================================================
--- /views/mods/mod_shippingadress/wpsg_order_view_customerdata.phtml	(revision 6091)
+++ /views/mods/mod_shippingadress/wpsg_order_view_customerdata.phtml	(revision 6094)
@@ -69,5 +69,5 @@
 
         if (wpsg_isSizedString($this->view['wpsg_mod_shippingadress']['shipping_title']) && $this->view['wpsg_mod_shippingadress']['shipping_title'] != '-1')
-            echo $this->view['arTitles'][$this->view['wpsg_mod_shippingadress']['shipping_title']];
+            echo $this->view['wpsg_mod_shippingadress']['shipping_title'];
 
     ?> <?php echo wpsg_hspc($this->view['wpsg_mod_shippingadress']['shipping_vname']); ?> <?php echo wpsg_hspc($this->view['wpsg_mod_shippingadress']['shipping_name']); ?><br />
Index: /views/order/view_customerdata.phtml
===================================================================
--- /views/order/view_customerdata.phtml	(revision 6091)
+++ /views/order/view_customerdata.phtml	(revision 6094)
@@ -58,5 +58,5 @@
     <?php echo wpsg_hspc($this->view['data']['firma']); ?><br />
     <?php } ?>
-    <?php echo (($this->view['data']['title'] != '' && $this->view['data']['title'] != '-1')?wpsg_hspc($this->view['arTitles'][$this->view['data']['title']]).' ':''); ?><?php echo wpsg_hspc($this->view['data']['vname']); ?> <?php echo wpsg_hspc($this->view['data']['name']); ?><br />
+    <?php echo (($this->view['data']['title'] != '' && $this->view['data']['title'] != '-1')?wpsg_hspc($this->view['data']['title']).' ':''); ?><?php echo wpsg_hspc($this->view['data']['vname']); ?> <?php echo wpsg_hspc($this->view['data']['name']); ?><br />
     <?php echo wpsg_hspc($this->view['data']['strasse']); ?><br />
     <?php echo wpsg_hspc($this->view['data']['plz']); ?> <?php echo wpsg_hspc($this->view['data']['ort']); ?> <?php echo wpsg_hspc($this->view['country']['kuerzel']); ?><br />
Index: /views/produkttemplates/standard_mt.phtml
===================================================================
--- /views/produkttemplates/standard_mt.phtml	(revision 6094)
+++ /views/produkttemplates/standard_mt.phtml	(revision 6094)
@@ -0,0 +1,341 @@
+<?php
+
+	/*
+	 * Template fÃŒr das Produkt im Frontend
+	 */
+
+	//Ausgabe der verfÃŒgbaren Variablen
+	//wpsg_debug($this->view['data']);
+
+	// Damit keine ZubehÃ¶rprodukte ausgegeben werden
+	//$this->noReleatedProducts = true; 
+
+	//wpsg_debug($_SESSION);
+  
+if (!function_exists('is_plugin_active'))
+	require_once(ABSPATH.'/wp-admin/includes/plugin.php');
+?>
+<div class="container container-fluid-page">
+	
+	<div class="wpsg_produkt_wrapper">
+	
+		<input type="hidden" name="wpsg_post_id" value="<?php echo get_the_ID(); ?>" />
+	
+		<?php $this->callMods('product_top', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>
+	
+		<div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
+							
+			<div class="wpsg_product_mod_information_left">		
+				<div class="wpsg_product_afterimage">
+					<?php /* Block fÃŒr die Produktbilder START */ ?>
+					<?php if ($this->hasMod('wpsg_mod_produktbilder')) { ?>	
+					<div class="wpsg_produkt_produktbilder">
+						<?php 
+						$pbw = $this->get_option('wpsg_mod_produktbilder_width');
+						$pbh = $this->get_option('wpsg_mod_produktbilder_height');
+						$pbm = $this->get_option('wpsg_mod_produktbilder_mode');
+						$pbArr = $this->callMod('wpsg_mod_produktbilder', 'getProduktBilder2', array($this->view['data']['id']));
+						?>
+						<?php if (sizeof($pbArr)) { ?>
+						<?php $i = 0; foreach ($pbArr as $b) { $i ++; ?>
+						<?php if ($i == 1 && !wpsg_isSizedString($this->view['data']['varianten_image']) || $b['basename'] == $this->view['data']['varianten_image']) { ?>
+						<div class="wpsg_produkt_preview wpsg_pb_pic">
+							<?php 
+							$href = wp_get_attachment_image_src($b['post_id'], Array(800, 600));
+							$imgtag = wp_get_attachment_image($b['post_id'], Array($pbw, $pbh));
+							?>	
+							<a class="wpsg_imagelink thickbox" rel="<?php echo $this->view['product_index']; ?>-<?php echo $this->view['data']['id']; ?>" 
+							href="<?php echo $href[0]; ?>"> <?php echo $imgtag; ?>
+							</a>
+						</div>
+						<?php } else { ?>
+						<div class="wpsg_pb_pic" style="display:none;">
+							<?php 
+							$href = wp_get_attachment_image_src($b['post_id'], Array(800, 600));
+							$imgtag = wp_get_attachment_image($b['post_id'], Array($pbw, $pbh));
+							?>	
+							<a class="wpsg_imagelink thickbox" rel="<?php echo $this->view['product_index']; ?>-<?php echo $this->view['data']['id']; ?>" href="<?php echo $href[0]; ?>">
+								<?php echo $imgtag; ?>
+							</a>
+						</div>
+						<?php } ?>
+						<?php } ?>
+						<?php } ?>
+						<div class="wpsg_clear"></div>
+					</div>
+					<?php } ?>
+					<?php /* Block fÃŒr die Produktbilder ENDE */ ?>
+				</div>
+			</div>
+			
+			<div class="wpsg_product_mod_information_right">	
+				<?php /* Block fÃŒr Produktbeschreibung START */ ?>
+				<div class="wpsg_produkt wpsg_product_name">
+					<h1 itemprop="name" class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
+					<?php $this->callMods('product_top_afterheadline', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>	
+				</div>
+				<br/>
+				<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
+				<div class="wpsg_artikelnummer"> 
+					<?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
+					<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
+						<?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
+					<?php } ?>
+					<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
+						<?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
+					<?php }?></div>
+				<?php } ?>
+			
+				<?php /* Abfrage Preisanzeige nur fÃŒr eingeloggte User aktiv und User eingeloggt START*/ ?> 
+				<?php if (($this->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn') && ($this->get_option('wpsg_mod_kundenverwaltung_preisAnzeige') == '1')) || ($this->get_option('wpsg_mod_kundenverwaltung_preisAnzeige') == '0')) { ?>
+							
+					<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis">
+						<label><?php echo __('StÃŒckpreis:', 'wpsg'); ?></label>				
+						<meta itemprop="priceCurrency" content="<?php echo $this->get_option('wpsg_currency'); ?>" />
+						<span itemprop="price" class="wpsg_preis preis_<?php echo $this->view['data']['id']; ?>" id="preis_<?php echo $this->view['data']['id']; ?>">
+							<?php echo wpsg_ff($this->view['data']['preis'], $this->get_option('wpsg_currency')); ?>
+						</span> <?php if (wpsg_isSizedString($this->view['data']['price_info'])) { echo '<div class="wpsg_priceinfo">'.wpsg_hspc($this->view['data']['price_info']).'</div>'; } ?>
+						
+						<?php if ($this->hasMod('wpsg_mod_discount') && wpsg_getInt($this->view['data']['preis_prediscount']) > 0 && wpsg_isSizedInt($this->get_option('wpsg_mod_discount_show'))) { ?>				
+						<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis new_price">
+		            		<?php echo __('Originalpreis', 'wpsg'); ?>: <span class="wpsg_preis_prediscount"><?php echo wpsg_ff($this->view['data']['preis_prediscount'], $this->get_option('wpsg_currency')); ?></span>		
+						</div>
+						<?php } ?>		
+					</div>
+								
+					<?php if ($this->get_option('wpsg_kleinunternehmer')) { /* Kleinunternehmerregelung aktiviert START */ ?>		
+					
+						<div class="wpsg_produkt_preishinweis">
+							<?php echo wpsg_translate(__('#2# zzgl. #1#', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>', '<a href="#kkhint" title="'.wpsg_hspc($this->get_option('wpsg_kleinunternehmer_text')).'">Endpreis</a>'); ?>
+						</div>
+					
+					<?php } else { /* Kleinunternehmerregelung aktiviert ENDE */ ?>	
+			
+						<div class="wpsg_produkt_preishinweis">		
+							<?php if ($this->getFrontendTaxview() == WPSG_NETTO) { /* Frontend = NETTO Preise */ ?>
+							<?php echo wpsg_translate(__('(zzgl. #1#% MwSt. und zzgl. #2#)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value']), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+							<?php } else { /* Frontend = BRUTTO Preise */ ?>
+							<?php echo wpsg_translate(__('(inkl. #1#% MwSt. und zzgl. #2#)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value']), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+							<?php } ?>
+						</div>
+						
+					<?php } ?>
+				<?php } else {?>
+				
+					<?php echo wpsg_translate(__('Die Produktpreise werden nur eingeloggten Benutzern angezeigt. Loggen Sie sich <a href="'.$this->getURL(wpsg_ShopController::URL_PROFIL).'">hier</a> bitte ein, um zu bestellen.')); ?>
+				
+				
+				<?php }?>
+				<?php /* Abfrage Preisanzeige nur fÃŒr eingeloggte User aktiv und User eingeloggt ENDE */ ?> 	
+				 			
+				<div itemprop="description" class="wpsg_produkt_shortdescription"> 
+					<h3><?php echo wpsg_translate(__('Produktbeschreibung', 'wpsg')); ?></h3>
+					<span><?php echo $this->view['data']['shortdesc']; ?></span>
+				</div>			
+				
+				<div class="wpsg_product_informations_left"> 
+					<?php /* Lagerbestand START*/?>
+					<?php if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showProduct') == '1') { ?>
+					<div class="wpsg_mod_produktindex_stock">
+						<img src="<?php echo WPSG_URL_WP;?>wp-content/plugins/wpshopgermany/views/gfx/stock_pos.png" />
+						<label><?php echo wpsg_translate(__('#1#','wpsg'), $this->view['data']['stock']);  ?></label><?php echo wpsg_translate(__(' Artikel auf Lager', 'wpsg')); ?>	
+					</div>
+					<?php } ?>
+					<?php /* Lagerbestand ENDE*/?>
+					
+					<?php /* FÃŒllmengenanzeige START */ ?>
+					<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
+					
+						<div class="wpsg_produkt_fuellmenge">
+						<label><?php echo wpsg_translate(__('FÃŒllmenge:', 'wpsg')); ?></label>
+						<?php echo wpsg_translate(__('#1# (#2# / #3#)', 'wpsg'), 
+							'<span class="wpsg_fmenge">'.wpsg_ff($this->view['data']['fmenge'], '', true).'</span> '.$this->view['data']['feinheit'],
+							'<span class="fmenge_preis">'.wpsg_ff($this->view['data']['fmenge_preis'], $this->get_option('wpsg_currency')).'</span> ',
+							wpsg_ff($this->get_option('wpsg_mod_fuellmenge_bezug'), $this->view['data']['feinheit'])
+						); ?>
+						</div>
+										
+					<?php } ?>		
+					<?php /* FÃŒllmengenanzeige ENDE */ ?>
+				</div>
+				
+				<div class="wpsg_product_informations_right">				
+					<?php /* Lieferzeit Anzeige START */ ?>
+					<?php if ($this->hasMod('wpsg_mod_deliverytime') && $this->get_option('wpsg_mod_deliverytime_show_product') == '1') { ?>
+						
+						<?php /* Produkt nur im Store, nicht im Onlineshop vorhanden */ ?>				
+						<?php if ($this->callMod('wpsg_mod_deliverytime', 'isStoreProduct', array($this->view['data']['product_key'])))  {?>
+							
+							<span class="wpsg_product_only_store"><?php echo wpsg_translate($this->get_option('wpsg_mod_deliverytime_storetext')); ?></span>
+		                    <?php if (wpsg_isSizedInt($this->get_option('wpsg_page_mod_deliverytime_storelink'))) { ?>
+		                    &nbsp;<a href="<?php echo get_permalink($this->get_option('wpsg_page_mod_deliverytime_storelink')); ?>"><?php echo __('So erreichen Sie uns.'); ?></a>
+		                    <?php } ?>
+		                    <br />
+						
+						<?php } else {?>
+							<div class="wpsg_mod_deliverytime">
+								<img src="<?php echo WPSG_URL_WP;?>wp-content/plugins/wpshopgermany/views/gfx/deliverytime.png" />
+								<label><?php echo wpsg_translate(__('Lieferzeit:', 'wpsg')); ?></label>
+								<?php echo $this->callMod('wpsg_mod_deliverytime', 'displayDeliveryTime', array($this->view['data']['product_key'])); ?>
+														
+							</div>
+							
+							<?php $strDelayNote = $this->callMod('wpsg_mod_deliverytime', 'displayDelayTime', array($this->view['data']['product_key'])); ?>
+							<?php if (wpsg_isSizedString($strDelayNote)) { ?>
+							<div class="wpsg_mod_deliverytime_offline">
+								<img src="<?php echo WPSG_URL_WP;?>wp-content/plugins/wpshopgermany/views/gfx/deliverytime-offline.png" />
+								<div class="wpsg_mod_deliverytime_delay"><?php echo wpsg_hspc($strDelayNote); ?></div>
+							</div>
+							<?php } ?> 
+							
+						<?php } ?>
+					<?php } ?>
+					<?php /* Lieferzeit Anzeige ENDE */ ?>
+								
+					<?php /* Gewichtsanzeige START */ ?>
+					<?php if ($this->hasMod('wpsg_mod_weight') && $this->get_option('wpsg_mod_weight_showProduct') === '1') { ?>
+					<div class="wpsg_mod_weight_produkt">
+						<label><?php echo wpsg_translate(__('Gewicht:', 'wpsg')); ?></label>
+						<?php echo wpsg_translate(__('#1# #2#', 'wpsg'), '<span class="wpsg_weight" id="weight_'.$this->view['data']['id'].'">'.wpsg_ff($this->view['data']['weight']).'</span>', $this->get_option('wpsg_mod_weight_unit')); ?>
+					</div>
+					<?php } ?>
+					<?php /* Gewichtsanzeige ENDE */ ?>
+					
+					<?php /* Varianten START */ ?>
+					<div class="wpsg_produkt_varianten">
+						<?php echo $this->callMod('wpsg_mod_varianten', 'renderTemplate', array($this->view['data']['product_key'])); ?>
+					</div>
+					<?php /* Varianten ENDE */ ?>			
+				</div>
+				
+				<div class="wpsg_clear"></div>
+				
+				<div class="wpsg_product_buttonarea">
+					<div class="wpsg_product_buttons_add_basket">							
+						<?php if ($this->callMods('productForSale', array($this->view['data']['product_key'])) || ($this->hasMod('wpsg_mod_request') && $this->callMod('wpsg_mod_request', 'isRequestProduct', array($this->view['data']['id'])))) { ?>
+						<div class="wpsg_produkt_add_basket_wrapper">	
+							
+							<label class="wpsg_amount_label" for="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>"><?php echo __('Anzahl', 'wpsg'); ?>:</label>
+							
+							<input type="text" value="<?php echo ((wpsg_isSizedInt($this->view['data']['menge']))?$this->view['data']['menge']:'1'); ?>" name="wpsg[menge]" class="wpsg_menge" id="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>" 
+								<?php echo (($this->view['data']['basket_multiple'] == 4)?' readonly="readonly" ':''); ?>	
+							/>	
+										
+							<?php if (in_array($this->get_option('wpsg_afterinsert'), array('2', '3'))) { ?>
+							<script type="text/javascript">
+				
+								jQuery(document).ready(function() { 
+									
+									jQuery('.wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>').bind('click', function() {
+										
+										jQuery('.wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>').prop('disabled', true);
+							 			 
+										jQuery.ajax( {
+											url: '<?php echo $this->getURL(wpsg_ShopController::URL_BASKET); ?>',
+											data:
+											{
+												'wpsg_form_data': jQuery('#wpsg_produktform_<?php echo $this->getTemplateIndex(); ?>').serialize(),
+												'wpsg[ajax]': '1',
+												'wpsg[submit]': '1'					
+											}, 
+											success: function(data) 
+											{
+												  
+												<?php if ($this->get_option('wpsg_afterinsert') == '2') { ?>
+												tb_show('<?php echo __('Ihr Warenkorb', 'wpsg'); ?>', '<?php echo $this->getURL(wpsg_ShopController::URL_BASKET_AJAX); ?>&height=500');
+												<?php } else { ?>
+			
+												jQuery('#wpsg_basket_ajax_message_wrap').remove();
+												jQuery('body').append('<div id="wpsg_basket_ajax_message_wrap">' + data + '</div>');
+												
+												<?php } ?>
+			
+												wpsg_refreshBasketWidget();
+												jQuery('.wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>').prop('disabled', false);
+												
+											}
+										} );	
+										
+										return false;
+										
+									} );
+				
+								} );
+							 
+							</script>
+							<?php } ?>
+							
+							<div class="wpsg_clear"></div>
+							
+						</div>
+						<?php } ?>
+					</div>
+					
+					<?php /* Abfrage Warenkorbanzeige nur fÃŒr eingeloggte Benutzer START */ ?>
+					<div class="wpsg_product_button_basket">
+						<?php if (($this->callMod('wpsg_mod_kundenverwaltung', 'isLoggedIn') && ($this->get_option('wpsg_mod_kundenverwaltung_preisAnzeige') == '1')) || ($this->get_option('wpsg_mod_kundenverwaltung_preisAnzeige') == '0')) { ?>
+							<?php if ($this->callMods('productForSale', array($this->view['data']['product_key']))) { ?>
+								<input class="wpsg_button wpsg_add_basket wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>" type="submit" value="<?php echo __('In den Warenkorb', 'wpsg'); ?>" name="wpsg[submit]" />
+							<?php } ?>		
+						<?php }else{?>
+							<a class="wpsg_blind_basket_button" href="#"><?php echo wpsg_translate(__('Loggen Sie sich bitte ein, um zu bestellen', 'wpsg')); ?></a>
+						<?php } ?>
+						<?php /* Abfrage Warenkorbanzeige nur fÃŒr eingeloggte Benutzer ENDE */ ?>
+					</div>
+				</div>
+				
+				<div class="wpsg_clear"></div>	
+				
+				<?php if ($this->hasMod('wpsg_mod_request') && $this->callMod('wpsg_mod_request', 'isRequestProduct', array($this->view['data']['id']))) { ?> 
+					<input class="wpsg_button wpsg_add_requestlist" id="wpsg_add_requestlist_<?php echo $this->getTemplateIndex(); ?>" type="submit" value="<?php echo __('Auf die Anfrageliste', 'wpsg'); ?>" name="wpsg[submit_request]" />
+				<?php } ?>
+
+			</div>
+				
+			<div class="wpsg_clear"></div>	
+				
+		</div> 
+		
+		<?php /* Produktcontentbereich START */ ?>
+		<div class="wpsg_product_informationarea">
+						
+			<?php if (strlen(trim($this->view['data']['longdescription'])) > 0) { ?>
+			<div class="wpsg_product_information_large">
+				<div class="wpsg_produkt_additional_information">
+					<div itemprop="description" class="wpsg_produkt_longdescription">
+						<h3><?php echo wpsg_translate(__('Beschreibung', 'wpsg')); ?></h3>
+						<span><?php echo $this->view['data']['longdescription']; ?></span>
+					</div>
+				</div>
+			</div>
+			<?php } ?>
+			
+			<div class="wpsg_product_information_more">
+				<div itemprop="description" class="wpsg_produkt_more_information">
+					<h3><?php echo wpsg_translate(__('ZusÃ€tzliche Informationen', 'wpsg')); ?></h3>
+				</div>
+			</div>
+			
+			<div class="wpsg_product_assessment">
+				<div itemprop="description" class="wpsg_product_assessments">
+					<h3><?php echo wpsg_translate(__('Bewertungen', 'wpsg')); ?></h3>
+				</div>
+			</div>
+			
+		<?php /* Produktcontentbereich ENDE */ ?>
+		</div>			
+		
+		<div class="wpsg_clear"></div>
+		
+		<?php /* Social Media Integration */ ?>
+		<div class="wpsg_product_social_media">
+			<?php if ( is_plugin_active( 'plugin-directory/shariff.php' )) {?>
+				<?=do_shortcode('[shariff]')?>
+			<?php } ?>
+		</div>
+		
+		<?php $this->callMods('product_bottom', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>
+
+	</div>	
+		
+</div> 
