Index: /changelog
===================================================================
--- /changelog	(revision 8250)
+++ /changelog	(revision 8251)
@@ -555,4 +555,5 @@
 - Feature: standard3.phtml (Slider und Zoom)
 - Feature: PHP 8.2 kompatibilitÃ€t
+- Feature: EAN fÃŒr Variationen (Produktvarianten)
 - Feature: Exportprofil kann nun stÃŒndlich mit dem Wordpress Cron ausgefÃŒhrt werden
 - Feature: Suche nach Rechnungen in Bestellverwaltung durch DatenbankÃ€nderung angepasst
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 8250)
+++ /controller/wpsg_ShopController.class.php	(revision 8251)
@@ -2413,5 +2413,13 @@
 			    
 			}
-			 
+			
+			if (isset($_REQUEST['set_product_key'])) {
+				
+				// ?set_product_key=pv_{product_id}|{variant_id}:{variation_id}
+				$produkt['product_key'] = $_REQUEST['set_product_key'];
+				$produkt['produkt_id'] = $this->getProduktID($produkt['product_key']);
+				
+			}
+			
 			$this->callMods('loadProduktArray', array(&$produkt));
 
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 8250)
+++ /lib/functions.inc.php	(revision 8251)
@@ -1670,5 +1670,5 @@
 	{
 		
-		$arData = explode($del, $value);
+		$arData = explode($del, ($value??''));
 		
 		foreach ($arData as $k => $v)
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 8250)
+++ /model/wpsg_product.class.php	(revision 8251)
@@ -183,5 +183,19 @@
 		public function getEAN() {
 
-			return $this->__get('ean');
+			$shop = wpsg_ShopController::getShop();
+			
+			if ($shop->callMod('wpsg_mod_productvariants', 'isVariantsProductKey', [$this->getProductKey()])) {
+				
+				if ($shop->get_option('wpsg_mod_produktartikel_ean') === '1') {
+					
+					$ean_vari = $shop->callMod('wpsg_mod_productvariants', 'getEAN', [$this->getProductKey()]);
+					
+					if ($ean_vari !== '') return $ean_vari;
+					
+				}
+				
+			}
+			
+			return $this->__get('ean').$this->getProductKey();
 
 		}
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 8250)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 8251)
@@ -66,5 +66,6 @@
 				name varchar(255) NOT NULL,
 				shortname varchar(255) NOT NULL,
-				anr varchar(255) NOT NULL,				 
+				anr varchar(255) NOT NULL,
+				ean text NOT NULL COMMENT 'EAN der Variation',
 				deleted int(1) NOT NULL,
 				pos int(11) NOT NULL,
@@ -1453,19 +1454,23 @@
 
 			} else if (wpsg_isSizedString($_REQUEST['field'], 'pos')) {
-
-				$i = 0; foreach ($_REQUEST['value'] as $var)
-				{
-
+				
+				$i = 0;
+				foreach ($_REQUEST['value'] as $var) {
+					
 					$var_id = substr($var, 4);
-
+					
 					if (wpsg_isSizedInt($_REQUEST['product_id'])) $this->setProductVariant($_REQUEST['product_id'], $var_id, 'pos', $i);
 					else $this->db->UpdateQuery(WPSG_TBL_VARIANTS, array('pos' => wpsg_q($i)), " `id` = '".wpsg_q($var_id)."' ");
-
-					$i ++;
-
-				}
-
+					
+					$i++;
+					
+				}
+				
 				die('1');
-
+				
+			} else if (wpsg_isSizedString($_REQUEST['field'], 'ean')) {
+				
+				$this->db->UpdateQuery(WPSG_TBL_VARIANTS_VARI, ['ean' => wpsg_q($_REQUEST['value'])], " `id` = '".intval($_REQUEST['field_id'])."' ");
+				
 			} else if (wpsg_isSizedString($_REQUEST['field'], 'template_id') && $this->shop->hasMod('wpsg_mod_downloadplus')) {
 
@@ -1664,4 +1669,6 @@
 
 			if ($this->shop->hasMod('wpsg_mod_downloadplus')) $strQuerySELECT .= " , VI.`template_id` ";
+			
+			$strQuerySELECT .= " , VI.`ean` ";
 
 			$strQuery = "
@@ -1867,4 +1874,12 @@
 				
 		} // public function getProductAnr($product_key, &$anr)
