Index: ds/wpsg_mod_funding.class.php
===================================================================
--- /mods/wpsg_mod_funding.class.php	(revision 6508)
+++ 	(revision )
@@ -1,288 +1,0 @@
-<?php
-
-	/**
-	 * Erlaubt die Definition und Anzeige von Lieferzeiten
-	 * @author Daschmi (daniel@maennchen1.de)
-	 */
-	class wpsg_mod_funding extends wpsg_mod_basic
-	{
-	
-		var $lizenz = 1;
-		var $id = 2050;  
-		var $version = "9.9.9"; 
-		
-		var $free = true;
-		
-		var $arStateLabel;
-		
-		const STATE_COMPLETED = 1;
-		const STATE_RUNNING = 2;
-		const STATE_CLOSED = 3;
-		const STATE_NOTSTARTET = 4;
-	
-		/**
-		 * Costructor
-		 */
-		public function __construct()
-		{
-	
-			parent::__construct();
-	
-			$this->name = __('Crowdfunding', 'wpsg');
-			$this->group = __('Produkte', 'wpsg');
-			$this->desc = __('Erlaubt den Verkauf von Produkten die durch mehrere KÃ€ufer finanziert werden.', 'wpsg');
-	
-			$this->arStateLabel = array(
-				self::STATE_COMPLETED => __('Erfolgreich Abgeschlossen', 'wpsg'),
-				self::STATE_RUNNING => __('LÃ€uft', 'wpsg'),
-				self::STATE_CLOSED => __('Zeitraum abgelaufen', 'wpsg'),
-				self::STATE_NOTSTARTET => __('Noch nicht gestartet', 'wpsg')
-			);
-			
-		} // public function __construct()
-	
-		public function install()
-		{
-			
-			
-			
-		} // public function install()
-		
-		public function settings_edit()
-		{
-		
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/settings_edit.phtml');
-			
-		} // public function settings_edit()
-		
-		public function settings_save()
-		{
-			
-			
-			
-		} // public function settings_save()
-		
-		public function product_bottom(&$produkt_id, $template_index) 
-		{ 
-		
-			$this->shop->view['wpsg_mod_funding']['state'] = $this->getFundingState($produkt_id);
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_bottom.phtml');
-			
-		} // public function product_bottom(&$produkt_id, $template_index)
-		
-		public function basket_produkttosession($product_key, &$menge, &$ses_data) 
-		{ 
-			
-			$product_id = $this->shop->getProduktID($product_key);
-			
-			if ($this->isFundingProduct($product_id))
-			{
-				
-				// Anzahl schon im Warenkorb
-				$nBasket = $this->shop->basket->getBasketAmount($product_key);
-				
-				if ($nBasket + $menge + $this->getCurrentFundingCount($product_id) > $this->getMaxFundingCount($product_id))
-				{
-					
-					$nMengeAllowed = $this->getMaxFundingCount($product_id) - $this->getCurrentFundingCount($product_id)- $nBasket;
-					
-					if ($nMengeAllowed > 0) 
-					{
-						
-						$menge = $nMengeAllowed;
-						$this->shop->addFrontendError(wpsg_translate(
-							__('Produkt "#1#" kann nur noch maximal #2# mal erworben werden.', 'wpsg'),
-							$this->shop->getProductName($product_id),
-							$nMengeAllowed
-						));
-																		
-					}
-					else
-					{
-				
-						$this->shop->addFrontendError(wpsg_translate(
-							__('Produkt "#1#" kann nicht mehr erworben werden.', 'wpsg'),
-							$this->shop->getProductName($product_id)
-						));
-						
-						return -2;
-						
-					}
-					 
-				}
-				
-			}
-			
-		} // public function basket_produkttosession($produkt_key, &$menge, &$ses_data)
-		
-		public function product_top_afterheadline($product_id, $template_index) 
-		{ 
-		
-			if (!$this->isFundingProduct($product_id)) return;
-			
-			$this->shop->view['wpsg_mod_funding'] = array(
-				'currentFundingCount' => $this->getCurrentFundingCount($product_id),
-				'maxFundingCount' => $this->getMaxFundingCount($product_id),
-				'stateLabel' => $this->arStateLabel[$this->getFundingState($product_id)]
-			);
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_top_afterheadline.phtml');
-			
-		} // public function product_top_afterheadline($product_id, $template_index)
-		
-		public function wp_foot() 
-		{ 
-			
-			echo '<script type="text/javascript">/* <![CDATA[ */
-			
-				function wpsg_mod_funding_scroll()
-				{
-					
-					var scroll_y = jQuery(window).scrollTop();
-					
-					jQuery(".wpsg_mod_funding_state_value[data-wpsg-funding-width]").each(function() {
-					
-						if (scroll_y > jQuery(this).offset().top - jQuery(window).height())
-						{
-					
-							jQuery(this).animate( {
-								width: "+=" + jQuery(this).attr("data-wpsg-funding-width") + "%",
-							}, 750);	
-						
-							jQuery(this).removeAttr("data-wpsg-funding-width");
-						
-						}
-					
-					} );
-					
-				}
-					
-				jQuery(window).scroll(wpsg_mod_funding_scroll).ready(wpsg_mod_funding_scroll); 
-					
-			/* ]]> */</script>';
-			
-		} // public function wp_foot()
-		
-		public function produkt_edit_sidebar(&$produkt_data)
-		{
-		
-			if (isset($_REQUEST['wpsg_lang'])) return;
-			
-			$oProduct = wpsg_product::getInstance($produkt_data['id']);
-			
-			$this->shop->view['wpsg_mod_funding'] = array();
-			
-			if ($produkt_data['id'] > 0)
-			{
-		 
-				$this->shop->view['wpsg_mod_funding']['activ'] = $oProduct->getMeta('wpsg_mod_funding_activ');
-				$this->shop->view['wpsg_mod_funding']['limit'] = $oProduct->getMeta('wpsg_mod_funding_limit');
-				$this->shop->view['wpsg_mod_funding']['start'] = $oProduct->getMeta('wpsg_mod_funding_start');
-				$this->shop->view['wpsg_mod_funding']['end'] = $oProduct->getMeta('wpsg_mod_funding_end');
-				
-			}
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_edit_sidebar.phtml');
-				
-		} // public function produkt_edit_sidebar(&$produkt_data)
-		
-		public function produkt_save(&$produkt_id)
-		{
-			
-			if (wpsg_isSizedInt($_REQUEST['wpsg_mod_funding_save']))
-			{
-				
-				$oProduct = wpsg_product::getInstance($produkt_id);
-				
-				foreach ($_REQUEST['wpsg_mod_funding'] as $k => $v)
-				{
-					
-					$oProduct->setMeta('wpsg_mod_funding_'.$k, $v);
-					
-				}
-							
-			}
-			
-		} // public function produkt_save(&$produkt_id)
-				
-		/* Modulfunktionen */
-		
-		/**
-		 * Gibt den Status der Finanzierung zurÃŒck
-		 */
-		public function getFundingState($product_id)
-		{
-			
-			$oProduct = wpsg_product::getInstance($product_id);
-			
-			$nCurrentFunding = $this->getCurrentFundingCount($product_id);
-			$nMaxFunding = $this->getMaxFundingCount($product_id);
-			$start = strtotime($oProduct->getMeta('wpsg_mod_funding_start'));
-			$end = strtotime($oProduct->getMeta('wpsg_mod_funding_end'));
-			
-			if ($nCurrentFunding >= $nMaxFunding) return self::STATE_COMPLETED;			
-			if ($end > 0 && time() > $end) return self::STATE_CLOSED;
-			if (time() > $start) return self::STATE_RUNNING;
-			
-			return self::STATE_NOTSTARTET;
-			
-			
-		} // public function getFundingState($product_id)
-		
-		/**
-		 * Gibt true zurÃŒck, wenn das Produkt ein Finanzierungsprodukt ist 
-		 * @param Int $product_id
-		 */
-		public function isFundingProduct($product_id)
-		{
-			
-			$oProduct = wpsg_product::getInstance($product_id);
-			
-			if (wpsg_isSizedInt($oProduct->getMeta('wpsg_mod_funding_activ')) && wpsg_isSizedInt($oProduct->getMeta('wpsg_mod_funding_limit'))) return true;
-			else return false;
-			
-		} // public function isFundingProduct($product_id)
-		
-		/**
-		 * Gibt die derzeitigen KÃ€ufe eines Produktes zurÃŒck
-		 * @param unknown $product_id
-		 */
-		public function getCurrentFundingCount($product_id)
-		{
-			
-			$oProduct = wpsg_product::getInstance($product_id);
-			
-			$arFilter = array('product_id' => $product_id, 'NOTstatus' => array(wpsg_ShopController::STATUS_UNVOLLSTAENDIG, wpsg_ShopController::STATUS_STORNIERT));
-			if (strtotime($oProduct->getMeta('wpsg_mod_funding_start')) > 0) $arFilter['cdate_from'] = strtotime($oProduct->getMeta('wpsg_mod_funding_start')); 
-			
-			$arOrder = wpsg_order::find($arFilter);
-			$nSum = 0;
-			
-			foreach ($arOrder as $oOrder)
-			{
-				
-				$nSum += $oOrder->getProductCount($product_id);
-								
-			}
-			
-			return $nSum;
-			
-		} // public function getCurrentFundingCount($product_id)
-		
-		/**
-		 * Gibt die maximale Anzahl an KÃ€ufen fÃŒr ein Produkt zurÃŒck
-		 * @param unknown $product_id
-		 */
-		public function getMaxFundingCount($product_id)
-		{
-			
-			$oProduct = wpsg_product::getInstance($product_id);
-			
-			return $oProduct->getMeta('wpsg_mod_funding_limit');
-			
-		} // public function getMaxFundingCount($product_id)
-		
-	} // class wpsg_mod_funding extends wpsg_mod_basic
-
-?>
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6508)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6510)
@@ -120,4 +120,5 @@
 			$this->shop->update_option('wpsg_mod_productvariants_price', $_REQUEST['wpsg_mod_productvariants_price']);
 			$this->shop->update_option('wpsg_vp_detailview', $_REQUEST['wpsg_vp_detailview']);
+			$this->shop->update_option('wpsg_vp_replaceanr', $_REQUEST['wpsg_vp_replaceanr']);
 
 		} // public function settings_save()
@@ -1587,5 +1588,25 @@
 
 		} // public function reduceStock($produkt_id, $menge)
