Index: /changelog
===================================================================
--- /changelog	(revision 8427)
+++ /changelog	(revision 8428)
@@ -629,3 +629,4 @@
 - Feature: Suche nach Bestellungen eines speziellen Gutscheins im Backend
 - Feature: InvoiveNr die zu PayPal ÃŒbermittelt wird kann angepasst werden (Es gab einen Kunden bei dem waren die IDs bei PayPal schon vergeben)
+- Feature: Sortierung der ZubehÃ¶rprodukte im Produktbacken
 - Bugfix: Korrektur Gutschein mit % Wert auf Rechnung
Index: /mods/wpsg_mod_relatedproducts.class.php
===================================================================
--- /mods/wpsg_mod_relatedproducts.class.php	(revision 8427)
+++ /mods/wpsg_mod_relatedproducts.class.php	(revision 8428)
@@ -41,4 +41,5 @@
 				rel_id int(11) NOT NULL,
 				template varchar(255) NOT NULL,
+				pos int(11) NOT NULL,
 				PRIMARY KEY  (id),
 				KEY p_id (p_id),
@@ -84,15 +85,17 @@
 		} // public function settings_save
 		
-		public function produkt_save(&$produkt_id) 
-		{
-			 	
-			if (isset($_REQUEST['wpsg_mod_relatedproduct']) && is_array($_REQUEST['wpsg_mod_relatedproduct']) && sizeof($_REQUEST['wpsg_mod_relatedproduct']) > 0)
-			{
-				
-				foreach ($_REQUEST['wpsg_mod_relatedproduct'] as $rp_id => $template)
-				{
+		public function produkt_save(&$produkt_id) {
+			
+			if (isset($_REQUEST['wpsg_mod_relatedproduct']) && is_array($_REQUEST['wpsg_mod_relatedproduct']) && sizeof($_REQUEST['wpsg_mod_relatedproduct']) > 0) {
+			
+				$nPos = 0;
+				
+				foreach ($_REQUEST['wpsg_mod_relatedproduct'] as $rp_id => $template) {
+					
+					$nPos ++;
 					
 					$this->db->UpdateQuery(WPSG_TBL_PRODUCTS_REL, array(
-						'template' => wpsg_q(wpsg_sinput("text_field", $template))
+						'template' => wpsg_q(wpsg_sinput("text_field", $template)),
+						'pos' => wpsg_q($nPos)
 					), "`id` = '".wpsg_q(wpsg_sinput("key", $rp_id))."'");
 					
@@ -132,13 +135,15 @@
 				if ($_REQUEST['template'] > 0 && strlen($_REQUEST['template_file']) > 0) $template = $_REQUEST['template_file']; else $template = '';
 				
-				$bExists = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_PRODUCTS_REL."` WHERE `p_id` = '".wpsg_q($_REQUEST['edit_id'])."' AND `rel_id` = '".wpsg_q($_REQUEST['rel_id'])."'");
-				
-				if ($bExists <= 0)
-				{
-				
+				$bExists = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_PRODUCTS_REL."` WHERE `p_id` = '".wpsg_q($_REQUEST['edit_id'])."' AND `rel_id` = '".wpsg_q($_REQUEST['rel_id'])."' ORDER BY `pos` ASC ");
+				
+				if ($bExists <= 0) {
+				
+					$nPos = intval($this->db->fetchOne("SELECT MAX(`pos`) FROM `".WPSG_TBL_PRODUCTS_REL."` WHERE `p_id` = '".wpsg_q($_REQUEST['edit_id'])."' ")) + 1;
+					
 					$this->db->ImportQuery(WPSG_TBL_PRODUCTS_REL, array(
 						'p_id' => wpsg_q($_REQUEST['edit_id']),
 						'rel_id' => wpsg_q($_REQUEST['rel_id']),
-						'template' => wpsg_q($template)
+						'template' => wpsg_q($template),
+						'pos' => wpsg_q($nPos)
 					));
 					
@@ -325,4 +330,6 @@
 					GROUP BY
 						RELP.`id`
+					ORDER BY
+						RP.`pos` ASC
 				");
 				
@@ -339,5 +346,7 @@
 					WHERE
 						RP.`p_id` = '".wpsg_q($produkt_id)."'  AND
-						RELP.`deleted` != '1' 
+						RELP.`deleted` != '1'
+					ORDER BY
+						RP.`pos` ASC
 				");
 				
@@ -348,3 +357,2 @@
 	} // class wpsg_mod_relatedproducts extends wpsg_mod_basic
 
-?>
Index: /mods/wpsg_mod_ticket.class.php
===================================================================
--- /mods/wpsg_mod_ticket.class.php	(revision 8427)
+++ /mods/wpsg_mod_ticket.class.php	(revision 8428)
@@ -16,6 +16,6 @@
 		var $id = 5502;
 		var $hilfeURL = '';
-		//var $version = "9.9.9";
-		//var $free = false;
+		var $version = "9.9.9";
+		var $free = false;
 		
 		public function __construct() {
Index: /views/mods/mod_relatedproducts/list.phtml
===================================================================
--- /views/mods/mod_relatedproducts/list.phtml	(revision 8427)
+++ /views/mods/mod_relatedproducts/list.phtml	(revision 8428)
@@ -10,13 +10,36 @@
 <p><?php echo __('Noch keine Produkte zugeordnet', 'wpsg'); ?></p>
 <?php } else { ?>
-<?php foreach ($this->view['wpsg_mod_relatedproducts']['data'] as $p) { ?>
-	<span id="wpsg_rp_<?php echo $p['id']; ?>">
-		<?php echo wpsg_drawForm_Select('wpsg_mod_relatedproduct['.$p['id'].']', '<a href="'.wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id='.$p['product_id'], 'wpsg-product-edit-'.$p['product_id']).'">'.$p['name'].'</p>', $this->view['wpsg_mod_relatedproducts']['arTemplates'], $p['template'], array('icon' => 'wpsg_icon_remove glyphicon glyphicon-trash')); ?>
-	</span>
-	<div class="wpsg_clear"></div>
-<?php } ?>
+	<div id="wpsg_mod_relatedproduct_list">
+		<?php foreach ($this->view['wpsg_mod_relatedproducts']['data'] as $p) { ?>
+			<div class="order_item">
+				<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-bar-expand" viewBox="0 0 16 16">
+					<path fill-rule="evenodd" d="M3.646 10.146a.5.5 0 0 1 .708 0L8 13.793l3.646-3.647a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 0-.708m0-4.292a.5.5 0 0 0 .708 0L8 2.207l3.646 3.647a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 0 0 0 .708M1 8a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13A.5.5 0 0 1 1 8"/>
+				</svg>
+				<span id="wpsg_rp_<?php echo $p['id']; ?>">
+					<?php echo wpsg_drawForm_Select('wpsg_mod_relatedproduct['.$p['id'].']', '<a href="'.wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id='.$p['product_id'], 'wpsg-product-edit-'.$p['product_id']).'">'.$p['name'].'</a>', $this->view['wpsg_mod_relatedproducts']['arTemplates'], $p['template'], array('icon' => 'wpsg_icon_remove glyphicon glyphicon-trash')); ?>
+				</span>
+			</div>
+		<?php } ?>
+	</div>
 <?php } ?>
 
-<script type="text/javascript">
+<style>
+	
+	#wpsg_mod_relatedproduct_list { display:flex; flex-direction:column; gap:5px;
+		& > .order_item { display:block; position:relative; cursor:pointer !important;
+			& > svg { display:none; width:16px; height:16px; left:0; top:50%; transform:translateY(-50%); position:absolute; cursor:pointer !important; }
+			&:hover > svg { display:block; }
+			.form-group { margin-top:0; margin-bottom:0;
+				& > * { cursor:pointer;
+					a { display:inline; }
+				}
+				& > label { display:flex; justify-content:flex-end; }
+			}
+		}
+	}
+	
+</style>
+
+<script>
 
 	jQuery('#relatedproducts_list a.wpsg_icon_remove').on('click', function() {
@@ -40,4 +63,12 @@
 		
 	} );
+	
+	jQuery(document).ready(function() {
+	
+		jQuery("#wpsg_mod_relatedproduct_list").sortable({
+		
+		}).disableSelection();
+
+	});
 
 </script>