+		
+		public function getEAN($product_key) {
+			
+			$vari_info = $this->getVariantenInfoArray($product_key);
+			
+			return $vari_info['ean']??'';
+			
+		}
 		
 		/**
@@ -2049,5 +2064,5 @@
 							SELECT
 								PVI.*, VI.`images` AS `global_images`,
-								VI.`name`, VI.`shortname`, VI.`deleted`, VI.`pos`
+								VI.`name`, VI.`shortname`, VI.`deleted`, VI.`pos`,  VI.`ean`
 							FROM
 								`".WPSG_TBL_VARIANTS_VARI."` AS VI
@@ -2185,6 +2200,4 @@
 			$vp_data = $this->getVariants($produkt_id, true, true, true);
 
-			//wpsg_debug($vp_data);
-
 			$arReturn = array(
 				'product_id' => $produkt_id
@@ -2227,4 +2240,6 @@
 			$arImages = array_merge($arImages, $arGlobalImages);
 			$arImagesFix = [];
+			
+			$strEAN = '';
 
 			foreach ($arVari as $var_key) {
@@ -2252,4 +2267,5 @@
 				$r = array(
 					'vari_id' => $var_value,
+					'ean' => $vp_data[$var_id]['arVariation'][$var_value]['ean']??'',
 					'name' 	=> $vp_data[$var_id]['name'],
 					'value' => $vp_data[$var_id]['arVariation'][$var_value]['name'],
@@ -2275,4 +2291,5 @@
 				$arReturn[$var_id] = $r;
 
+				$strEAN .= $r['ean'];
 				$arKey[] = $vp_data[$var_id]['arVariation'][$var_value]['name'];
 				$arAKey[] = @$vp_data[$var_id]['arVariation'][$var_value]['anr'];
@@ -2280,4 +2297,5 @@
 			}
 
+			$arReturn['ean'] = $strEAN;
 			$arReturn['key'] = implode(' / ', $arKey);
 			$arReturn['akey'] = implode(' / ', $arAKey);
Index: /views/mods/mod_productvariants/admin_edit.phtml
===================================================================
--- /views/mods/mod_productvariants/admin_edit.phtml	(revision 8250)
+++ /views/mods/mod_productvariants/admin_edit.phtml	(revision 8251)
@@ -304,5 +304,5 @@
 
                         </script>
-
+					
                         <?php if (intval($this->view['product_id']) <= 0) { ?>
                         <span style="padding-left:15px;">
@@ -316,4 +316,20 @@
                     </div>
                     <?php } ?>
+					
+					<div style="margin-top:0.25rem;">
+						<span>EAN:
+							<span title="<?php echo __('EAN der Produktvariation', 'wpsg'); ?>" class="wpsg_editable" id="productvariation_ean_<?php echo $vari['id']; ?>"><?php echo $vari['ean']??''; ?></span>
+						</span>
+						<script>
+
+						jQuery('#productvariation_ean_<?php echo $vari['id']; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_productvariants&subaction=admin_inlineEdit&noheader=1', {
+							submitdata: {
+								field: 'ean',
+								field_id: '<?php echo $vari['id']; ?>'
+							}
+						});
+						
+						</script>
+					</div>
 					
 					<script>
Index: /views/produkttemplates/standard2.phtml
===================================================================
--- /views/produkttemplates/standard2.phtml	(revision 8250)
+++ /views/produkttemplates/standard2.phtml	(revision 8251)
@@ -13,4 +13,12 @@
 	$oProduct = $this->view['oProduct'];
 
+	$var_info = [];
+	
+	if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProductKey', [$oProduct->getProductKey()])) {
+		
+		$var_info = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', [$oProduct->getProductKey()]);
+	 
+	}
+	
 ?>
 
@@ -23,6 +31,8 @@
 
 		<?php if (!$this->titleDisplayed) { ?>
-			<h1 itemprop="name" class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
-			<h2 itemprop="detailname" class="wpsg_productdetailtitle"><?php echo $this->view['data']['detailname']; ?></h2>	
+			<h1 class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
+			<?php if ($this->getProductName($this->view['data']['id']) !== $this->view['data']['detailname']) { ?>
+				<h2 class="wpsg_productdetailtitle"><?php echo $this->view['data']['detailname']; ?></h2>
+			<?php } ?>
 		<?php } ?>
 
@@ -35,4 +45,9 @@
 	<div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
 
+		<meta itemprop="url" content="<?php echo $oProduct->getProductURL().'?test'; ?>" />
+		<meta itemprop="name" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id'])); ?>" />
+		<meta itemprop="detailname" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id']).' / '.rtrim(($var_info['key']??''), ' /')); ?>" />
+		<meta itemprop="sku" content="<?php echo wpsg_hspc($oProduct->getEAN()); ?>" />
+		
 		<?php /* Block fÃŒr die Produktbilder START */ ?>
 		<?php 