-
+		
+		/**
+		 *	zusammengesetzte Variantenartikelnummer ersetzt die Artikelnummer 
+		 */
+		public function getProductAnr($product_key, &$anr)
+		{
+		
+			if ($this->isVariantsProductKey($product_key) && wpsg_isSizedInt($this->shop->get_option('wpsg_vp_replaceanr')))
+			{
+		
+				$arVariantenInfo = $this->getVariantenInfoArray($product_key);
+		
+				if (wpsg_isSizedString($arVariantenInfo['akey'])) $anr = $arVariantenInfo['akey'];
+		
+				// Artikelnummer gebildet, keine weiteren Module betrachten
+				return -2;
+		
+			}
+				
+		} // public function getProductAnr($product_key, &$anr)
+		
 		/**
 		 * Gibt true zurÃŒck, wenn der ÃŒbergebene Produktkey ein Varianten Produktkey ist. Sonst false.
Index: ds/wpsg_mod_test.class.php
===================================================================
--- /mods/wpsg_mod_test.class.php	(revision 6508)
+++ 	(revision )
@@ -1,1504 +1,0 @@
-<?php
-
-	/**
-	 * Modul um die Shop Funktionen zu testen
-	 * @author daniel
-	 */
-	class wpsg_mod_test extends wpsg_mod_basic
-	{
-		
-		var $id = 14;
-		var $arKeyLabel = array();
-		var $arOriginalConfig = array();
-		var $_arTableBackup = array(); 
-		
-		/**
-		 * Costructor
-		 */
-		public function __construct()
-		{
-			
-			parent::__construct();
-			
-			// Array mit den Bezeichnungen fÃŒr die Keys, damit ich die nicht immer tippen muss
-			$this->arKeyLabel = array(
-				'sum/mwst' => 'Summe Mehrwertsteuer',
-				'sum/preis_netto' => 'Summe Nettopreis vor Versand/Zahlung',
-				'sum/preis_brutto' => 'Summe Bruttopreis vor Versand/Zahlung',
-				'sum/preis' => 'Angezeigter Preis vor Versand/Zahlung',
-				'sum/preis_gesamt_netto' => 'Summe Nettopreis nach Versand/Zahlung',
-				'sum/preis_gesamt_brutto' => 'Summe Bruttopreis nach Versand/Zahlung',
-				'sum/preis_gesamt' => 'Angezeigter Preis nach Versand/Zahlung',
-				'sum/gs_netto' => 'Gutscheinwert Netto',
-				'sum/gs_brutto' => 'Gutscheinwert Brutto',
-				'sum/gs' => 'Angezeigter Gutscheinwert',				
-				'mwst/c_1/base_value' => 'Bruttobezug fÃŒr 19%',
-				'mwst/c_1/sum' => 'Mehrwertsteuer 19%',
-				'mwst/b_1/base_value' => 'Bruttobezug fÃŒr 7%',
-				'mwst/b_1/sum' => 'Mehrwertsteuer 7%'
-			);
-						
-			$this->name = __('Test', 'wpsg');
-			$this->group = __('Sonstiges', 'wpsg');
-			$this->desc = __('', 'wpsg');
-						
-		} // public function __construct()
-		
-		public function settings_edit()
-		{
-
-			$this->shop->view['arKeyLabel'] = $this->arKeyLabel;
-			  
-			$this->saveConfig();
-						
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '1',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 7%',
-				'preis' => '107.00', 
-				'mwst_key' => 'b'									
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '2',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 19',
-				'preis' => '119.00', 
-				'mwst_key' => 'c'
-			));
-						
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '3',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 5',
-				'preis' => '3', 	
-				'mwst_key' => 'a'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '4',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 19 (Netto definiert)',
-				'preis' => '100.00',
-				'mwst_key' => 'c'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '5',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 19',
-				'preis' => '119.00', 
-				'mwst_key' => 'c',
-				'euleistungsortregel' => '1'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '6',
-				'cdate' => 'NOW()',
-				'name' => 'Variantenprodukt 19',
-				'preis' => '0.00',
-				'mwst_key' => 'c',
-				'euleistungsortregel' => '1',
-				'mod_varianten' => 'a:1:{i:0;a:5:{s:4:"name";s:6:"Lizenz";s:3:"typ";s:5:"radio";s:5:"aktiv";s:1:"1";s:4:"vari";a:3:{i:0;a:6:{s:4:"name";s:5:"Light";s:5:"preis";s:5:"25.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:43:",Untitled-1.jpg,Box_wpShopGermany_Light.jpg";}i:1;a:6:{s:4:"name";s:3:"Pro";s:5:"preis";s:5:"45.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:41:",Untitled-1.jpg,Box_wpShopGermany_Pro.jpg";}i:2;a:6:{s:4:"name";s:10:"Enterprise";s:5:"preis";s:6:"149.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:48:",Untitled-1.jpg,Box_wpShopGermany_Enterprise.jpg";}}s:4:"lang";a:0:{}}}'					
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '7',
-				'cdate' => 'NOW()',
-				'name' => 'Rabattprodukt',
-				'rabatt' => '1_01.01.2000_01.01.2020_24.98%',
-				'preis' => '20.00',
-				'mwst_key' => 'a',
-				'euleistungsortregel' => '0',
-				'mod_varianten' => '',
-				'basket_multiple' => '2'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
-				'id' => '8',
-				'cdate' => 'NOW()',
-				'name' => 'Produkt 19%',
-				'preis' => '20.08',
-				'mwst_key' => 'c'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_VA, array(
-				'id' => '1',
-				'vz' => '0', 
-				'mwst_laender' => '0',
-				'mwst_key' => '0',
-				'typ' => 'w',
-				'kosten' => '4',
-				'aktiv' => '1'					
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_LAND, array(
-				'id' => '1',
-				'name' => 'Deutschland',
-				'kuerzel' => 'DE',
-				'vz' => '1',
-				'mwst' => '0',
-				'mwst_c' => '19',
-				'mwst_b' => '7'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_LAND, array(
-				'id' => '2',
-				'name' => 'Ãsterreich',
-				'kuerzel' => 'AT',
-				'vz' => '1',
-				'mwst' => '2', // Keine MwSt. bei USt.IdNr.
-				'mwst_a' => '',
-				'mwst_b' => '10',
-				'mwst_c' => '20',
-				'mwst_d' => '12'
-			));
-			
-			$this->db->ImportQuery(WPSG_TBL_LAND, array(
-				'id' => '3',
-				'name' => 'Schweiz',
-				'kuerzel' => 'CH',
-				'vz' => '2',
-				'mwst' => '1', // Keine MwSt.
-				'mwst_c' => '',
-				'mwst_b' => ''
-			));
-			
-			$this->shop->update_option('wpsg_defaultland', '1');
-			
-			wp_cache_flush();
-			
-			$this->shop->template_redirect();
-   			
-			if ($this->shop->hasMod('wpsg_mod_gutschein'))
-			{
-			
-				$this->test2(WPSG_BRUTTO, WPSG_BRUTTO); 
-				$this->test2(WPSG_BRUTTO, WPSG_NETTO);
-				$this->test2(WPSG_NETTO, WPSG_BRUTTO);
-				$this->test2(WPSG_NETTO, WPSG_NETTO);
-				
-				$this->test3(WPSG_BRUTTO, WPSG_BRUTTO);
-				$this->test3(WPSG_BRUTTO, WPSG_NETTO);
-				$this->test3(WPSG_NETTO, WPSG_BRUTTO);
-				$this->test3(WPSG_NETTO, WPSG_NETTO);
-				
-				$this->test4(WPSG_BRUTTO, WPSG_BRUTTO);
-				$this->test4(WPSG_BRUTTO, WPSG_NETTO);
-				$this->test4(WPSG_NETTO, WPSG_BRUTTO);
-				$this->test4(WPSG_NETTO, WPSG_NETTO);
-				
-				$this->test5();
-				$this->test6();
-				
-				if ($this->shop->hasMod('wpsg_mod_discount'))
-				{
-				
-					$this->test7();
-					
-				}
-			
-				if ($this->shop->hasMod('wpsg_mod_gutschein'))
-				{
-					
-					$this->test8();
-					
-				}
-				
-			}
-
-			$this->test9();
-			
-			$this->test10();
-			$this->test11();
-			$this->test11(true);
-			$this->test12();
-			$this->test13();
-			$this->test14();
-			$this->test15();
-			$this->test16();
-			$this->test17();
-			$this->test18();		 						 	
-			$this->test19();
-					
-			$this->restoreConfig();
-			 									
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/settings_edit.phtml');
-			
-		} // public function settings_edit()
-		
-		/* Tests */
-		
-		/**
-		 * Setzt die Konfiguration zurÃŒck fÃŒr einen neuen Test
-		 */
-		private function resetConfig()
-		{
-			
-			$_SESSION['wpsg'] = array();
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_debugModus', '1');
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);			
-			$this->shop->update_option('wpsg_kleinunternehmer', false);
-			$this->shop->update_option('wpsg_mod_discount_data', array());
-			
-			$time = time();
-			
-			$this->shop->update_option('wpsg_mod_varianten', $time);
-			$this->shop->update_option('wpsg_mod_gutschein', $time);
-			$this->shop->update_option('wpsg_mod_versandarten', $time);
-			
-			$this->shop->update_option('wpsg_module', base64_encode(serialize(array(
-				'wpsg_mod_varianten' => $time,
-				'wpsg_mod_gutschein' => $time,
-				'wpsg_mod_versandarten' => $time					
-			))));
-			
-			wp_cache_flush();
-			
-		} // private function resetConfig()
-		
-		/**
-		 * Speichert die Einstellungen vor den Tests
-		 */
-		public function saveConfig()
-		{
-			
-			$this->arOriginalConfig = array(
-				'wpsg_preisangaben' => $this->shop->get_option('wpsg_preisangaben'),
-				'wpsg_preisangaben_frontend' => $this->shop->getFrontendTaxview(),
-				'wpsg_kleinunternehmer' => $this->shop->get_option('wpsg_kleinunternehmer'),
-				'wpsg_mod_discount_data' => $this->shop->get_option('wpsg_mod_discount_data')
-			);
-			
-			$this->arOriginalConfig = $this->db->fetchAssoc("SELECT * FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
-			
-			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");			
-			wp_cache_delete('alloptions', 'options');
-									
-			// Tabllen speichern
-			$arTables = $this->db->fetchAssocField("SHOW TABLES");
-			
-			foreach ($arTables as $table_name)
-			{
-				 
-				if (preg_match('/wpsg\_(.*)/', $table_name))
-				{
-					
-					$this->_arTableBackup[$table_name] = $this->db->fetchAssoc("SELECT * FROM `".wpsg_q($table_name)."`");
-															
-				}
-				
-			}
-			
-			// Backup ist erstellt, jetzt die Tabellen leeren von denen ein Backup erstellt wurde
-			foreach ($this->_arTableBackup as $table_name => $table_data)
-			{
-		 
-				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
-				
-			}
-			
-		} // public function saveConfig()
-		
-		/**
-		 * Stellt die Einstellungen nach den Tests wieder her
-		 */
-		public function restoreConfig()
-		{
- 
-			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
-			
-			foreach ($this->arOriginalConfig as $k => $v)
-			{
-				 				
-				unset($v['option_id']);
-				$this->db->ImportQuery('wp_options', $v);
-								
-			}
-			 
-			wp_cache_delete('alloptions', 'options');
-			 
-			foreach ($this->_arTableBackup as $table_name => $table_data)
-			{
-				
-				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
-				
-				foreach ($table_data as $row)
-				{
-					
-					$this->db->ImportQuery($table_name, wpsg_q($row));
-					
-				}
-								
-			}
-			
-			unset($_SESSION['wpsg']);
-						
-		} // public function restoreConfig()
-		
-		/*
-		 * http://forum.maennchen1.de/viewtopic.php?f=13&t=6834&start=30
-		 * 20,08 Brutto
-		 * - Frontend Netto
-		 * - 7 im Warenkorb 
-		 */
-		private function test19()
-		{
-			
-			$this->resetConfig();
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-			
-			$_SESSION['wpsg']['basket'] = array(
-				0 => array(
-					'menge' => 7,
-					'id' => 8
-				)
-			);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '1 Produkte (20,08Brutto * 7)',
-				'tests' => array(
-					'sum/mwst' => array(false, 22.44),
-					'sum/preis_netto' => array(false, 118.12),
-					'sum/preis_brutto' => array(false, 140.56),
-					/*'sum/preis' => array(false, 140.56),
-					'sum/preis_gesamt_netto' => array(false, 200),
-					'sum/preis_gesamt_brutto' => array(false, 226),
-					'sum/preis_gesamt' => array(false, 226),
-					'mwst/b_1/base_value' => array(false, 107),
-					'mwst/b_1/sum' => array(false, 7),
-					'mwst/c_1/base_value' => array(false, 119),
-					'mwst/c_1/sum' => array(false, 19),*/
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		} // private function test19()
-		
-		/**
-		 * Testfall 1
-		 *
-		 * 1 Produkt 19%/119â¬Brutto 
-		 * 1 Produkt 7%/107â¬Brutto
-		 * - Keine Versandarten
-		 * - Kein Gutschein
-		 * - Kein Rabatt
-		 */
-		private function test1()
-		{
-			
-			$this->resetConfig();
-			 
-			$_SESSION['wpsg']['basket'] = array(
-				0 => array(
-					'menge' => 1,
-					'id' => 1
-				),
-				1 => array(
-					'menge' => 1,
-					'id' => 2
-				)
-			);
-						
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			 
-			$this->shop->view['test'][] = array(
-				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto',
-				'tests' => array(
-					'sum/mwst' => array(false, 26),
-					'sum/preis_netto' => array(false, 200),
-					'sum/preis_brutto' => array(false, 226),
-					'sum/preis' => array(false, 226),					
-					'sum/preis_gesamt_netto' => array(false, 200),
-					'sum/preis_gesamt_brutto' => array(false, 226),
-					'sum/preis_gesamt' => array(false, 226),
-					'mwst/b_1/base_value' => array(false, 107),
-					'mwst/b_1/sum' => array(false, 7),
-					'mwst/c_1/base_value' => array(false, 119),
-					'mwst/c_1/sum' => array(false, 19),
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-						 
-		} // private function test1()
-		
-		/**
-		 * Testfall 2
-		 * 
-		 * 1 Produkt 19%/119â¬Brutto
-		 * - Keine Versandarten
-		 * - 1 Gutschein Wert 10Euro
-		 * - Kein Rabatt
-		 */
-		private function test2($preisangabe_backend, $preisangabe_frontend)
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'w',
-					'code' => 'Abs10',
-					'id' => 1
-				)
-			);
-
-			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
-			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 17.403361344538),
-						'sum/preis_netto' => array(false, 91.596638655462),
-						'sum/preis_brutto' => array(false, 109),
-						'sum/preis' => array(false, 109),		
-						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
-						'sum/preis_gesamt_brutto' => array(false, 109),
-						'sum/preis_gesamt' => array(false, 109),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 17.403361344538),						
-						'sum/preis_netto' => array(false, 91.596638655462),
-						'sum/preis_brutto' => array(false, 109),
-						'sum/preis' => array(false, 91.596638655462),						
-						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
-						'sum/preis_gesamt_brutto' => array(false, 109),
-						'sum/preis_gesamt' => array(false, 91.596638655462),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 20.71),						
-						'sum/preis_netto' => array(false, 109),
-						'sum/preis_brutto' => array(false, 129.71),
-						'sum/preis' => array(false, 129.71),						
-						'sum/preis_gesamt_netto' => array(false, 109),
-						'sum/preis_gesamt_brutto' => array(false, 129.71),
-						'sum/preis_gesamt' => array(false, 129.71),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 20.71),						
-						'sum/preis_netto' => array(false, 109),
-						'sum/preis_brutto' => array(false, 129.71),
-						'sum/preis' => array(false, 109),						
-						'sum/preis_gesamt_netto' => array(false, 109),
-						'sum/preis_gesamt_brutto' => array(false, 129.71),
-						'sum/preis_gesamt' => array(false, 109),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			
-		} // private function test2()
-		 		
-		/**
-		 * Wie test2 nur mit zwei Produkten
-		 */
-		private function test3($preisangabe_backend, $preisangabe_frontend)
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					),
-					1 => array(
-						'menge' => 1,
-						'id' => 1
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'w',
-					'code' => 'Abs10',
-					'id' => 1
-				)
-			);
-
-			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
-			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Brutto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 24.849557522124),
-						'sum/preis_netto' => array(false, 191.15044247788),
-						'sum/preis_brutto' => array(false, 216),
-						'sum/preis' => array(false, 216),		
-						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
-						'sum/preis_gesamt_brutto' => array(false, 216),
-						'sum/preis_gesamt' => array(false, 216),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Brutto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 24.849557522124),
-						'sum/preis_netto' => array(false, 191.15044247788),
-						'sum/preis_brutto' => array(false, 216),
-						'sum/preis' => array(false, 191.15044247788),		
-						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
-						'sum/preis_gesamt_brutto' => array(false, 216),
-						'sum/preis_gesamt' => array(false, 191.15044247788),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Netto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 28.736462319406),
-						'sum/preis_netto' => array(false, 216),
-						'sum/preis_brutto' => array(false, 244.73646231941),
-						'sum/preis' => array(false, 244.73646231941),		
-						'sum/preis_gesamt_netto' => array(false, 216),
-						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
-						'sum/preis_gesamt' => array(false, 244.73646231941),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Netto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 28.736462319406),						
-						'sum/preis_netto' => array(false, 216),
-						'sum/preis_brutto' => array(false, 244.73646231941),
-						'sum/preis' => array(false, 216),						
-						'sum/preis_gesamt_netto' => array(false, 216),
-						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
-						'sum/preis_gesamt' => array(false, 216),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			
-		} // private function test3()
-
-		/**
-		 * Testfall 4
-		 * 
-		 * 1 Produkt 19%/119â¬Brutto
-		 * - Keine Versandarten
-		 * - 1 Gutschein Wert 10%
-		 * - Kein Rabatt
-		 */
-		private function test4($preisangabe_backend, $preisangabe_frontend)
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'p',
-					'code' => 'Proz10',
-					'id' => 2
-				)
-			);
-
-			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
-			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10%) / Brutto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 17.1),
-						'sum/preis_netto' => array(false, 90),
-						'sum/preis_brutto' => array(false, 107.1),
-						'sum/preis' => array(false, 107.1),		
-						'sum/preis_gesamt_netto' => array(false, 90),
-						'sum/preis_gesamt_brutto' => array(false, 107.1),
-						'sum/preis_gesamt' => array(false, 107.1),						
-						'sum/gs_netto' => array(false, 10),
-						'sum/gs_brutto' => array(false, 11.9),
-						'sum/gs' => array(false, 11.9)
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 17.1),						
-						'sum/preis_netto' => array(false, 90),
-						'sum/preis_brutto' => array(false, 107.1),
-						'sum/preis' => array(false, 90),						
-						'sum/preis_gesamt_netto' => array(false, 90),
-						'sum/preis_gesamt_brutto' => array(false, 107.1),
-						'sum/preis_gesamt' => array(false, 90),
-						'sum/gs_netto' => array(false, 10),
-						'sum/gs_brutto' => array(false, 11.9),
-						'sum/gs' => array(false, 10)
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Brutto',
-					'tests' => array(
-						'sum/mwst' => array(false, 20.349),						
-						'sum/preis_netto' => array(false, 107.1),
-						'sum/preis_brutto' => array(false, 127.449),
-						'sum/preis' => array(false, 127.449),						
-						'sum/preis_gesamt_netto' => array(false, 107.1),
-						'sum/preis_gesamt_brutto' => array(false, 127.449),
-						'sum/preis_gesamt' => array(false, 127.449),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
-			{
-				
-				$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Netto',
-					'tests' => array(
-						'sum/mwst' => array(false, 20.349),						
-						'sum/preis_netto' => array(false, 107.1),
-						'sum/preis_brutto' => array(false, 127.449),
-						'sum/preis' => array(false, 107.1),						
-						'sum/preis_gesamt_netto' => array(false, 107.1),
-						'sum/preis_gesamt_brutto' => array(false, 127.449),
-						'sum/preis_gesamt' => array(false, 107.1),
-					),
-					'array' => $basket->toArray(),
-					'config' => $this->showConfiguration()
-				);
-				
-			}
-			
-		} // private function test4()
-
-		/**
-		 * Testfall 5
-		 * 
-		 * 1 Produkt 19%/119â¬Brutto
-		 * - Keine Versandarten
-		 * - 1 Gutschein Wert 10Euro
-		 * - Kein Rabatt
-		 */
-		private function test5()
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'w',
-					'code' => 'Wert10',
-					'id' => 1
-				)
-			);
-
-			$this->shop->update_option('wpsg_kleinunternehmer', '1');
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Kleinunternehmerregelung',
-				'tests' => array(
-					'sum/mwst' => array(false, 0),
-					'sum/preis_netto' => array(false, 90),
-					'sum/preis_brutto' => array(false, 90),
-					'sum/preis' => array(false, 90),		
-					'sum/preis_gesamt_netto' => array(false, 90),
-					'sum/preis_gesamt_brutto' => array(false, 90),
-					'sum/preis_gesamt' => array(false, 90),						
-					'sum/gs_netto' => array(false, 10),
-					'sum/gs_brutto' => array(false, 10),
-					'sum/gs' => array(false, 10)
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		} // private function test5()
-		
-		/**
-		 * Testfall 6
-		 * 
-		 * 1 Produkt 19%/119â¬Brutto
-		 * - Keine Versandarten
-		 * - 1 Gutschein Wert 10%
-		 * - Kein Rabatt
-		 */
-		private function test6()
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'p',
-					'code' => 'Proz10',
-					'id' => 2
-				)
-			);
-
-			$this->shop->update_option('wpsg_kleinunternehmer', '1');
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '1 Produkt (119â¬/19%) mit Gutschein (10%) / Kleinunternehmerregelung',
-				'tests' => array(
-					'sum/mwst' => array(false, 0),
-					'sum/preis_netto' => array(false, 90),
-					'sum/preis_brutto' => array(false, 90),
-					'sum/preis' => array(false, 90),		
-					'sum/preis_gesamt_netto' => array(false, 90),
-					'sum/preis_gesamt_brutto' => array(false, 90),
-					'sum/preis_gesamt' => array(false, 90),						
-					'sum/gs_netto' => array(false, 10),
-					'sum/gs_brutto' => array(false, 10),
-					'sum/gs' => array(false, 10)
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		} // private function test6()
-		
-		/**
-		 * 
-		 * 5 Produkt 19%/119â¬Brutto
-		 * - Keine Versandarten
-		 * - 1 Gutschein Wert 10%
-		 * - 50â¬ Rabatt
-		 */
-		private function test7() 
-		{
-			
-			$this->resetConfig();
-			
-			// Rabatt konfigurieren
-			$this->shop->update_option('wpsg_mod_discount_data', unserialize('s:91:"a:2:{i:0;a:1:{s:6:"rabatt";s:1:"0";}i:1;a:2:{s:5:"value";s:3:"250";s:6:"rabatt";s:2:"50";}}";'));
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 5,
-						'id' => 2
-					)
-				),
-				'gs' => array(
-					'value' => 10,
-					'calc' => 'p',
-					'code' => 'Proz10',
-					'id' => 2
-				)
-			);
- 
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO); 
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '5 Produkte (je 119â¬/19%) mit Gutschein (10%) und Rabatt 50â¬ / Brutto - Netto',
-				'tests' => array(
-					'sum/mwst' => array(false, 77.516806722689),
-					'sum/preis_netto' => array(false, 407.98),
-					'sum/preis_brutto' => array(false, 485.5),
-					'sum/preis' => array(false, 407.98),		
-					'sum/preis_gesamt_netto' => array(false, 407.98),
-					'sum/preis_gesamt_brutto' => array(false, 485.5),
-					'sum/preis_gesamt' => array(false, 407.98),						
-					'sum/gs_netto' => array(false, 50),
-					'sum/gs_brutto' => array(false, 59.5),
-					'sum/gs' => array(false, 50)
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		} // private function test7()
-		
-		private function test8()
-		{
-			
-			$this->resetConfig();
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO);
-			$this->shop->update_option('wpsg_kleinunternehmer', false);
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 3
-					)
-				),
-				'gs' => array(
-					'value' => 5,
-					'calc' => 'w',
-					'code' => 'Wert10',
-					'id' => 1
-				),
-				'checkout' => array(
-					'land' => '1',
-					'shipping' => '6_1'					
-				)
-			);
-			
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '3â¬ Produkt mit 5â¬ Gutschein und 4â¬ Versandkosten',
-				'tests' => array(
-					'sum/mwst' => array(false, 0),
-					'sum/preis_netto' => array(false, 0),
-					'sum/preis_brutto' => array(false, 0),
-					'sum/preis' => array(false, 0),
-					'sum/preis_gesamt_netto' => array(false, 2),
-					'sum/preis_gesamt_brutto' => array(false, 2),
-					'sum/preis_gesamt' => array(false, 2),
-					'sum/gs_netto' => array(false, 5),
-					'sum/gs_brutto' => array(false, 5),
-					'sum/gs' => array(false, 5)
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		} // private function test8()
-		
-		private function test9()
-		{
-			
-			$arShippingGesamt = array(1,2,3,4,5);
-			 
-			$arTest1_Produkt1 = array(1);
-			$arTest1_Produkt2 = array(5,4,3);
-			$arTest1_Produkt3 = array(2,3,4);
-			$arTest1_Produkt4 = array(5);
-						
-			$arMergeTest1_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest1_Produkt1);
-			$arMergeTest1_2 = $this->shop->mergeShipping($arMergeTest1_1, $arTest1_Produkt2);			
-			$arMergeTest1_3 = $this->shop->mergeShipping($arMergeTest1_2, $arTest1_Produkt3); 			
-			$arMergeTest1_4 = $this->shop->mergeShipping($arMergeTest1_3, $arTest1_Produkt4); 
-			 
-			$arTest2_Produkt1 = array(1,2);
-			$arTest2_Produkt2 = array(3,4);
-				
-			$arMergeTest2_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest2_Produkt1);
-			$arMergeTest2_2 = $this->shop->mergeShipping($arMergeTest2_1, $arTest2_Produkt2);
-			 
-			$arTest3_Produkt1 = array(1);
-			$arTest3_Produkt2 = array(2);
-			$arTest3_Produkt3 = array(1,2);
-			
-			$arMergeTest3_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest3_Produkt1);
-			$arMergeTest3_2 = $this->shop->mergeShipping($arMergeTest3_1, $arTest3_Produkt2);
-			$arMergeTest3_3 = $this->shop->mergeShipping($arMergeTest3_2, $arTest3_Produkt3);
-		 
-			$result = array(
-				'test1_merge1' => sizeof($arMergeTest1_1).':'.$arMergeTest1_1[0],
-				'test1_merge2' => sizeof($arMergeTest1_2).':'.implode(',', $arMergeTest1_2[0]).' '.implode(',', $arMergeTest1_2[1]).' '.implode(',', $arMergeTest1_2[2]),
-				'test1_merge3' => sizeof($arMergeTest1_3).':'.implode(',', $arMergeTest1_3[0]).' '.implode(',', $arMergeTest1_3[1]).' '.implode(',', $arMergeTest1_3[2])
-					.' '.implode(',', $arMergeTest1_3[3]).' '.implode(',', $arMergeTest1_3[4]).' '.implode(',', $arMergeTest1_3[5])
-					.' '.implode(',', $arMergeTest1_3[6]).' '.implode(',', $arMergeTest1_3[7]),
-				'test1_merge4' => sizeof($arMergeTest1_4).':'.implode(',', $arMergeTest1_4[0]).' '.implode(',', $arMergeTest1_4[1]).' '.implode(',', $arMergeTest1_4[2]),
-				'test2_merge1' => sizeof($arMergeTest2_1).':'.implode(',', $arMergeTest2_1),
-				'test2_merge2' => sizeof($arMergeTest2_2).':'.implode(',', $arMergeTest2_2[0]).' '.implode(',', $arMergeTest2_2[1]).' '.implode(',', $arMergeTest2_2[2]).' '.implode(',', $arMergeTest2_2[3]),
-				'test3_merge1' => sizeof($arMergeTest3_1).':'.implode(',', $arMergeTest3_1),
-				'test3_merge2' => sizeof($arMergeTest3_2).':'.implode(',', $arMergeTest3_2[0]),
-				'test3_merge3' => sizeof($arMergeTest3_3).':'.implode(',', $arMergeTest3_3[0])
-			);
-			
-			$this->shop->view['test'][] = array(
-				'label' => 'Test der Funktion "Merge Versandarten"',
-				'tests' => array(
-					'test1_merge1' => array('Test1 nach Merge1 mit Produkt1', '1:1'),
-					'test1_merge2' => array('Test1 nach Merge2 mit Produkt2', '3:1,5 1,4 1,3'),						
-					'test1_merge3' => array('Test1 nach Merge3 mit Produkt3', '8:1,5,2 1,5,3 1,5,4 1,4,2 1,4,3 1,4 1,3,2 1,3'),
-					'test1_merge4' => array('Test1 nach Merge4 mit Produkt4', '3:1,5,2 1,5,3 1,5,4'),
-					'test2_merge1' => array('Test2 nach Merge1 mit Produkt1', '2:1,2'),
-					'test2_merge2' => array('Test2 nach Merge2 mit Produkt2', '4:1,3 1,4 2,3 2,4'),
-					'test3_merge1' => array('Test3 nach Merge1 mit Produkt1', '1:1'), 
-					'test3_merge2' => array('Test3 nach Merge2 mit Produkt2', '1:1,2'),
-					'test3_merge3' => array('Test3 nach Merge3 mit Produkt3', '1:1,2'),
-				),
-				'array' => $result
-			);
-			
-			
-		}
-		
-		function test10()
-		{
-
-			$this->resetConfig();
-			
-			$_SESSION['wpsg']['basket'] = array(
-				0 => array(
-					'menge' => 1,
-					'id' => 1
-				),
-				1 => array(
-					'menge' => 1,
-					'id' => 2
-				)
-			);
-			$_SESSION['wpsg']['checkout']['land'] = 3;
-				 
-			$basket = new wpsg_basket();
-			$basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Schweiz mit "Keine MwSt."',
-				'tests' => array(
-					'sum/mwst' => array(false, 0),
-					'sum/preis_netto' => array(false, 200),
-					'sum/preis_brutto' => array(false, 200),
-					'sum/preis' => array(false, 200),
-					'sum/preis_gesamt_netto' => array(false, 200),
-					'sum/preis_gesamt_brutto' => array(false, 200),
-					'sum/preis_gesamt' => array(false, 200)					
-				),
-				'array' => $basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-		
-		}
-		
-		function test11($ust = false)
-		{
-		
-			$this->resetConfig();
-				
-			$_SESSION['wpsg']['basket'] = array(
-				0 => array(
-					'menge' => 1,
-					'id' => 1
-				),
-				1 => array(
-					'menge' => 1,
-					'id' => 2
-				)
-			);
-			$_SESSION['wpsg']['checkout']['land'] = 2;
-			
-			if ($ust === true) $_SESSION['wpsg']['checkout']['ustidnr'] = 'AT1234';
-				
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-				
-			$this->shop->view['test'][] = array(
-				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Ãsterreich mit "Keine MwSt. bei UStIdNr." '.(($ust === true)?'(UStIdNr. gesetzt)':''),
-				'tests' => array(
-					'sum/mwst' => array(false, (($ust == true)?0:26)),
-					'sum/preis_netto' => array(false, (($ust == true)?200:200)),
-					'sum/preis_brutto' => array(false, (($ust == true)?200:226)),
-					'sum/preis' => array(false, (($ust == true)?200:226)),
-					'sum/preis_gesamt_netto' => array(false, (($ust == true)?200:200)),
-					'sum/preis_gesamt_brutto' => array(false, (($ust == true)?200:226)),
-					'sum/preis_gesamt' => array(false, (($ust == true)?200:226))
-				),
-				'array' => $this->shop->basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-		
-		}
-		
-		public function test12()
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 4
-					), 
-				),
-				'checkout' => array(
-					'shipping' => '6_1',
-					'land' => '1'	
-				)
-			);
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-			
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (100 + 19%) MwSt / Netto - Brutto / 4,- Netto Versand',
-					'tests' => array(
-							'sum/mwst' => array(false, 19.76),
-							'sum/preis_netto' => array(false, 100),
-							'sum/preis_brutto' => array(false, 119),
-							'sum/preis' => array(false, 119),
-							'sum/preis_gesamt_netto' => array(false, 104),
-							'sum/preis_gesamt_brutto' => array(false, 123.76),
-							'sum/preis_gesamt' => array(false, 123.76)
-					),
-					'array' => $this->shop->basket->toArray(),
-					'config' => $this->showConfiguration()
-			);
-			
-		}
-		
-		public function test13()
-		{
-				
-			$this->resetConfig();
-				
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 2
-					),
-				),
-				'checkout' => array(
-					'shipping' => '6_1',
-					'land' => '1'
-				)
-			);
-				
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-				
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-				
-			$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119) / Brutto - Brutto / 4,- Brutto Versand',
-					'tests' => array(
-							'sum/mwst' => array(false, 19.638655462185),
-							'sum/preis_netto' => array(false, 100),
-							'sum/preis_brutto' => array(false, 119),
-							'sum/preis' => array(false, 119),
-							'sum/preis_gesamt_netto' => array(false, 103.36134453782),
-							'sum/preis_gesamt_brutto' => array(false, 123),
-							'sum/preis_gesamt' => array(false, 123)
-					),
-					'array' => $this->shop->basket->toArray(),
-					'config' => $this->showConfiguration()
-			);
-				
-		}
-		
-		public function test14()
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 5
-					),
-				),
-				'checkout' => array(
-					'shipping' => '6_1',
-					'land' => '2'
-				)
-			);
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-			
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / 4,- Brutto Versand -> Versand nach AT (20% MwSt. statt 19%)',
-				'tests' => array(
-					'sum/mwst' => array(false, 20.672268907563),
-					'sum/preis_netto' => array(false, 100),
-					'sum/preis_brutto' => array(false, 120),
-					'sum/preis' => array(false, 120),
-					'sum/preis_gesamt_netto' => array(false, 103.36134453782),
-					'sum/preis_gesamt_brutto' => array(false, 124.03361344538),
-					'sum/preis_gesamt' => array(false, 124.03361344538)
-				),
-				'array' => $this->shop->basket->toArray(),
-				'config' => $this->showConfiguration()
-			);
-			
-		}
-		
-		public function test15() 
-		{
-			
-			$this->resetConfig();
-			
-			$_SESSION['wpsg'] = array(
-				'basket' => array(
-					0 => array(
-						'menge' => 1,
-						'id' => 'vp_6/0_2'
-					),
-				),
-				'checkout' => array( 
-					'land' => '2'
-				)
-			);
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-			
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-				'label' => '1 Variantenprodukt (149 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt. statt 19%)',
-				'tests' => array(
-					'sum/mwst' => array(false, 25.04),
-					'sum/preis_netto' => array(false, 125.21),
-					'sum/preis_brutto' => array(false, 150.25),
-					'sum/preis' => array(false, 150.25),
-					'sum/preis_gesamt_netto' => array(false, 125.21),
-					'sum/preis_gesamt_brutto' => array(false, 150.25),
-					'sum/preis_gesamt' => array(false, 150.25)
-				),
-				'array' => $this->shop->basket->toArray(),
-				'config' => $this->showConfiguration()
-			); 
-			
-		}
-		
-		public function test16() 
-		{
-			
-			$this->resetConfig();
-				
-			$_SESSION['wpsg'] = array(
-					'basket' => array(
-							0 => array(
-									'menge' => 1,
-									'id' => '2'
-							),
-					),
-					'checkout' => array(
-							'land' => '2'
-					)
-			);
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-				
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-			
-			$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119) / Brutto - Brutto / -> Versand nach AT (19% MwSt.)',
-					'tests' => array(
-							'sum/mwst' => array(false, 19),
-							'sum/preis_netto' => array(false, 100),
-							'sum/preis_brutto' => array(false, 119),
-							'sum/preis' => array(false, 119),
-							'sum/preis_gesamt_netto' => array(false, 100),
-							'sum/preis_gesamt_brutto' => array(false, 119),
-							'sum/preis_gesamt' => array(false, 119)
-					),
-					'array' => $this->shop->basket->toArray(),
-					'config' => $this->showConfiguration()
-			);
-			
-		}
-		
-		public function test17()
-		{
-				
-			$this->resetConfig();
-		
-			$_SESSION['wpsg'] = array(
-					'basket' => array(
-							0 => array(
-									'menge' => 1,
-									'id' => '5'
-							),
-					),
-					'checkout' => array(
-							'land' => '2'
-					)
-			);
-				
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-		
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-				
-			$this->shop->view['test'][] = array(
-					'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt., da Leistungsort)',
-					'tests' => array(
-							'sum/mwst' => array(false, 20),
-							'sum/preis_netto' => array(false, 100),
-							'sum/preis_brutto' => array(false, 120),
-							'sum/preis' => array(false, 120),
-							'sum/preis_gesamt_netto' => array(false, 100),
-							'sum/preis_gesamt_brutto' => array(false, 120),
-							'sum/preis_gesamt' => array(false, 120)
-					),
-					'array' => $this->shop->basket->toArray(),
-					'config' => $this->showConfiguration()
-			);
-				
-		}
-
-		public function test18()
-		{
-		
-			$this->resetConfig();
-		
-			$_SESSION['wpsg'] = array(
-					'basket' => array(
-							0 => array(
-									'menge' => 1,
-									'id' => '7'
-							),
-							1 => array(
-									'menge' => 1,
-									'id' => '7'
-							),
-							2 => array(
-									'menge' => 1,
-									'id' => '7'
-							),
-					),
-					'checkout' => array(
-							'land' => '2'
-					)
-			);
-		
-			$this->shop->update_option('wpsg_mod_discount', time());
-			$this->shop->update_option('wpsg_mod_discount_productdiscount', '1');
-			
-			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
-			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
-		
-			$this->shop->basket = new wpsg_basket();
-			$this->shop->basket->initFromSession();
-		
-			$this->shop->view['test'][] = array(
-					'label' => '3 x das gleiche Produkt mit Rabatt fÃŒr Test Rundungen (Rabatt muÃ aktiv sein)',
-					'tests' => array(
-							'sum/mwst' => array(false, 0),
-							'sum/preis_netto' => array(false, 45),
-							'sum/preis_brutto' => array(false, 45),
-							'sum/preis' => array(false, 45),
-							'sum/preis_gesamt_netto' => array(false, 45),
-							'sum/preis_gesamt_brutto' => array(false, 45),
-							'sum/preis_gesamt' => array(false, 45)
-					),
-					'array' => $this->shop->basket->toArray(),
-					'config' => $this->showConfiguration()
-			);
-		
-		}
-		
-		/**
-		 * Zeigt wichtige Einstellungen an, die fÃŒr den Test sinnvoll sind
-		 */
-		public function showConfiguration()
-		{
-			
-			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/showConfiguration.phtml', false);
-			
-		} // public function showConfiguration()
-		
-		/**
-		 * Gibt true zurck wenn der gesamte Test erfolgreich war
-		 * @param unknown_type $test
-		 */
-		public function checkTest($test)
-		{
-						
-			foreach ($test['tests'] as $key => $t)
-			{
-				
-				$bTest = $this->checkValue($key, $t[1], $test['array']);
-				if ($bTest === false) return false;
-				
-			}
-			
-			return true;
-			
-		} // public function checkTest($test)
-		
-		/**
-		 * PrÃŒft einen einzelnen Wert in einem Array
-		 * key kann dabei die Syntax: sum/mwst haben und greift dann auf $array['sum']['mwst'] zu um den Wert zu ermitteln
-		 */
-		public function checkValue($key, $value, $array)
-		{
-			
-			return $this->checkEqual($this->getValue($key, $array), $value);
-			
-		} // public function checkValue($key, $array)
-		
-		/**
-		 * Gibt einen Wert aus dem Array zurÃŒck anhand des key
-		 */
-		public function getValue($key, $array)
-		{
-			
-			$arKeys = wpsg_trim(explode('/', $key));
-			
-			foreach ($arKeys as $k)
-			{
-				
-				$array = $array[$k];
-				
-			}
-			
-			return $array;
-			
-		} // public function getValue($key, $array)
-		
-		/**
-		 * PrÃŒft zwei Werte ob sie gleich sind
-		 */
-		public function checkEqual($value1, $value2)
-		{
-			
-			if (strval($value1) == strval($value2)) return true;
-			
-			return false;
-			
-		} // public function checkEqual($value1, $value2)
-		 
-	} // class wpsg_mod_test extends wpsg_mod_basic
-
-?>
Index: /system/intern/mods/wpsg_mod_funding.class.php
===================================================================
--- /system/intern/mods/wpsg_mod_funding.class.php	(revision 6510)
+++ /system/intern/mods/wpsg_mod_funding.class.php	(revision 6510)
@@ -0,0 +1,288 @@
+<?php
+
+	/**
+	 * Erlaubt die Definition und Anzeige von Lieferzeiten
+	 * @author Daschmi (daniel@maennchen1.de)
+	 */
+	class wpsg_mod_funding extends wpsg_mod_basic
+	{
+	
+		var $lizenz = 1;
+		var $id = 2050;  
+		var $version = "9.9.9"; 
+		
+		var $free = true;
+		
+		var $arStateLabel;
+		
+		const STATE_COMPLETED = 1;
+		const STATE_RUNNING = 2;
+		const STATE_CLOSED = 3;
+		const STATE_NOTSTARTET = 4;
+	
+		/**
+		 * Costructor
+		 */
+		public function __construct()
+		{
+	
+			parent::__construct();
+	
+			$this->name = __('Crowdfunding', 'wpsg');
+			$this->group = __('Produkte', 'wpsg');
+			$this->desc = __('Erlaubt den Verkauf von Produkten die durch mehrere KÃ€ufer finanziert werden.', 'wpsg');
+	
+			$this->arStateLabel = array(
+				self::STATE_COMPLETED => __('Erfolgreich Abgeschlossen', 'wpsg'),
+				self::STATE_RUNNING => __('LÃ€uft', 'wpsg'),
+				self::STATE_CLOSED => __('Zeitraum abgelaufen', 'wpsg'),
+				self::STATE_NOTSTARTET => __('Noch nicht gestartet', 'wpsg')
+			);
+			
+		} // public function __construct()
+	
+		public function install()
+		{
+			
+			
+			
+		} // public function install()
+		
+		public function settings_edit()
+		{
+		
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/settings_edit.phtml');
+			
+		} // public function settings_edit()
+		
+		public function settings_save()
+		{
+			
+			
+			
+		} // public function settings_save()
+		
+		public function product_bottom(&$produkt_id, $template_index) 
+		{ 
+		
+			$this->shop->view['wpsg_mod_funding']['state'] = $this->getFundingState($produkt_id);
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_bottom.phtml');
+			
+		} // public function product_bottom(&$produkt_id, $template_index)
+		
+		public function basket_produkttosession($product_key, &$menge, &$ses_data) 
+		{ 
+			
+			$product_id = $this->shop->getProduktID($product_key);
+			
+			if ($this->isFundingProduct($product_id))
+			{
+				
+				// Anzahl schon im Warenkorb
+				$nBasket = $this->shop->basket->getBasketAmount($product_key);
+				
+				if ($nBasket + $menge + $this->getCurrentFundingCount($product_id) > $this->getMaxFundingCount($product_id))
+				{
+					
+					$nMengeAllowed = $this->getMaxFundingCount($product_id) - $this->getCurrentFundingCount($product_id)- $nBasket;
+					
+					if ($nMengeAllowed > 0) 
+					{
+						
+						$menge = $nMengeAllowed;
+						$this->shop->addFrontendError(wpsg_translate(
+							__('Produkt "#1#" kann nur noch maximal #2# mal erworben werden.', 'wpsg'),
+							$this->shop->getProductName($product_id),
+							$nMengeAllowed
+						));
+																		
+					}
+					else
+					{
+				
+						$this->shop->addFrontendError(wpsg_translate(
+							__('Produkt "#1#" kann nicht mehr erworben werden.', 'wpsg'),
+							$this->shop->getProductName($product_id)
+						));
+						
+						return -2;
+						
+					}
+					 
+				}
+				
+			}
+			
+		} // public function basket_produkttosession($produkt_key, &$menge, &$ses_data)
+		
+		public function product_top_afterheadline($product_id, $template_index) 
+		{ 
+		
+			if (!$this->isFundingProduct($product_id)) return;
+			
+			$this->shop->view['wpsg_mod_funding'] = array(
+				'currentFundingCount' => $this->getCurrentFundingCount($product_id),
+				'maxFundingCount' => $this->getMaxFundingCount($product_id),
+				'stateLabel' => $this->arStateLabel[$this->getFundingState($product_id)]
+			);
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_top_afterheadline.phtml');
+			
+		} // public function product_top_afterheadline($product_id, $template_index)
+		
+		public function wp_foot() 
+		{ 
+			
+			echo '<script type="text/javascript">/* <![CDATA[ */
+			
+				function wpsg_mod_funding_scroll()
+				{
+					
+					var scroll_y = jQuery(window).scrollTop();
+					
+					jQuery(".wpsg_mod_funding_state_value[data-wpsg-funding-width]").each(function() {
+					
+						if (scroll_y > jQuery(this).offset().top - jQuery(window).height())
+						{
+					
+							jQuery(this).animate( {
+								width: "+=" + jQuery(this).attr("data-wpsg-funding-width") + "%",
+							}, 750);	
+						
+							jQuery(this).removeAttr("data-wpsg-funding-width");
+						
+						}
+					
+					} );
+					
+				}
+					
+				jQuery(window).scroll(wpsg_mod_funding_scroll).ready(wpsg_mod_funding_scroll); 
+					
+			/* ]]> */</script>';
+			
+		} // public function wp_foot()
+		
+		public function produkt_edit_sidebar(&$produkt_data)
+		{
+		
+			if (isset($_REQUEST['wpsg_lang'])) return;
+			
+			$oProduct = wpsg_product::getInstance($produkt_data['id']);
+			
+			$this->shop->view['wpsg_mod_funding'] = array();
+			
+			if ($produkt_data['id'] > 0)
+			{
+		 
+				$this->shop->view['wpsg_mod_funding']['activ'] = $oProduct->getMeta('wpsg_mod_funding_activ');
+				$this->shop->view['wpsg_mod_funding']['limit'] = $oProduct->getMeta('wpsg_mod_funding_limit');
+				$this->shop->view['wpsg_mod_funding']['start'] = $oProduct->getMeta('wpsg_mod_funding_start');
+				$this->shop->view['wpsg_mod_funding']['end'] = $oProduct->getMeta('wpsg_mod_funding_end');
+				
+			}
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_funding/product_edit_sidebar.phtml');
+				
+		} // public function produkt_edit_sidebar(&$produkt_data)
+		
+		public function produkt_save(&$produkt_id)
+		{
+			
+			if (wpsg_isSizedInt($_REQUEST['wpsg_mod_funding_save']))
+			{
+				
+				$oProduct = wpsg_product::getInstance($produkt_id);
+				
+				foreach ($_REQUEST['wpsg_mod_funding'] as $k => $v)
+				{
+					
+					$oProduct->setMeta('wpsg_mod_funding_'.$k, $v);
+					
+				}
+							
+			}
+			
+		} // public function produkt_save(&$produkt_id)
+				
+		/* Modulfunktionen */
+		
+		/**
+		 * Gibt den Status der Finanzierung zurÃŒck
+		 */
+		public function getFundingState($product_id)
+		{
+			
+			$oProduct = wpsg_product::getInstance($product_id);
+			
+			$nCurrentFunding = $this->getCurrentFundingCount($product_id);
+			$nMaxFunding = $this->getMaxFundingCount($product_id);
+			$start = strtotime($oProduct->getMeta('wpsg_mod_funding_start'));
+			$end = strtotime($oProduct->getMeta('wpsg_mod_funding_end'));
+			
+			if ($nCurrentFunding >= $nMaxFunding) return self::STATE_COMPLETED;			
+			if ($end > 0 && time() > $end) return self::STATE_CLOSED;
+			if (time() > $start) return self::STATE_RUNNING;
+			
+			return self::STATE_NOTSTARTET;
+			
+			
+		} // public function getFundingState($product_id)
+		
+		/**
+		 * Gibt true zurÃŒck, wenn das Produkt ein Finanzierungsprodukt ist 
+		 * @param Int $product_id
+		 */
+		public function isFundingProduct($product_id)
+		{
+			
+			$oProduct = wpsg_product::getInstance($product_id);
+			
+			if (wpsg_isSizedInt($oProduct->getMeta('wpsg_mod_funding_activ')) && wpsg_isSizedInt($oProduct->getMeta('wpsg_mod_funding_limit'))) return true;
+			else return false;
+			
+		} // public function isFundingProduct($product_id)
+		
+		/**
+		 * Gibt die derzeitigen KÃ€ufe eines Produktes zurÃŒck
+		 * @param unknown $product_id
+		 */
+		public function getCurrentFundingCount($product_id)
+		{
+			
+			$oProduct = wpsg_product::getInstance($product_id);
+			
+			$arFilter = array('product_id' => $product_id, 'NOTstatus' => array(wpsg_ShopController::STATUS_UNVOLLSTAENDIG, wpsg_ShopController::STATUS_STORNIERT));
+			if (strtotime($oProduct->getMeta('wpsg_mod_funding_start')) > 0) $arFilter['cdate_from'] = strtotime($oProduct->getMeta('wpsg_mod_funding_start')); 
+			
+			$arOrder = wpsg_order::find($arFilter);
+			$nSum = 0;
+			
+			foreach ($arOrder as $oOrder)
+			{
+				
+				$nSum += $oOrder->getProductCount($product_id);
+								
+			}
+			
+			return $nSum;
+			
+		} // public function getCurrentFundingCount($product_id)
+		
+		/**
+		 * Gibt die maximale Anzahl an KÃ€ufen fÃŒr ein Produkt zurÃŒck
+		 * @param unknown $product_id
+		 */
+		public function getMaxFundingCount($product_id)
+		{
+			
+			$oProduct = wpsg_product::getInstance($product_id);
+			
+			return $oProduct->getMeta('wpsg_mod_funding_limit');
+			
+		} // public function getMaxFundingCount($product_id)
+		
+	} // class wpsg_mod_funding extends wpsg_mod_basic
+
+?>
Index: /system/intern/mods/wpsg_mod_test.class.php
===================================================================
--- /system/intern/mods/wpsg_mod_test.class.php	(revision 6510)
+++ /system/intern/mods/wpsg_mod_test.class.php	(revision 6510)
@@ -0,0 +1,1504 @@
+<?php
+
+	/**
+	 * Modul um die Shop Funktionen zu testen
+	 * @author daniel
+	 */
+	class wpsg_mod_test extends wpsg_mod_basic
+	{
+		
+		var $id = 14;
+		var $arKeyLabel = array();
+		var $arOriginalConfig = array();
+		var $_arTableBackup = array(); 
+		
+		/**
+		 * Costructor
+		 */
+		public function __construct()
+		{
+			
+			parent::__construct();
+			
+			// Array mit den Bezeichnungen fÃŒr die Keys, damit ich die nicht immer tippen muss
+			$this->arKeyLabel = array(
+				'sum/mwst' => 'Summe Mehrwertsteuer',
+				'sum/preis_netto' => 'Summe Nettopreis vor Versand/Zahlung',
+				'sum/preis_brutto' => 'Summe Bruttopreis vor Versand/Zahlung',
+				'sum/preis' => 'Angezeigter Preis vor Versand/Zahlung',
+				'sum/preis_gesamt_netto' => 'Summe Nettopreis nach Versand/Zahlung',
+				'sum/preis_gesamt_brutto' => 'Summe Bruttopreis nach Versand/Zahlung',
+				'sum/preis_gesamt' => 'Angezeigter Preis nach Versand/Zahlung',
+				'sum/gs_netto' => 'Gutscheinwert Netto',
+				'sum/gs_brutto' => 'Gutscheinwert Brutto',
+				'sum/gs' => 'Angezeigter Gutscheinwert',				
+				'mwst/c_1/base_value' => 'Bruttobezug fÃŒr 19%',
+				'mwst/c_1/sum' => 'Mehrwertsteuer 19%',
+				'mwst/b_1/base_value' => 'Bruttobezug fÃŒr 7%',
+				'mwst/b_1/sum' => 'Mehrwertsteuer 7%'
+			);
+						
+			$this->name = __('Test', 'wpsg');
+			$this->group = __('Sonstiges', 'wpsg');
+			$this->desc = __('', 'wpsg');
+						
+		} // public function __construct()
+		
+		public function settings_edit()
+		{
+
+			$this->shop->view['arKeyLabel'] = $this->arKeyLabel;
+			  
+			$this->saveConfig();
+						
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '1',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 7%',
+				'preis' => '107.00', 
+				'mwst_key' => 'b'									
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '2',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 19',
+				'preis' => '119.00', 
+				'mwst_key' => 'c'
+			));
+						
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '3',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 5',
+				'preis' => '3', 	
+				'mwst_key' => 'a'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '4',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 19 (Netto definiert)',
+				'preis' => '100.00',
+				'mwst_key' => 'c'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '5',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 19',
+				'preis' => '119.00', 
+				'mwst_key' => 'c',
+				'euleistungsortregel' => '1'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '6',
+				'cdate' => 'NOW()',
+				'name' => 'Variantenprodukt 19',
+				'preis' => '0.00',
+				'mwst_key' => 'c',
+				'euleistungsortregel' => '1',
+				'mod_varianten' => 'a:1:{i:0;a:5:{s:4:"name";s:6:"Lizenz";s:3:"typ";s:5:"radio";s:5:"aktiv";s:1:"1";s:4:"vari";a:3:{i:0;a:6:{s:4:"name";s:5:"Light";s:5:"preis";s:5:"25.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:43:",Untitled-1.jpg,Box_wpShopGermany_Light.jpg";}i:1;a:6:{s:4:"name";s:3:"Pro";s:5:"preis";s:5:"45.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:41:",Untitled-1.jpg,Box_wpShopGermany_Pro.jpg";}i:2;a:6:{s:4:"name";s:10:"Enterprise";s:5:"preis";s:6:"149.00";s:5:"aktiv";s:1:"1";s:5:"stock";s:1:"0";s:6:"weight";s:4:"0.00";s:3:"pic";s:48:",Untitled-1.jpg,Box_wpShopGermany_Enterprise.jpg";}}s:4:"lang";a:0:{}}}'					
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '7',
+				'cdate' => 'NOW()',
+				'name' => 'Rabattprodukt',
+				'rabatt' => '1_01.01.2000_01.01.2020_24.98%',
+				'preis' => '20.00',
+				'mwst_key' => 'a',
+				'euleistungsortregel' => '0',
+				'mod_varianten' => '',
+				'basket_multiple' => '2'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_PRODUCTS, array(
+				'id' => '8',
+				'cdate' => 'NOW()',
+				'name' => 'Produkt 19%',
+				'preis' => '20.08',
+				'mwst_key' => 'c'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_VA, array(
+				'id' => '1',
+				'vz' => '0', 
+				'mwst_laender' => '0',
+				'mwst_key' => '0',
+				'typ' => 'w',
+				'kosten' => '4',
+				'aktiv' => '1'					
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_LAND, array(
+				'id' => '1',
+				'name' => 'Deutschland',
+				'kuerzel' => 'DE',
+				'vz' => '1',
+				'mwst' => '0',
+				'mwst_c' => '19',
+				'mwst_b' => '7'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_LAND, array(
+				'id' => '2',
+				'name' => 'Ãsterreich',
+				'kuerzel' => 'AT',
+				'vz' => '1',
+				'mwst' => '2', // Keine MwSt. bei USt.IdNr.
+				'mwst_a' => '',
+				'mwst_b' => '10',
+				'mwst_c' => '20',
+				'mwst_d' => '12'
+			));
+			
+			$this->db->ImportQuery(WPSG_TBL_LAND, array(
+				'id' => '3',
+				'name' => 'Schweiz',
+				'kuerzel' => 'CH',
+				'vz' => '2',
+				'mwst' => '1', // Keine MwSt.
+				'mwst_c' => '',
+				'mwst_b' => ''
+			));
+			
+			$this->shop->update_option('wpsg_defaultland', '1');
+			
+			wp_cache_flush();
+			
+			$this->shop->template_redirect();
+   			
+			if ($this->shop->hasMod('wpsg_mod_gutschein'))
+			{
+			
+				$this->test2(WPSG_BRUTTO, WPSG_BRUTTO); 
+				$this->test2(WPSG_BRUTTO, WPSG_NETTO);
+				$this->test2(WPSG_NETTO, WPSG_BRUTTO);
+				$this->test2(WPSG_NETTO, WPSG_NETTO);
+				
+				$this->test3(WPSG_BRUTTO, WPSG_BRUTTO);
+				$this->test3(WPSG_BRUTTO, WPSG_NETTO);
+				$this->test3(WPSG_NETTO, WPSG_BRUTTO);
+				$this->test3(WPSG_NETTO, WPSG_NETTO);
+				
+				$this->test4(WPSG_BRUTTO, WPSG_BRUTTO);
+				$this->test4(WPSG_BRUTTO, WPSG_NETTO);
+				$this->test4(WPSG_NETTO, WPSG_BRUTTO);
+				$this->test4(WPSG_NETTO, WPSG_NETTO);
+				
+				$this->test5();
+				$this->test6();
+				
+				if ($this->shop->hasMod('wpsg_mod_discount'))
+				{
+				
+					$this->test7();
+					
+				}
+			
+				if ($this->shop->hasMod('wpsg_mod_gutschein'))
+				{
+					
+					$this->test8();
+					
+				}
+				
+			}
+
+			$this->test9();
+			
+			$this->test10();
+			$this->test11();
+			$this->test11(true);
+			$this->test12();
+			$this->test13();
+			$this->test14();
+			$this->test15();
+			$this->test16();
+			$this->test17();
+			$this->test18();		 						 	
+			$this->test19();
+					
+			$this->restoreConfig();
+			 									
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/settings_edit.phtml');
+			
+		} // public function settings_edit()
+		
+		/* Tests */
+		
+		/**
+		 * Setzt die Konfiguration zurÃŒck fÃŒr einen neuen Test
+		 */
+		private function resetConfig()
+		{
+			
+			$_SESSION['wpsg'] = array();
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_debugModus', '1');
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);			
+			$this->shop->update_option('wpsg_kleinunternehmer', false);
+			$this->shop->update_option('wpsg_mod_discount_data', array());
+			
+			$time = time();
+			
+			$this->shop->update_option('wpsg_mod_varianten', $time);
+			$this->shop->update_option('wpsg_mod_gutschein', $time);
+			$this->shop->update_option('wpsg_mod_versandarten', $time);
+			
+			$this->shop->update_option('wpsg_module', base64_encode(serialize(array(
+				'wpsg_mod_varianten' => $time,
+				'wpsg_mod_gutschein' => $time,
+				'wpsg_mod_versandarten' => $time					
+			))));
+			
+			wp_cache_flush();
+			
+		} // private function resetConfig()
+		
+		/**
+		 * Speichert die Einstellungen vor den Tests
+		 */
+		public function saveConfig()
+		{
+			
+			$this->arOriginalConfig = array(
+				'wpsg_preisangaben' => $this->shop->get_option('wpsg_preisangaben'),
+				'wpsg_preisangaben_frontend' => $this->shop->getFrontendTaxview(),
+				'wpsg_kleinunternehmer' => $this->shop->get_option('wpsg_kleinunternehmer'),
+				'wpsg_mod_discount_data' => $this->shop->get_option('wpsg_mod_discount_data')
+			);
+			
+			$this->arOriginalConfig = $this->db->fetchAssoc("SELECT * FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
+			
+			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");			
+			wp_cache_delete('alloptions', 'options');
+									
+			// Tabllen speichern
+			$arTables = $this->db->fetchAssocField("SHOW TABLES");
+			
+			foreach ($arTables as $table_name)
+			{
+				 
+				if (preg_match('/wpsg\_(.*)/', $table_name))
+				{
+					
+					$this->_arTableBackup[$table_name] = $this->db->fetchAssoc("SELECT * FROM `".wpsg_q($table_name)."`");
+															
+				}
+				
+			}
+			
+			// Backup ist erstellt, jetzt die Tabellen leeren von denen ein Backup erstellt wurde
+			foreach ($this->_arTableBackup as $table_name => $table_data)
+			{
+		 
+				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
+				
+			}
+			
+		} // public function saveConfig()
+		
+		/**
+		 * Stellt die Einstellungen nach den Tests wieder her
+		 */
+		public function restoreConfig()
+		{
+ 
+			$this->db->Query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'wpsg_%' ");
+			
+			foreach ($this->arOriginalConfig as $k => $v)
+			{
+				 				
+				unset($v['option_id']);
+				$this->db->ImportQuery('wp_options', $v);
+								
+			}
+			 
+			wp_cache_delete('alloptions', 'options');
+			 
+			foreach ($this->_arTableBackup as $table_name => $table_data)
+			{
+				
+				$this->db->Query("TRUNCATE TABLE `".wpsg_q($table_name)."` ");
+				
+				foreach ($table_data as $row)
+				{
+					
+					$this->db->ImportQuery($table_name, wpsg_q($row));
+					
+				}
+								
+			}
+			
+			unset($_SESSION['wpsg']);
+						
+		} // public function restoreConfig()
+		
+		/*
+		 * http://forum.maennchen1.de/viewtopic.php?f=13&t=6834&start=30
+		 * 20,08 Brutto
+		 * - Frontend Netto
+		 * - 7 im Warenkorb 
+		 */
+		private function test19()
+		{
+			
+			$this->resetConfig();
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+			
+			$_SESSION['wpsg']['basket'] = array(
+				0 => array(
+					'menge' => 7,
+					'id' => 8
+				)
+			);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '1 Produkte (20,08Brutto * 7)',
+				'tests' => array(
+					'sum/mwst' => array(false, 22.44),
+					'sum/preis_netto' => array(false, 118.12),
+					'sum/preis_brutto' => array(false, 140.56),
+					/*'sum/preis' => array(false, 140.56),
+					'sum/preis_gesamt_netto' => array(false, 200),
+					'sum/preis_gesamt_brutto' => array(false, 226),
+					'sum/preis_gesamt' => array(false, 226),
+					'mwst/b_1/base_value' => array(false, 107),
+					'mwst/b_1/sum' => array(false, 7),
+					'mwst/c_1/base_value' => array(false, 119),
+					'mwst/c_1/sum' => array(false, 19),*/
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		} // private function test19()
+		
+		/**
+		 * Testfall 1
+		 *
+		 * 1 Produkt 19%/119â¬Brutto 
+		 * 1 Produkt 7%/107â¬Brutto
+		 * - Keine Versandarten
+		 * - Kein Gutschein
+		 * - Kein Rabatt
+		 */
+		private function test1()
+		{
+			
+			$this->resetConfig();
+			 
+			$_SESSION['wpsg']['basket'] = array(
+				0 => array(
+					'menge' => 1,
+					'id' => 1
+				),
+				1 => array(
+					'menge' => 1,
+					'id' => 2
+				)
+			);
+						
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			 
+			$this->shop->view['test'][] = array(
+				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto',
+				'tests' => array(
+					'sum/mwst' => array(false, 26),
+					'sum/preis_netto' => array(false, 200),
+					'sum/preis_brutto' => array(false, 226),
+					'sum/preis' => array(false, 226),					
+					'sum/preis_gesamt_netto' => array(false, 200),
+					'sum/preis_gesamt_brutto' => array(false, 226),
+					'sum/preis_gesamt' => array(false, 226),
+					'mwst/b_1/base_value' => array(false, 107),
+					'mwst/b_1/sum' => array(false, 7),
+					'mwst/c_1/base_value' => array(false, 119),
+					'mwst/c_1/sum' => array(false, 19),
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+						 
+		} // private function test1()
+		
+		/**
+		 * Testfall 2
+		 * 
+		 * 1 Produkt 19%/119â¬Brutto
+		 * - Keine Versandarten
+		 * - 1 Gutschein Wert 10Euro
+		 * - Kein Rabatt
+		 */
+		private function test2($preisangabe_backend, $preisangabe_frontend)
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'w',
+					'code' => 'Abs10',
+					'id' => 1
+				)
+			);
+
+			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
+			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 17.403361344538),
+						'sum/preis_netto' => array(false, 91.596638655462),
+						'sum/preis_brutto' => array(false, 109),
+						'sum/preis' => array(false, 109),		
+						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
+						'sum/preis_gesamt_brutto' => array(false, 109),
+						'sum/preis_gesamt' => array(false, 109),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 17.403361344538),						
+						'sum/preis_netto' => array(false, 91.596638655462),
+						'sum/preis_brutto' => array(false, 109),
+						'sum/preis' => array(false, 91.596638655462),						
+						'sum/preis_gesamt_netto' => array(false, 91.596638655462),
+						'sum/preis_gesamt_brutto' => array(false, 109),
+						'sum/preis_gesamt' => array(false, 91.596638655462),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 20.71),						
+						'sum/preis_netto' => array(false, 109),
+						'sum/preis_brutto' => array(false, 129.71),
+						'sum/preis' => array(false, 129.71),						
+						'sum/preis_gesamt_netto' => array(false, 109),
+						'sum/preis_gesamt_brutto' => array(false, 129.71),
+						'sum/preis_gesamt' => array(false, 129.71),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 20.71),						
+						'sum/preis_netto' => array(false, 109),
+						'sum/preis_brutto' => array(false, 129.71),
+						'sum/preis' => array(false, 109),						
+						'sum/preis_gesamt_netto' => array(false, 109),
+						'sum/preis_gesamt_brutto' => array(false, 129.71),
+						'sum/preis_gesamt' => array(false, 109),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			
+		} // private function test2()
+		 		
+		/**
+		 * Wie test2 nur mit zwei Produkten
+		 */
+		private function test3($preisangabe_backend, $preisangabe_frontend)
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					),
+					1 => array(
+						'menge' => 1,
+						'id' => 1
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'w',
+					'code' => 'Abs10',
+					'id' => 1
+				)
+			);
+
+			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
+			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Brutto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 24.849557522124),
+						'sum/preis_netto' => array(false, 191.15044247788),
+						'sum/preis_brutto' => array(false, 216),
+						'sum/preis' => array(false, 216),		
+						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
+						'sum/preis_gesamt_brutto' => array(false, 216),
+						'sum/preis_gesamt' => array(false, 216),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Brutto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 24.849557522124),
+						'sum/preis_netto' => array(false, 191.15044247788),
+						'sum/preis_brutto' => array(false, 216),
+						'sum/preis' => array(false, 191.15044247788),		
+						'sum/preis_gesamt_netto' => array(false, 191.15044247788),
+						'sum/preis_gesamt_brutto' => array(false, 216),
+						'sum/preis_gesamt' => array(false, 191.15044247788),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Netto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 28.736462319406),
+						'sum/preis_netto' => array(false, 216),
+						'sum/preis_brutto' => array(false, 244.73646231941),
+						'sum/preis' => array(false, 244.73646231941),		
+						'sum/preis_gesamt_netto' => array(false, 216),
+						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
+						'sum/preis_gesamt' => array(false, 244.73646231941),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '2 Produkte (119â¬/19% und 107â¬/7%) mit Gutschein (10â¬) / Netto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 28.736462319406),						
+						'sum/preis_netto' => array(false, 216),
+						'sum/preis_brutto' => array(false, 244.73646231941),
+						'sum/preis' => array(false, 216),						
+						'sum/preis_gesamt_netto' => array(false, 216),
+						'sum/preis_gesamt_brutto' => array(false, 244.73646231941),
+						'sum/preis_gesamt' => array(false, 216),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			
+		} // private function test3()
+
+		/**
+		 * Testfall 4
+		 * 
+		 * 1 Produkt 19%/119â¬Brutto
+		 * - Keine Versandarten
+		 * - 1 Gutschein Wert 10%
+		 * - Kein Rabatt
+		 */
+		private function test4($preisangabe_backend, $preisangabe_frontend)
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'p',
+					'code' => 'Proz10',
+					'id' => 2
+				)
+			);
+
+			$this->shop->update_option('wpsg_preisangaben', $preisangabe_backend);
+			$this->shop->update_option('wpsg_preisangaben_frontend', $preisangabe_frontend);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10%) / Brutto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 17.1),
+						'sum/preis_netto' => array(false, 90),
+						'sum/preis_brutto' => array(false, 107.1),
+						'sum/preis' => array(false, 107.1),		
+						'sum/preis_gesamt_netto' => array(false, 90),
+						'sum/preis_gesamt_brutto' => array(false, 107.1),
+						'sum/preis_gesamt' => array(false, 107.1),						
+						'sum/gs_netto' => array(false, 10),
+						'sum/gs_brutto' => array(false, 11.9),
+						'sum/gs' => array(false, 11.9)
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_BRUTTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Brutto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 17.1),						
+						'sum/preis_netto' => array(false, 90),
+						'sum/preis_brutto' => array(false, 107.1),
+						'sum/preis' => array(false, 90),						
+						'sum/preis_gesamt_netto' => array(false, 90),
+						'sum/preis_gesamt_brutto' => array(false, 107.1),
+						'sum/preis_gesamt' => array(false, 90),
+						'sum/gs_netto' => array(false, 10),
+						'sum/gs_brutto' => array(false, 11.9),
+						'sum/gs' => array(false, 10)
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_BRUTTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Brutto',
+					'tests' => array(
+						'sum/mwst' => array(false, 20.349),						
+						'sum/preis_netto' => array(false, 107.1),
+						'sum/preis_brutto' => array(false, 127.449),
+						'sum/preis' => array(false, 127.449),						
+						'sum/preis_gesamt_netto' => array(false, 107.1),
+						'sum/preis_gesamt_brutto' => array(false, 127.449),
+						'sum/preis_gesamt' => array(false, 127.449),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			else if ($preisangabe_backend === WPSG_NETTO && $preisangabe_frontend == WPSG_NETTO)
+			{
+				
+				$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Netto - Netto',
+					'tests' => array(
+						'sum/mwst' => array(false, 20.349),						
+						'sum/preis_netto' => array(false, 107.1),
+						'sum/preis_brutto' => array(false, 127.449),
+						'sum/preis' => array(false, 107.1),						
+						'sum/preis_gesamt_netto' => array(false, 107.1),
+						'sum/preis_gesamt_brutto' => array(false, 127.449),
+						'sum/preis_gesamt' => array(false, 107.1),
+					),
+					'array' => $basket->toArray(),
+					'config' => $this->showConfiguration()
+				);
+				
+			}
+			
+		} // private function test4()
+
+		/**
+		 * Testfall 5
+		 * 
+		 * 1 Produkt 19%/119â¬Brutto
+		 * - Keine Versandarten
+		 * - 1 Gutschein Wert 10Euro
+		 * - Kein Rabatt
+		 */
+		private function test5()
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'w',
+					'code' => 'Wert10',
+					'id' => 1
+				)
+			);
+
+			$this->shop->update_option('wpsg_kleinunternehmer', '1');
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '1 Produkt (119â¬/19%) mit Gutschein (10â¬) / Kleinunternehmerregelung',
+				'tests' => array(
+					'sum/mwst' => array(false, 0),
+					'sum/preis_netto' => array(false, 90),
+					'sum/preis_brutto' => array(false, 90),
+					'sum/preis' => array(false, 90),		
+					'sum/preis_gesamt_netto' => array(false, 90),
+					'sum/preis_gesamt_brutto' => array(false, 90),
+					'sum/preis_gesamt' => array(false, 90),						
+					'sum/gs_netto' => array(false, 10),
+					'sum/gs_brutto' => array(false, 10),
+					'sum/gs' => array(false, 10)
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		} // private function test5()
+		
+		/**
+		 * Testfall 6
+		 * 
+		 * 1 Produkt 19%/119â¬Brutto
+		 * - Keine Versandarten
+		 * - 1 Gutschein Wert 10%
+		 * - Kein Rabatt
+		 */
+		private function test6()
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'p',
+					'code' => 'Proz10',
+					'id' => 2
+				)
+			);
+
+			$this->shop->update_option('wpsg_kleinunternehmer', '1');
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO); 
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '1 Produkt (119â¬/19%) mit Gutschein (10%) / Kleinunternehmerregelung',
+				'tests' => array(
+					'sum/mwst' => array(false, 0),
+					'sum/preis_netto' => array(false, 90),
+					'sum/preis_brutto' => array(false, 90),
+					'sum/preis' => array(false, 90),		
+					'sum/preis_gesamt_netto' => array(false, 90),
+					'sum/preis_gesamt_brutto' => array(false, 90),
+					'sum/preis_gesamt' => array(false, 90),						
+					'sum/gs_netto' => array(false, 10),
+					'sum/gs_brutto' => array(false, 10),
+					'sum/gs' => array(false, 10)
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		} // private function test6()
+		
+		/**
+		 * 
+		 * 5 Produkt 19%/119â¬Brutto
+		 * - Keine Versandarten
+		 * - 1 Gutschein Wert 10%
+		 * - 50â¬ Rabatt
+		 */
+		private function test7() 
+		{
+			
+			$this->resetConfig();
+			
+			// Rabatt konfigurieren
+			$this->shop->update_option('wpsg_mod_discount_data', unserialize('s:91:"a:2:{i:0;a:1:{s:6:"rabatt";s:1:"0";}i:1;a:2:{s:5:"value";s:3:"250";s:6:"rabatt";s:2:"50";}}";'));
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 5,
+						'id' => 2
+					)
+				),
+				'gs' => array(
+					'value' => 10,
+					'calc' => 'p',
+					'code' => 'Proz10',
+					'id' => 2
+				)
+			);
+ 
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO); 
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '5 Produkte (je 119â¬/19%) mit Gutschein (10%) und Rabatt 50â¬ / Brutto - Netto',
+				'tests' => array(
+					'sum/mwst' => array(false, 77.516806722689),
+					'sum/preis_netto' => array(false, 407.98),
+					'sum/preis_brutto' => array(false, 485.5),
+					'sum/preis' => array(false, 407.98),		
+					'sum/preis_gesamt_netto' => array(false, 407.98),
+					'sum/preis_gesamt_brutto' => array(false, 485.5),
+					'sum/preis_gesamt' => array(false, 407.98),						
+					'sum/gs_netto' => array(false, 50),
+					'sum/gs_brutto' => array(false, 59.5),
+					'sum/gs' => array(false, 50)
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		} // private function test7()
+		
+		private function test8()
+		{
+			
+			$this->resetConfig();
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_NETTO);
+			$this->shop->update_option('wpsg_kleinunternehmer', false);
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 3
+					)
+				),
+				'gs' => array(
+					'value' => 5,
+					'calc' => 'w',
+					'code' => 'Wert10',
+					'id' => 1
+				),
+				'checkout' => array(
+					'land' => '1',
+					'shipping' => '6_1'					
+				)
+			);
+			
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '3â¬ Produkt mit 5â¬ Gutschein und 4â¬ Versandkosten',
+				'tests' => array(
+					'sum/mwst' => array(false, 0),
+					'sum/preis_netto' => array(false, 0),
+					'sum/preis_brutto' => array(false, 0),
+					'sum/preis' => array(false, 0),
+					'sum/preis_gesamt_netto' => array(false, 2),
+					'sum/preis_gesamt_brutto' => array(false, 2),
+					'sum/preis_gesamt' => array(false, 2),
+					'sum/gs_netto' => array(false, 5),
+					'sum/gs_brutto' => array(false, 5),
+					'sum/gs' => array(false, 5)
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		} // private function test8()
+		
+		private function test9()
+		{
+			
+			$arShippingGesamt = array(1,2,3,4,5);
+			 
+			$arTest1_Produkt1 = array(1);
+			$arTest1_Produkt2 = array(5,4,3);
+			$arTest1_Produkt3 = array(2,3,4);
+			$arTest1_Produkt4 = array(5);
+						
+			$arMergeTest1_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest1_Produkt1);
+			$arMergeTest1_2 = $this->shop->mergeShipping($arMergeTest1_1, $arTest1_Produkt2);			
+			$arMergeTest1_3 = $this->shop->mergeShipping($arMergeTest1_2, $arTest1_Produkt3); 			
+			$arMergeTest1_4 = $this->shop->mergeShipping($arMergeTest1_3, $arTest1_Produkt4); 
+			 
+			$arTest2_Produkt1 = array(1,2);
+			$arTest2_Produkt2 = array(3,4);
+				
+			$arMergeTest2_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest2_Produkt1);
+			$arMergeTest2_2 = $this->shop->mergeShipping($arMergeTest2_1, $arTest2_Produkt2);
+			 
+			$arTest3_Produkt1 = array(1);
+			$arTest3_Produkt2 = array(2);
+			$arTest3_Produkt3 = array(1,2);
+			
+			$arMergeTest3_1 = $this->shop->mergeShipping($arShippingGesamt, $arTest3_Produkt1);
+			$arMergeTest3_2 = $this->shop->mergeShipping($arMergeTest3_1, $arTest3_Produkt2);
+			$arMergeTest3_3 = $this->shop->mergeShipping($arMergeTest3_2, $arTest3_Produkt3);
+		 
+			$result = array(
+				'test1_merge1' => sizeof($arMergeTest1_1).':'.$arMergeTest1_1[0],
+				'test1_merge2' => sizeof($arMergeTest1_2).':'.implode(',', $arMergeTest1_2[0]).' '.implode(',', $arMergeTest1_2[1]).' '.implode(',', $arMergeTest1_2[2]),
+				'test1_merge3' => sizeof($arMergeTest1_3).':'.implode(',', $arMergeTest1_3[0]).' '.implode(',', $arMergeTest1_3[1]).' '.implode(',', $arMergeTest1_3[2])
+					.' '.implode(',', $arMergeTest1_3[3]).' '.implode(',', $arMergeTest1_3[4]).' '.implode(',', $arMergeTest1_3[5])
+					.' '.implode(',', $arMergeTest1_3[6]).' '.implode(',', $arMergeTest1_3[7]),
+				'test1_merge4' => sizeof($arMergeTest1_4).':'.implode(',', $arMergeTest1_4[0]).' '.implode(',', $arMergeTest1_4[1]).' '.implode(',', $arMergeTest1_4[2]),
+				'test2_merge1' => sizeof($arMergeTest2_1).':'.implode(',', $arMergeTest2_1),
+				'test2_merge2' => sizeof($arMergeTest2_2).':'.implode(',', $arMergeTest2_2[0]).' '.implode(',', $arMergeTest2_2[1]).' '.implode(',', $arMergeTest2_2[2]).' '.implode(',', $arMergeTest2_2[3]),
+				'test3_merge1' => sizeof($arMergeTest3_1).':'.implode(',', $arMergeTest3_1),
+				'test3_merge2' => sizeof($arMergeTest3_2).':'.implode(',', $arMergeTest3_2[0]),
+				'test3_merge3' => sizeof($arMergeTest3_3).':'.implode(',', $arMergeTest3_3[0])
+			);
+			
+			$this->shop->view['test'][] = array(
+				'label' => 'Test der Funktion "Merge Versandarten"',
+				'tests' => array(
+					'test1_merge1' => array('Test1 nach Merge1 mit Produkt1', '1:1'),
+					'test1_merge2' => array('Test1 nach Merge2 mit Produkt2', '3:1,5 1,4 1,3'),						
+					'test1_merge3' => array('Test1 nach Merge3 mit Produkt3', '8:1,5,2 1,5,3 1,5,4 1,4,2 1,4,3 1,4 1,3,2 1,3'),
+					'test1_merge4' => array('Test1 nach Merge4 mit Produkt4', '3:1,5,2 1,5,3 1,5,4'),
+					'test2_merge1' => array('Test2 nach Merge1 mit Produkt1', '2:1,2'),
+					'test2_merge2' => array('Test2 nach Merge2 mit Produkt2', '4:1,3 1,4 2,3 2,4'),
+					'test3_merge1' => array('Test3 nach Merge1 mit Produkt1', '1:1'), 
+					'test3_merge2' => array('Test3 nach Merge2 mit Produkt2', '1:1,2'),
+					'test3_merge3' => array('Test3 nach Merge3 mit Produkt3', '1:1,2'),
+				),
+				'array' => $result
+			);
+			
+			
+		}
+		
+		function test10()
+		{
+
+			$this->resetConfig();
+			
+			$_SESSION['wpsg']['basket'] = array(
+				0 => array(
+					'menge' => 1,
+					'id' => 1
+				),
+				1 => array(
+					'menge' => 1,
+					'id' => 2
+				)
+			);
+			$_SESSION['wpsg']['checkout']['land'] = 3;
+				 
+			$basket = new wpsg_basket();
+			$basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Schweiz mit "Keine MwSt."',
+				'tests' => array(
+					'sum/mwst' => array(false, 0),
+					'sum/preis_netto' => array(false, 200),
+					'sum/preis_brutto' => array(false, 200),
+					'sum/preis' => array(false, 200),
+					'sum/preis_gesamt_netto' => array(false, 200),
+					'sum/preis_gesamt_brutto' => array(false, 200),
+					'sum/preis_gesamt' => array(false, 200)					
+				),
+				'array' => $basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+		
+		}
+		
+		function test11($ust = false)
+		{
+		
+			$this->resetConfig();
+				
+			$_SESSION['wpsg']['basket'] = array(
+				0 => array(
+					'menge' => 1,
+					'id' => 1
+				),
+				1 => array(
+					'menge' => 1,
+					'id' => 2
+				)
+			);
+			$_SESSION['wpsg']['checkout']['land'] = 2;
+			
+			if ($ust === true) $_SESSION['wpsg']['checkout']['ustidnr'] = 'AT1234';
+				
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+				
+			$this->shop->view['test'][] = array(
+				'label' => '2 Produkte/unterschiedliche MwSt / Brutto - Brutto / Ãsterreich mit "Keine MwSt. bei UStIdNr." '.(($ust === true)?'(UStIdNr. gesetzt)':''),
+				'tests' => array(
+					'sum/mwst' => array(false, (($ust == true)?0:26)),
+					'sum/preis_netto' => array(false, (($ust == true)?200:200)),
+					'sum/preis_brutto' => array(false, (($ust == true)?200:226)),
+					'sum/preis' => array(false, (($ust == true)?200:226)),
+					'sum/preis_gesamt_netto' => array(false, (($ust == true)?200:200)),
+					'sum/preis_gesamt_brutto' => array(false, (($ust == true)?200:226)),
+					'sum/preis_gesamt' => array(false, (($ust == true)?200:226))
+				),
+				'array' => $this->shop->basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+		
+		}
+		
+		public function test12()
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 4
+					), 
+				),
+				'checkout' => array(
+					'shipping' => '6_1',
+					'land' => '1'	
+				)
+			);
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_NETTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+			
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (100 + 19%) MwSt / Netto - Brutto / 4,- Netto Versand',
+					'tests' => array(
+							'sum/mwst' => array(false, 19.76),
+							'sum/preis_netto' => array(false, 100),
+							'sum/preis_brutto' => array(false, 119),
+							'sum/preis' => array(false, 119),
+							'sum/preis_gesamt_netto' => array(false, 104),
+							'sum/preis_gesamt_brutto' => array(false, 123.76),
+							'sum/preis_gesamt' => array(false, 123.76)
+					),
+					'array' => $this->shop->basket->toArray(),
+					'config' => $this->showConfiguration()
+			);
+			
+		}
+		
+		public function test13()
+		{
+				
+			$this->resetConfig();
+				
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 2
+					),
+				),
+				'checkout' => array(
+					'shipping' => '6_1',
+					'land' => '1'
+				)
+			);
+				
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+				
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+				
+			$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119) / Brutto - Brutto / 4,- Brutto Versand',
+					'tests' => array(
+							'sum/mwst' => array(false, 19.638655462185),
+							'sum/preis_netto' => array(false, 100),
+							'sum/preis_brutto' => array(false, 119),
+							'sum/preis' => array(false, 119),
+							'sum/preis_gesamt_netto' => array(false, 103.36134453782),
+							'sum/preis_gesamt_brutto' => array(false, 123),
+							'sum/preis_gesamt' => array(false, 123)
+					),
+					'array' => $this->shop->basket->toArray(),
+					'config' => $this->showConfiguration()
+			);
+				
+		}
+		
+		public function test14()
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 5
+					),
+				),
+				'checkout' => array(
+					'shipping' => '6_1',
+					'land' => '2'
+				)
+			);
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+			
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / 4,- Brutto Versand -> Versand nach AT (20% MwSt. statt 19%)',
+				'tests' => array(
+					'sum/mwst' => array(false, 20.672268907563),
+					'sum/preis_netto' => array(false, 100),
+					'sum/preis_brutto' => array(false, 120),
+					'sum/preis' => array(false, 120),
+					'sum/preis_gesamt_netto' => array(false, 103.36134453782),
+					'sum/preis_gesamt_brutto' => array(false, 124.03361344538),
+					'sum/preis_gesamt' => array(false, 124.03361344538)
+				),
+				'array' => $this->shop->basket->toArray(),
+				'config' => $this->showConfiguration()
+			);
+			
+		}
+		
+		public function test15() 
+		{
+			
+			$this->resetConfig();
+			
+			$_SESSION['wpsg'] = array(
+				'basket' => array(
+					0 => array(
+						'menge' => 1,
+						'id' => 'vp_6/0_2'
+					),
+				),
+				'checkout' => array( 
+					'land' => '2'
+				)
+			);
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+			
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+				'label' => '1 Variantenprodukt (149 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt. statt 19%)',
+				'tests' => array(
+					'sum/mwst' => array(false, 25.04),
+					'sum/preis_netto' => array(false, 125.21),
+					'sum/preis_brutto' => array(false, 150.25),
+					'sum/preis' => array(false, 150.25),
+					'sum/preis_gesamt_netto' => array(false, 125.21),
+					'sum/preis_gesamt_brutto' => array(false, 150.25),
+					'sum/preis_gesamt' => array(false, 150.25)
+				),
+				'array' => $this->shop->basket->toArray(),
+				'config' => $this->showConfiguration()
+			); 
+			
+		}
+		
+		public function test16() 
+		{
+			
+			$this->resetConfig();
+				
+			$_SESSION['wpsg'] = array(
+					'basket' => array(
+							0 => array(
+									'menge' => 1,
+									'id' => '2'
+							),
+					),
+					'checkout' => array(
+							'land' => '2'
+					)
+			);
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+				
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+			
+			$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119) / Brutto - Brutto / -> Versand nach AT (19% MwSt.)',
+					'tests' => array(
+							'sum/mwst' => array(false, 19),
+							'sum/preis_netto' => array(false, 100),
+							'sum/preis_brutto' => array(false, 119),
+							'sum/preis' => array(false, 119),
+							'sum/preis_gesamt_netto' => array(false, 100),
+							'sum/preis_gesamt_brutto' => array(false, 119),
+							'sum/preis_gesamt' => array(false, 119)
+					),
+					'array' => $this->shop->basket->toArray(),
+					'config' => $this->showConfiguration()
+			);
+			
+		}
+		
+		public function test17()
+		{
+				
+			$this->resetConfig();
+		
+			$_SESSION['wpsg'] = array(
+					'basket' => array(
+							0 => array(
+									'menge' => 1,
+									'id' => '5'
+							),
+					),
+					'checkout' => array(
+							'land' => '2'
+					)
+			);
+				
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+		
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+				
+			$this->shop->view['test'][] = array(
+					'label' => '1 Produkt (119 mit Leistungsort) / Brutto - Brutto / -> Versand nach AT (20% MwSt., da Leistungsort)',
+					'tests' => array(
+							'sum/mwst' => array(false, 20),
+							'sum/preis_netto' => array(false, 100),
+							'sum/preis_brutto' => array(false, 120),
+							'sum/preis' => array(false, 120),
+							'sum/preis_gesamt_netto' => array(false, 100),
+							'sum/preis_gesamt_brutto' => array(false, 120),
+							'sum/preis_gesamt' => array(false, 120)
+					),
+					'array' => $this->shop->basket->toArray(),
+					'config' => $this->showConfiguration()
+			);
+				
+		}
+
+		public function test18()
+		{
+		
+			$this->resetConfig();
+		
+			$_SESSION['wpsg'] = array(
+					'basket' => array(
+							0 => array(
+									'menge' => 1,
+									'id' => '7'
+							),
+							1 => array(
+									'menge' => 1,
+									'id' => '7'
+							),
+							2 => array(
+									'menge' => 1,
+									'id' => '7'
+							),
+					),
+					'checkout' => array(
+							'land' => '2'
+					)
+			);
+		
+			$this->shop->update_option('wpsg_mod_discount', time());
+			$this->shop->update_option('wpsg_mod_discount_productdiscount', '1');
+			
+			$this->shop->update_option('wpsg_preisangaben', WPSG_BRUTTO);
+			$this->shop->update_option('wpsg_preisangaben_frontend', WPSG_BRUTTO);
+		
+			$this->shop->basket = new wpsg_basket();
+			$this->shop->basket->initFromSession();
+		
+			$this->shop->view['test'][] = array(
+					'label' => '3 x das gleiche Produkt mit Rabatt fÃŒr Test Rundungen (Rabatt muÃ aktiv sein)',
+					'tests' => array(
+							'sum/mwst' => array(false, 0),
+							'sum/preis_netto' => array(false, 45),
+							'sum/preis_brutto' => array(false, 45),
+							'sum/preis' => array(false, 45),
+							'sum/preis_gesamt_netto' => array(false, 45),
+							'sum/preis_gesamt_brutto' => array(false, 45),
+							'sum/preis_gesamt' => array(false, 45)
+					),
+					'array' => $this->shop->basket->toArray(),
+					'config' => $this->showConfiguration()
+			);
+		
+		}
+		
+		/**
+		 * Zeigt wichtige Einstellungen an, die fÃŒr den Test sinnvoll sind
+		 */
+		public function showConfiguration()
+		{
+			
+			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_test/showConfiguration.phtml', false);
+			
+		} // public function showConfiguration()
+		
+		/**
+		 * Gibt true zurck wenn der gesamte Test erfolgreich war
+		 * @param unknown_type $test
+		 */
+		public function checkTest($test)
+		{
+						
+			foreach ($test['tests'] as $key => $t)
+			{
+				
+				$bTest = $this->checkValue($key, $t[1], $test['array']);
+				if ($bTest === false) return false;
+				
+			}
+			
+			return true;
+			
+		} // public function checkTest($test)
+		
+		/**
+		 * PrÃŒft einen einzelnen Wert in einem Array
+		 * key kann dabei die Syntax: sum/mwst haben und greift dann auf $array['sum']['mwst'] zu um den Wert zu ermitteln
+		 */
+		public function checkValue($key, $value, $array)
+		{
+			
+			return $this->checkEqual($this->getValue($key, $array), $value);
+			
+		} // public function checkValue($key, $array)
+		
+		/**
+		 * Gibt einen Wert aus dem Array zurÃŒck anhand des key
+		 */
+		public function getValue($key, $array)
+		{
+			
+			$arKeys = wpsg_trim(explode('/', $key));
+			
+			foreach ($arKeys as $k)
+			{
+				
+				$array = $array[$k];
+				
+			}
+			
+			return $array;
+			
+		} // public function getValue($key, $array)
+		
+		/**
+		 * PrÃŒft zwei Werte ob sie gleich sind
+		 */
+		public function checkEqual($value1, $value2)
+		{
+			
+			if (strval($value1) == strval($value2)) return true;
+			
+			return false;
+			
+		} // public function checkEqual($value1, $value2)
+		 
+	} // class wpsg_mod_test extends wpsg_mod_basic
+
+?>
Index: /system/intern/views/mod_funding/product_bottom.phtml
===================================================================
--- /system/intern/views/mod_funding/product_bottom.phtml	(revision 6510)
+++ /system/intern/views/mod_funding/product_bottom.phtml	(revision 6510)
@@ -0,0 +1,20 @@
+<?php
+
+	/**
+	 * Template welches unterhalb des Produkttemplates eingebunden wird
+	 */
+
+?>
+<?php if ($this->view['wpsg_mod_funding']['state'] === wpsg_mod_funding::STATE_COMPLETED) { ?>
+<div id="wpsg_message" class="published updated">
+	<p><?php echo __('Die Finanzierung dieses Produktes ist erfolgreich durchgefÃŒhrt worden.', 'wpsg'); ?><br /><?php echo __('Aktuell kann es nicht mehr erworben werden.', 'wpsg'); ?></p>
+</div>
+<?php } else if ($this->view['wpsg_mod_funding']['state'] === wpsg_mod_funding::STATE_NOTSTARTET) { ?>
+<div id="wpsg_error" class="published error">
+	<p><?php echo __('Die Finanzierung dieses Produktes ist noch nicht gestartet.', 'wpsg'); ?><br /><?php echo __('Aktuell kann es nicht erworben werden.', 'wpsg'); ?></p>
+</div>
+<?php } else if ($this->view['wpsg_mod_funding']['state'] === wpsg_mod_funding::STATE_CLOSED) { ?>
+<div id="wpsg_error" class="published error">
+	<p><?php echo __('Die Finanzierung dieses Produktes ist abgeschlossen.', 'wpsg'); ?><br /><?php echo __('Aktuell kann es nicht erworben werden.', 'wpsg'); ?></p>
+</div>
+<?php } ?>
Index: /system/intern/views/mod_funding/product_edit_sidebar.phtml
===================================================================
--- /system/intern/views/mod_funding/product_edit_sidebar.phtml	(revision 6510)
+++ /system/intern/views/mod_funding/product_edit_sidebar.phtml	(revision 6510)
@@ -0,0 +1,48 @@
+<?php
+
+	/**
+	 * Template fÃŒr die Integration in die Produktverwaltung
+	 */
+
+?><div id="wpsg_funding" class="postbox">	
+	<h3 class="wpsg_handlediv">
+		<span title="<?php echo __('Zum Ein/Ausklappen hier klicken', 'wpsg'); ?>" class="handlediv"><br /></span>
+		<span><?php echo __('Finanzierungsprodukt', 'wpsg'); ?> </span>
+	</h3>
+	<div class="inside">
+	
+		<?php if (wpsg_isSizedInt($_REQUEST['edit_id'])) { ?>
+		
+		<input type="hidden" name="wpsg_mod_funding_save" value="1" />
+		
+		<?php echo wpsg_drawForm_Checkbox('wpsg_mod_funding[activ]', __('Finanzierungsprodukt', 'wpsg'), wpsg_getStr($this->view['wpsg_mod_funding']['activ']), array('id' => 'wpsg_mod_funding_activ')); ?>
+		
+		<div id="wpsg_mod_funding_activ_layer">
+		
+			<?php echo wpsg_drawForm_Input('wpsg_mod_funding[start]', __('Start der Runde', 'wpsg'), wpsg_getStr($this->view['wpsg_mod_funding']['start']), array('datepicker' => true)); ?>
+			<?php echo wpsg_drawForm_Input('wpsg_mod_funding[end]', __('Ende der Runde', 'wpsg'), wpsg_getStr($this->view['wpsg_mod_funding']['end']), array('datepicker' => true)); ?>
+			<?php echo wpsg_drawForm_Input('wpsg_mod_funding[limit]', __('MÃ¶gliche Bestellungen', 'wpsg'), ((wpsg_isSizedInt($this->view['wpsg_mod_funding']['limit']))?$this->view['wpsg_mod_funding']['limit']:'10')); ?>
+		
+		</div>
+		
+		<script type="text/javascript">/* <![CDATA[ */
+
+			jQuery(document).ready(function() {
+
+				jQuery('#wpsg_mod_funding_activ').bind('change', function() {
+
+					if (jQuery(this).is(':checked')) jQuery('#wpsg_mod_funding_activ_layer').show();
+					else jQuery('#wpsg_mod_funding_activ_layer').hide();
+					
+				} ).change();
+				
+			} );
+        
+		/* ]]> */</script>
+		
+		<?php } else { ?>
+		<p><?php echo __('Das Produkt muss einmalig gespeichert werden bevor die Option "Finanzierungsprodukt" aktiviert werden kann.', 'wpsg'); ?></p>
+		<?php } ?>
+	
+	</div>	
+</div>
Index: /system/intern/views/mod_funding/product_top_afterheadline.phtml
===================================================================
--- /system/intern/views/mod_funding/product_top_afterheadline.phtml	(revision 6510)
+++ /system/intern/views/mod_funding/product_top_afterheadline.phtml	(revision 6510)
@@ -0,0 +1,19 @@
+<?php
+
+	/**
+	 * Template fÃŒr die Integration des CrowdFunding Produktes
+	 */
+
+?>
+<div class="wpsg_mod_funding_progress">
+
+	<div class="wpsg_mod_funding_label">
+		<strong><?php echo __('Status der Finanzierung', 'wpsg'); ?>:</strong>&nbsp;<?php echo $this->view['wpsg_mod_funding']['stateLabel']; ?>
+	</div>
+
+	<div class="wpsg_mod_funding_state">
+		<div class="bar"><div class="value wpsg_mod_funding_state_value" data-wpsg-funding-width="<?php echo ceil($this->view['wpsg_mod_funding']['currentFundingCount'] / $this->view['wpsg_mod_funding']['maxFundingCount'] * 100); ?>"></div></div>
+		<div class="value"><?php echo $this->view['wpsg_mod_funding']['currentFundingCount'].'/'.$this->view['wpsg_mod_funding']['maxFundingCount']; ?></div>
+	</div>
+
+</div>
Index: /system/intern/views/mod_funding/settings_edit.phtml
===================================================================
--- /system/intern/views/mod_funding/settings_edit.phtml	(revision 6510)
+++ /system/intern/views/mod_funding/settings_edit.phtml	(revision 6510)
@@ -0,0 +1,7 @@
+<?php
+
+	/**
+	 * Template fÃŒr die Einstellungen des Moduls "Crowdfunding"
+	 */
+
+?>
Index: /system/intern/views/mod_test/settings_edit.phtml
===================================================================
--- /system/intern/views/mod_test/settings_edit.phtml	(revision 6510)
+++ /system/intern/views/mod_test/settings_edit.phtml	(revision 6510)
@@ -0,0 +1,77 @@
+<?php
+
+	/**
+	 * Template fÃŒr die Modulkonfiguration des Testmoduls
+	 */
+
+?>
+
+<br />
+
+<?php foreach ((array)$this->view['test'] as $test_index => $test) { ?>
+<div class="wpsg_admin_box" id="wpsg_mod_test_<?php echo $test_index; ?>" style="width:1000px;">
+	<div id="test_1" class="head" style="border-bottom: 0px none;">
+		<div class="title">
+			<div class="fulltab">
+				<?php echo ($test_index + 1); ?>. Test - <?php echo $test['label']; ?>
+				<?php if ($this->callMod('wpsg_mod_test', 'checkTest', array($test)) === true) { ?>
+				<img src="<?php echo WPSG_URL_CONTENT; ?>plugins/<?php echo WPSG_FOLDERNAME; ?>/views/css/../gfx/tick.png" alt="" style="float:right;" />
+				<?php } ?>
+			</div>
+		</div>
+		<div class="content wpsg_mod_test_table wpsg_admin_box_content" style="display: block;">
+			
+			<?php echo $test['config']; ?>
+			
+			<table>
+				<thead>
+					<tr>
+						<th>Name</th>
+						<th>Erwarteter Wert</th>
+						<th>Getesteter Wert</th>
+						<th></th>
+					</tr>
+				</thead>
+				<tbody>
+					<?php foreach ($test['tests'] as $key => $t) { ?>
+					<tr>
+						<td>
+							<?php if ($t[0] === false) { ?>
+							<?php echo $this->view['arKeyLabel'][$key]; ?>
+							<?php } else { ?>
+							<?php echo $t[0]; ?>
+							<?php } ?>
+						</td>
+						<td><?php echo $t[1]; ?></td>
+						<td><?php echo $this->callMod('wpsg_mod_test', 'getValue', array($key, $test['array'])); ?></td>
+						<td>
+							<?php if ($this->callMod('wpsg_mod_test', 'checkValue', array($key, $t[1], $test['array'])) === true) { ?>
+							<img src="<?php echo WPSG_URL_CONTENT; ?>plugins/<?php echo WPSG_FOLDERNAME; ?>/views/css/../gfx/tick.png" alt="" />
+							<?php } ?>						
+						</td>
+					</tr>
+					<?php } ?>
+				</tbody>
+			</table>
+			
+			<?php if (wpsg_isSizedArray($test['array'])) { ?>
+			<br /><a href="" onclick="jQuery(this).next().toggle(); return false;">Array anzeigen/verbergen</a>
+			<div style="display:none; border:1px solid #CCCCCC; background-color:#FFFFFF; margin-top:15px;">
+				<pre><?php print_r($test['array']); ?></pre>
+			</div>
+			<?php } ?>
+			
+		</div>
+	</div>
+</div><br />
+<?php } ?>
+
+<script type="text/javascript">/* <![CDATA[ */
+
+	jQuery(document).ready(function() {
+
+		jQuery('.wpsg_admin_box').wpsg_adminbox();
+		
+	} );
+
+/* ]]> */</script>
Index: /system/intern/views/mod_test/showConfiguration.phtml
===================================================================
--- /system/intern/views/mod_test/showConfiguration.phtml	(revision 6510)
+++ /system/intern/views/mod_test/showConfiguration.phtml	(revision 6510)
@@ -0,0 +1,11 @@
+<?php
+
+	/**
+	 * Zeigt wichtige Einstellungen an, die fÃŒr den Test wichtig sind
+	 */
+
+?>
+<?php echo wpsg_drawForm_Input('', 'Preise im Backend', (($this->get_option('wpsg_preisangaben') == WPSG_NETTO)?'Netto':'Brutto'), array('text' => true)); ?>
+<?php echo wpsg_drawForm_Input('', 'Preise im Frontend', (($this->getFrontendTaxview() == WPSG_NETTO)?'Netto':'Brutto'), array('text' => true)); ?>
+<?php echo wpsg_drawForm_Input('', 'Kleinunternehmerregelung', (($this->get_option('wpsg_kleinunternehmer') == '1')?'An':'Aus'), array('text' => true)); ?>
+<br />
Index: /views/mods/mod_productvariants/settings_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/settings_edit.phtml	(revision 6508)
+++ /views/mods/mod_productvariants/settings_edit.phtml	(revision 6510)
@@ -22,4 +22,5 @@
 			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_productvariants_price', __('Preis der Variation direkt anzeigen'), $this->get_option('wpsg_mod_productvariants_price')); ?>
 			<?php echo wpsg_drawForm_Checkbox('wpsg_vp_detailview', __('Erweiterte Variantenanzeige aktivieren', 'wpsg'), $this->get_option('wpsg_vp_detailview'), array('help' => 'wpsg_vp_detailview')); ?>
+			<?php echo wpsg_drawForm_Checkbox('wpsg_vp_replaceanr', __('Produktartikelnummer ersetzen', 'wpsg'), $this->get_option('wpsg_vp_replaceanr'), array('hint' => __('Ersetzt die Produktartikelnummer durch die zusammengesetzte Artikelnummern der Varianten.', 'wpsg'), 'help' => 'wpsg_vp_replaceanr')); ?>
 			
 		</div>
