Index: /changelog
===================================================================
--- /changelog	(revision 7842)
+++ /changelog	(revision 7844)
@@ -430,2 +430,3 @@
 - Bugfix: Kundenkontekt - Template repariert fÃŒr "Zahlungserinnerung"
 - Bugfix: Korrektur beim speichern des Mindestbestellwertes
+- Bugfix: User_Views ignorieren und Theme Probleme damit behoben
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7842)
+++ /controller/wpsg_ShopController.class.php	(revision 7844)
@@ -1697,4 +1697,6 @@
 			$this->callMods('renderProdukt_templateSelect', array(&$this->view['data'], &$template_file));
 
+			$wpsg_ignoreuserview = $this->get_option('wpsg_ignoreuserview');
+
 			// Das Template im UserView suchen
 			$template_file_child_theme = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_CTV, $template_file);
@@ -1703,9 +1705,9 @@
             $template_file_uv_old = str_replace(WPSG_PATH_PRODUKTTEMPLATES, WPSG_PATH_PRODUKTTEMPLATES_UV_OLD, $template_file);
 
-            if (file_exists($template_file_child_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_child_theme;
-			else if (file_exists($template_file_theme) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_theme;
-			else if (file_exists($template_file_uv) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv;
-			else if (file_exists($template_file_uv_old) && $this->get_option('wpsg_ignoreuserview') != '1') $template_file = $template_file_uv_old;
-			else if ($this->get_option('wpsg_ignoreuserview') != '1') {
+            if (file_exists($template_file_child_theme) && $wpsg_ignoreuserview != '1') $template_file = $template_file_child_theme;
+			else if (file_exists($template_file_theme) && $wpsg_ignoreuserview != '1') $template_file = $template_file_theme;
+			else if (file_exists($template_file_uv) && $wpsg_ignoreuserview != '1') $template_file = $template_file_uv;
+			else if (file_exists($template_file_uv_old) && $wpsg_ignoreuserview != '1') $template_file = $template_file_uv_old;
+			else if ($wpsg_ignoreuserview != '1') {
 				
 				$arTemplate = $this->loadProduktTemplates(false, true);
@@ -1719,5 +1721,9 @@
 			}
 			
-			if (!is_file($template_file)) { wpsg_debug(wpsg_translate(__('Das Template (#1#) fÃŒr ein Produkt (ID:#2#) scheint nicht zu existieren!', 'wpsg'), $template_file, $produkt_id)); return; }
+			if (!is_file($template_file)) {
+
+				wpsg_debug(wpsg_translate(__('Das Template (#1#) fÃŒr ein Produkt (ID:#2#) scheint nicht zu existieren!', 'wpsg'), $template_file, $produkt_id)); return;
+
+			}
 
 			// Den Index fÃŒr getTemplateIndex hochzÃ€hlen
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 7842)
+++ /controller/wpsg_SystemController.class.php	(revision 7844)
@@ -614,6 +614,5 @@
 		} // public function getRessourceURL($path)
 
-        public function getTemplatefile($file)
-        {
+        public function getTemplatefile($file) {
 
             // Da die views jetzt im Pluginverzeichnis liegen suche ich den (.*)view Teil
@@ -626,10 +625,19 @@
             $child_theme_file = str_replace($path_view, WPSG_PATH_CHILD_TEMPLATEVIEW, $file);
 
-            if (file_exists($child_theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $child_theme_file;
-            else if (file_exists($theme_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $theme_file;
-            else if (file_exists($uv_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_file;
-            else if (file_exists($uv_old_file) && $this->get_option('wpsg_ignoreuserview') != '1') $render_file = $uv_old_file;
+            $wpsg_ignoreuserview = $this->get_option('wpsg_ignoreuserview');
+
+            if (file_exists($child_theme_file) && $wpsg_ignoreuserview != '1') $render_file = $child_theme_file;
+            else if (file_exists($theme_file) && $wpsg_ignoreuserview != '1') $render_file = $theme_file;
+            else if (file_exists($uv_file) && $wpsg_ignoreuserview != '1') $render_file = $uv_file;
+            else if (file_exists($uv_old_file) && $wpsg_ignoreuserview != '1') $render_file = $uv_old_file;
             else if (file_exists($file)) $render_file = $file;
-            else throw new \wpsg\Exception(wpsg_translate(__('Template (#1#) Datei nicht gefunden', 'wpsg'), $file), \wpsg\Exception::TYP_UNEXPECTED);
+            else if (file_exists($theme_file)) $render_file = $theme_file;
+            else {
+
+
+
+            	throw new \wpsg\Exception(wpsg_translate(__('Template (#1#) Datei nicht gefunden', 'wpsg'), $file), \wpsg\Exception::TYP_UNEXPECTED);
+
+            }
 
             // Ich lasse nur Dateien unterhalb von wp-content zu aus SicherheitsgrÃŒnden
@@ -647,6 +655,5 @@
 		 * Zeigt eine Template Datei an
 		 */
-		public function render($file, $out = true)
-		{
+		public function render($file, $out = true) {
 
 			// Ticket #572 doppelte Slash stÃ¶ren
@@ -663,6 +670,5 @@
 			if ($this->get_option('wpsg_displayTemplatesLog') > 0) wpsg_debug_console($this->clearPathForDebug($render_file));
 			
-			if (!is_admin() && $this->get_option('wpsg_displayTemplates') > 0)
-			{
+			if (!is_admin() && $this->get_option('wpsg_displayTemplates') > 0) {
 				
 				echo '<div style="display:inline-block; box-shadow: inset 0px 0px 0px 1px #003C6A; position:relative;">';			
@@ -673,6 +679,5 @@
 			include $render_file;
 			
-			if (!is_admin() && $this->get_option('wpsg_displayTemplates') > 0)
-			{
+			if (!is_admin() && $this->get_option('wpsg_displayTemplates') > 0) {
 				
 				echo '</div>';
Index: /lib/wpsg_imagehandler.class.php
===================================================================
--- /lib/wpsg_imagehandler.class.php	(revision 7842)
+++ /lib/wpsg_imagehandler.class.php	(revision 7844)
@@ -118,5 +118,5 @@
 		 * @throws \wpsg\Exception
 		 */
-		public function getAttachmentIDs($product_key, $vari_id = false, $all = false) {
+		public function getAttachmentIDs($product_key, $vari_id = false, $all = false, $hideGlobalVariationImages = false) {
 			
 			$product_id = $this->shop->getProduktID($product_key);
@@ -198,6 +198,5 @@
 					$arAttachmentIDsReturn = array();
 					
-					foreach ($arSet as $attachment_id)
-					{
+					foreach ($arSet as $attachment_id) {
 						
 						if (array_search($attachment_id, $arAttachmentIDs)) $arAttachmentIDsReturn[] = $attachment_id;
@@ -211,14 +210,18 @@
 			} else if ($this->shop->hasMod('wpsg_mod_productvariants') && $this->shop->callMod('wpsg_mod_productvariants', 'isVariantsProduct', array($product_key))) {
 
-				// Globale Bilder hinzufÃŒgen
-				$vari_data = $this->shop->callMod('wpsg_mod_productvariants', 'getVariants', [$this->shop->getProduktID($product_key), true, true, true]);
-
-				foreach ($vari_data as $variant_id => $variant_data) {
-
-					foreach ($variant_data['arVariation'] as $variation_id => $variation_data) {
-
-						$arAttachmentIDs = wpsg_trim(array_unique(array_merge(
-							$arAttachmentIDs, $variation_data['images_global']
-						)));
+				if (!$hideGlobalVariationImages) {
+
+					// Globale Bilder hinzufÃŒgen
+					$vari_data = $this->shop->callMod('wpsg_mod_productvariants', 'getVariants', [$this->shop->getProduktID($product_key), true, true, true]);
+
+					foreach ($vari_data as $variant_id => $variant_data) {
+
+						foreach ($variant_data['arVariation'] as $variation_id => $variation_data) {
+
+							$arAttachmentIDs = wpsg_trim(array_unique(array_merge(
+								$arAttachmentIDs, $variation_data['images_global']
+							)));
+
+						}
 
 					}
Index: /mods/wpsg_mod_minrequest.class.php
===================================================================
--- /mods/wpsg_mod_minrequest.class.php	(revision 7842)
+++ /mods/wpsg_mod_minrequest.class.php	(revision 7844)
@@ -62,9 +62,7 @@
 		 * zeigt die Staffelpreise im Produktbackend an
 		 */
-		public function product_addedit_content(&$product_content, &$product_data)
-		{
-		    
-		    if (wpsg_isSizedInt($product_data['id']))
-		    {
+		public function product_addedit_content(&$product_content, &$product_data) {
+		    
+		    if (wpsg_isSizedInt($product_data['id'])) {
 		        
 		        $product_data = wpsg_array_merge($product_data, $this->db->fetchRow("
@@ -76,12 +74,12 @@
 							`id` = '".wpsg_q($product_data['id'])."'
 					"));
-		        
+
+			    $product_data['arMinrequest_value'] = explode(',', $this->shop->get_option('wpsg_mod_minrequest_value'));
+			    $product_data['arMinrequest_valuemax'] = explode(',', $this->shop->get_option('wpsg_mod_minrequest_valuemax'));
+
+	            $product_content['price']['content'] .= $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_minrequest/produkt_addedit_allgemein.phtml', false);
+
 		    }
 		    
-		    $product_data['arMinrequest_value'] = explode(',', $this->shop->get_option('wpsg_mod_minrequest_value'));
-		    $product_data['arMinrequest_valuemax'] = explode(',', $this->shop->get_option('wpsg_mod_minrequest_valuemax'));
-            $product_content['price']['content'] .= $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_minrequest/produkt_addedit_allgemein.phtml', false);
-		     
-		    
 		}//public function product_addedit_content(&$product_content, &$product_data)
 		
@@ -89,8 +87,7 @@
 		public function produkt_edit_allgemein(&$produkt_data) {
 
-
-		    $this->shop->view['wpsg_mod_minrequest']['product_activ'] = $produkt_data['wpsg_mod_minrequest_product_activ'];
-		    $this->shop->view['wpsg_mod_minrequest']['value'] = $produkt_data['wpsg_mod_minrequest_value'];
-		    $this->shop->view['wpsg_mod_minrequest']['valuemax'] = $produkt_data['wpsg_mod_minrequest_valuemax'];
+		    $this->shop->view['wpsg_mod_minrequest']['product_activ'] = $produkt_data['wpsg_mod_minrequest_product_activ']??'0';
+		    $this->shop->view['wpsg_mod_minrequest']['value'] = $produkt_data['wpsg_mod_minrequest_value']??'';
+		    $this->shop->view['wpsg_mod_minrequest']['valuemax'] = $produkt_data['wpsg_mod_minrequest_valuemax']??'';
 		    
 		    //$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_minquantity/produkt_edit_allgemein.phtml');
@@ -99,8 +96,8 @@
 		
 		public function produkt_save_before(&$produkt_data) {
-			
-			wpsg_checkRequest('wpsg_mod_minrequest_product_activ', [WPSG_SANITIZE_CHECKBOX], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['product_activ']);
-			wpsg_checkRequest('wpsg_mod_minrequest_value', [WPSG_SANITIZE_FLOAT], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['value']);
-			wpsg_checkRequest('wpsg_mod_minrequest_valuemax', [WPSG_SANITIZE_FLOAT], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['valuemax']);
+
+			wpsg_checkRequest('wpsg_mod_minrequest_product_activ', [WPSG_SANITIZE_CHECKBOX, ['allowEmpty' => true]], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['product_activ']);
+			wpsg_checkRequest('wpsg_mod_minrequest_value', [WPSG_SANITIZE_FLOAT, ['allowEmpty' => true]], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['value']);
+			wpsg_checkRequest('wpsg_mod_minrequest_valuemax', [WPSG_SANITIZE_FLOAT, ['allowEmpty' => true]], __('Minimalbestand Aktiv'), $produkt_data, $_REQUEST['wpsg_mod_minrequest']['valuemax']);
 
 		} // public function produkt_save_before(&$produkt_data)
Index: /mods/wpsg_mod_paypal.class.php
===================================================================
--- /mods/wpsg_mod_paypal.class.php	(revision 7842)
+++ /mods/wpsg_mod_paypal.class.php	(revision 7844)
@@ -689,13 +689,13 @@
 		} // public fucntion executePaymentRedirect()
 		
-		private function getPaymentState($order_id)
-		{
+		private function getPaymentState($order_id) {
 		
 			$oOrder = wpsg_order::getInstance($order_id);
-				
-			if (!wpsg_isSizedString($oOrder->getMeta('wpsg_mod_paypal_paymentid'))) return false;
-				
-			try
-			{
+
+			$wpsg_mod_paypal_paymentid = $oOrder->getMeta('wpsg_mod_paypal_paymentid');
+
+			if (!wpsg_isSizedString($wpsg_mod_paypal_paymentid)) return false;
+				
+			try {
 					
 				$payment = \PayPal\Api\Payment::get($oOrder->getMeta('wpsg_mod_paypal_paymentid'), $this->getApiContext());
@@ -705,7 +705,5 @@
 				return $payment->getState();
 		
-			}
-			catch (Exception $e)
-			{
+			} catch (Exception $e) {
 		
 				return false;
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 7842)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 7844)
@@ -1838,17 +1838,14 @@
 		/**
 		 * Gibt true zurÃŒck, wenn der ÃŒbergebene Produktkey ein Varianten Produktkey ist. Sonst false.
-		 * @param \String $productkey
+		 *
+		 * @param \String $product_key
 		 */
-		public function isVariantsProductKey($productkey)
-		{
-
-			if (preg_match('/^pv_\d+/', $productkey))
-			{
+		public function isVariantsProductKey($product_key) {
+
+			if (preg_match('/^pv_\d+/', $product_key)) {
 
 				return true;
 
-			}
-			else
-			{
+			} else {
 
 				return false;
Index: /mods/wpsg_mod_productvars.class.php
===================================================================
--- /mods/wpsg_mod_productvars.class.php	(revision 7842)
+++ /mods/wpsg_mod_productvars.class.php	(revision 7844)
@@ -404,8 +404,8 @@
 		}
 
-		public function basket_row(&$p, $i)
-		{
-			if ($this->shop->get_option('wpsg_mod_productvars_showBasket') === '1')
-			{ 
+		public function basket_row(&$p, $i) {
+
+			if ($this->shop->get_option('wpsg_mod_productvars_showBasket') === '1') {
+
 				$produkt_id = $this->shop->basket->getProduktDBID($p['id']);
 	
Index: /mods/wpsg_mod_produktartikel.class.php
===================================================================
--- /mods/wpsg_mod_produktartikel.class.php	(revision 7842)
+++ /mods/wpsg_mod_produktartikel.class.php	(revision 7844)
@@ -693,5 +693,5 @@
         public function produkt_save(&$product_id) {
 
-            if (isset($_REQUEST['wpsg_mod_produktartikel'])) $comment = wpsg_sinput("key", $_REQUEST['wpsg_mod_produktartikel']['kommentare']); else $comment = false;
+            if (isset($_REQUEST['wpsg_mod_produktartikel'])) $comment = sanitize_text_field($_REQUEST['wpsg_mod_produktartikel']['kommentare']??''); else $comment = false;
     
             $this->getPostIdFromProductId($product_id, $_REQUEST['wpsg_mod_produktartikel']['path'], $comment, wpsg_sinput("key", $_REQUEST['wpsg_produktartikel_menuorder']), true, wpsg_sinput("key", @$_REQUEST['disabled']));
Index: /mods/wpsg_mod_stock.class.php
===================================================================
--- /mods/wpsg_mod_stock.class.php	(revision 7842)
+++ /mods/wpsg_mod_stock.class.php	(revision 7844)
@@ -135,10 +135,10 @@
 	
 		public function produkt_save_before(&$product_data) {
-			
+
 			wpsg_checkRequest('stock', [WPSG_SANITIZE_INT, ['allowEmpty' => true]], __('Lagerbestand'),$product_data, $_REQUEST['wpsg_mod_stock_stock']);
-			wpsg_checkRequest('stock_count', [WPSG_SANITIZE_CHECKBOX], __('Lagerbestand zÃ€hlen'), $product_data, $_REQUEST['wpsg_mod_stock_stock_count']);
+			wpsg_checkRequest('stock_count', [WPSG_SANITIZE_CHECKBOX, ['allowEmpty' => true]], __('Lagerbestand zÃ€hlen'), $product_data, $_REQUEST['wpsg_mod_stock_stock_count']);
 			wpsg_checkRequest('minstockproduct_count', [WPSG_SANITIZE_INT, ['allowEmpty' => true]], __('Mindestlagerbestand zÃ€hlen'), $product_data, $_REQUEST['wpsg_mod_minstockproduct']);
 			wpsg_checkRequest('minstockproduct_mail', [WPSG_SANITIZE_EMAIL, ['allowEmpty' => true]], __('Lagerbestand / Benachrichtigung an'), $product_data, $_REQUEST['wpsg_mod_stock_minstockproduct_mail']);
-			 
+
 		}
 		
@@ -406,5 +406,5 @@
 		public function product_addedit_content(&$product_content, &$product_data) {
 
-			if (isset($_REQUEST['wpsg_lang'])) return;
+			if (isset($_REQUEST['wpsg_lang']) || !wpsg_isSizedInt($_REQUEST['edit_id'])) return;
 
             $this->shop->view['data'] = $product_data;
@@ -466,5 +466,5 @@
 		 * Gibt den aktuellen Bestand fÃŒr ein Produkt zurÃŒck
 		 */
-		public function getBestand($produkt_key) {
+		public function getBestand($product_key) {
 
 			$arStock = array();
@@ -472,5 +472,5 @@
 			if ($this->shop->hasMod('wpsg_mod_productgroups')) {
 
-				$product_id = $this->shop->getProduktID($produkt_key);
+				$product_id = $this->shop->getProduktID($product_key);
 				$product_data = $this->shop->cache->loadProduct($product_id);
                 
@@ -489,16 +489,16 @@
 			}
 
-			if (is_numeric($produkt_key)) {
+			if (is_numeric($product_key)) {
 
 				// Lagerbestand in der Datenbank
-				$arStock[] = $this->db->fetchOne("SELECT P.`stock` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`id` = '".wpsg_q($produkt_key)."'");
-
-			} else if ($this->shop->hasMod('wpsg_mod_productvariants') && $this->shop->callMod('wpsg_mod_variants', 'isVariantsProductKey', [$produkt_key])) {
- 
-				$arStock[] = $this->shop->callMod('wpsg_mod_productvariants', 'getStockForVariation', [$produkt_key]);
-
-			} else if ($this->shop->hasMod('wpsg_mod_abo') && $this->shop->callMod('wpsg_mod_abo', 'isAboExtensionProductKey', [$produkt_key])) {
-			    
-			    $product_id = $this->shop->callMod('wpsg_mod_abo', 'getProductIDFromAboExtensionProductKey', [$produkt_key]);
+				$arStock[] = $this->db->fetchOne("SELECT P.`stock` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`id` = '".wpsg_q($product_key)."'");
+
+			} else if ($this->shop->hasMod('wpsg_mod_productvariants') && $this->shop->callMod('wpsg_mod_productvariants', 'isVariantsProductKey', [$product_key])) {
+
+				$arStock[] = $this->shop->callMod('wpsg_mod_productvariants', 'getStockForVariation', [$product_key]);
+
+			} else if ($this->shop->hasMod('wpsg_mod_abo') && $this->shop->callMod('wpsg_mod_abo', 'isAboExtensionProductKey', [$product_key])) {
+
+			    $product_id = $this->shop->callMod('wpsg_mod_abo', 'getProductIDFromAboExtensionProductKey', [$product_key]);
 
                 $arStock[] = $this->db->fetchOne("SELECT P.`stock` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`id` = '".wpsg_q($product_id)."'");
Index: /views/mods/mod_deliverytime/basket_row.phtml
===================================================================
--- /views/mods/mod_deliverytime/basket_row.phtml	(revision 7842)
+++ /views/mods/mod_deliverytime/basket_row.phtml	(revision 7844)
@@ -7,6 +7,5 @@
 ?>
 <div class="product_info">
-	<div 
-	<?php if ($this->view['$bPicture'] == true) { ?>class="titlep"><?php } else { ?>class="title"><?php } ?>
+	<div class="title">
 		<span class="fa fa-truck"></span>
 		<?php echo __("Lieferzeit", "wpsg"); ?>:
Index: /views/mods/mod_productvars/basket_row.phtml
===================================================================
--- /views/mods/mod_productvars/basket_row.phtml	(revision 7842)
+++ /views/mods/mod_productvars/basket_row.phtml	(revision 7844)
@@ -9,6 +9,5 @@
 <?php foreach ($this->view['wpsg_mod_productvars']['data'] as $pv) { ?>
 <div class="product_info">
-	<div 
-	<?php if ($this->view['$bPicture'] == true) { ?>class="titlep"><?php } else { ?>class="title"><?php } ?>
+	<div class="title">
 		<?php echo __($pv['name'], 'wpsg'); ?><?php if ($pv['pflicht'] == '1') { ?><span class="wpsg_required">*</span><?php } ?>
 	</div>
Index: /views/mods/mod_produktattribute/basket_row.phtml
===================================================================
--- /views/mods/mod_produktattribute/basket_row.phtml	(revision 7842)
+++ /views/mods/mod_produktattribute/basket_row.phtml	(revision 7844)
@@ -9,6 +9,5 @@
 <?php foreach ((array)$this->view['wpsg_mod_produktattribute']['data'] as $pa_id) { ?>
 <div class="product_info">
-	<div 
-	<?php if ($this->view['$bPicture'] == true) { ?>class="titlep"><?php } else { ?>class="title"><?php } ?>
+	<div class="title">
 		<span class="fa fa-ellipsis-v"></span>
 		<?php echo $this->callMod('wpsg_mod_produktattribute', 'getAttributeLabel', array($pa_id)); ?>:
