Index: /changelog
===================================================================
--- /changelog	(revision 7973)
+++ /changelog	(revision 7974)
@@ -498,2 +498,3 @@
 #4.3.7
 - Bugfix: Warenkorb-Rabatt wird jetzt vor den Versandkosten berechnet #777
+- Feature: Staffelpreise kÃ¶nnen jetzt angewendet werden wenn im Backend ein Produkt hinzugefÃŒgt wird #776
Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 7973)
+++ /controller/wpsg_OrderController.class.php	(revision 7974)
@@ -1292,4 +1292,10 @@
 		            if (wpsg_isSizedInt($order_product_id)) $product_index = $this->db->fetchOne("SELECT `product_index` FROM `".WPSG_TBL_ORDERPRODUCT."` WHERE `id` = '".wpsg_q($order_product_id)."' ");
 		            
+					if (wpsg_isSizedInt($_REQUEST['set_scaleprice']) && $this->shop->hasMod('wpsg_mod_scaleprice')) {
+						
+						$_REQUEST['add_price'] = $this->shop->callMod('wpsg_mod_scaleprice', 'getScalePrice', [$oProduct, $oProduct->getPrice(), $_REQUEST['add_amount']]);
+						
+					}
+					
 					$oCalculation->addProduct($_REQUEST['add_price'], $this->shop->getBackendTaxview(), $oProduct->mwst_key, $_REQUEST['add_amount'], $product_key, $product_index, $order_product_id, $eu);
 			
Index: /mods/wpsg_mod_scaleprice.class.php
===================================================================
--- /mods/wpsg_mod_scaleprice.class.php	(revision 7973)
+++ /mods/wpsg_mod_scaleprice.class.php	(revision 7974)
@@ -34,6 +34,5 @@
 		} // public function __construct()
 		
-		public function install()
-		{
+		public function install() {
 				
 			require_once(WPSG_PATH_WP.'/wp-admin/includes/upgrade.php');
@@ -83,10 +82,9 @@
 		
 		} // public function settings_save()
-		
+						
 		/*
 		 * zeigt die Staffelpreise im Produktbackend an
 		*/
-		public function product_addedit_content(&$product_content, &$product_data)
-		{
+		public function product_addedit_content(&$product_content, &$product_data) {
 		
 			if (!wpsg_isSizedInt($product_data['id'])) return;
@@ -117,32 +115,5 @@
 		
 		} //public function product_addedit_content(&$product_content, &$product_data)
-		
-		
-		/*
-		public function produkt_edit_sidebar(&$produkt_data) 
-		{ 
-			
-			if (!isset($produkt_data['id'])) return;
-			
-			$this->shop->view['wpsg_mod_scaleprice']['product'] = $produkt_data; 
-			
-			$this->shop->view['wpsg_mod_scaleprice']['arTyp'] = array(
-				wpsg_mod_scaleprice::TYP_QUANTITY => __('Menge', 'wpsg')	
-			);
-			
-			if ($this->shop->hasMod('wpsg_mod_weight'))
-			{
-				
-				$this->shop->view['wpsg_mod_scaleprice']['arTyp'][wpsg_mod_scaleprice::TYP_WEIGHT] = __('Gewicht', 'wpsg');
-				
-			}
-			
-			$this->shop->view['wpsg_mod_scaleprice']['list'] = $this->scaleList($produkt_data['id']);
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_scaleprice/produkt_edit_sidebar.phtml');
-			
-		} // public function produkt_edit_sidebar(&$produkt_data)
-		*/
-		
+		 
 		public function produkt_save_before(&$produkt_data) 
 		{ 
@@ -434,7 +405,22 @@
 		 		
 		/* Modulfunktionen */
-		
-		private function getScalePrice($oProduct, $price, $scale)
-		{
+
+		/**
+		 * Gibt true zurÃŒck, wenn das Produkt Preisstaffeln verwendet
+		 * @param int $product_id
+		 */
+		public function product_has_scaleprice(int $product_id): bool {
+			
+			$scaleprice_activ = intval($this->db->fetchOne("SELECT `wpsg_mod_scaleprice_activ` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".intval($product_id)."' "));
+			
+			if ($scaleprice_activ <= 0) return false;
+			
+			$nScaleCount = intval($this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_SCALEPRICE."` WHERE `product_id` = '".intval($product_id)."'  "));
+			
+			return $nScaleCount > 0; 
+			
+		}
+
+		public function getScalePrice($oProduct, $price, $scale) {
 			
 			$arScale = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_SCALEPRICE."` WHERE `product_id` = '".wpsg_q($oProduct->id)."' ORDER BY `scale` ASC");
@@ -473,15 +459,11 @@
 		} // private function getStaffel($product_id)
 		
-		private function scaleList($product_id, $typ = false)
-		{
-			
-			if ($typ === false)
-			{
+		private function scaleList($product_id, $typ = false) {
+			
+			if ($typ === false) {
 			
 				$this->shop->view['wpsg_mod_scaleprice']['typ'] = $this->db->fetchOne("SELECT `wpsg_mod_scaleprice_typ` FROM `".WPSG_TBL_PRODUCTS."` WHERE `id` = '".wpsg_q($product_id)."'");
 				
-			}
-			else
-			{
+			} else {
 				
 				$this->shop->view['wpsg_mod_scaleprice']['typ'] = $typ;
Index: /views/order/backendEdit/addProduct_product_selected.phtml
===================================================================
--- /views/order/backendEdit/addProduct_product_selected.phtml	(revision 7973)
+++ /views/order/backendEdit/addProduct_product_selected.phtml	(revision 7974)
@@ -44,4 +44,30 @@
     <?php echo wpsg_drawForm_Checkbox('add_eu',__('EU-Leistungsortregel anwenden', 'wpsg'),(($oOrderProduct !== false)?$oOrderProduct->euleistungsortregel:'1')) ?>
 	
+    <?php if ($this->hasMod('wpsg_mod_scaleprice')) { ?>
+        <?php if ($this->callMod('wpsg_mod_scaleprice', 'product_has_scaleprice', [$oProduct->getId()])) { ?>
+            
+            <?php echo wpsg_drawForm_Checkbox('set_scaleprice', __('Produktpreis anhand Preisstaffel ermitteln', 'wpsg'), false); ?>
+            
+            <script>
+                
+                document.getElementById('set_scaleprice').addEventListener('change', (event) => {
+					
+					if (event.target.checked) {
+						
+						document.getElementById('add_price').setAttribute('disabled', 'disabled');
+						
+                    } else {
+						
+						document.getElementById('add_price').removeAttribute('disabled');
+						
+                    }
+					
+                });
+                
+            </script>
+            
+        <?php } ?>
+    <?php } ?>
+    
     <?php if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$oProduct->id])) { 
     	
