Index: /mods/wpsg_mod_stock.class.php
===================================================================
--- /mods/wpsg_mod_stock.class.php	(revision 5804)
+++ /mods/wpsg_mod_stock.class.php	(revision 5824)
@@ -43,4 +43,6 @@
 			  	stock int(11) NOT NULL,
 			  	stock_count int(1) NOT NULL,
+				minstockproduct_count int(11) NOT NULL, 	
+				minstockproduct_mail varchar (255) NOT NULL,
 			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
 			
@@ -66,4 +68,5 @@
 			$this->shop->update_option('wpsg_mod_stock_allow', $_REQUEST['wpsg_mod_stock_allow']);
 			$this->shop->update_option('wpsg_mod_stock_showBackendStock', $_REQUEST['wpsg_mod_stock_showBackendStock']);
+			$this->shop->update_option('wpsg_mod_stock_minstockproduct', $_REQUEST['wpsg_mod_stock_minstockproduct']);
 			
 			if ($this->shop->hasMod('wpsg_mod_productindex'))
@@ -665,4 +668,13 @@
 				$this->db->Query("UPDATE `".WPSG_TBL_PRODUCTS."` SET `stock` = `stock` - '".wpsg_q($stock)."' WHERE `id` = '".wpsg_q($product_id)."' ");
 				
+				// Benachrichtigung bei Unterschreiten von mindest Menge
+				if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_stock_minstockproduct')))
+				{
+						
+					// Wenn Mindestbestellmenge unterschritten oder gleich
+					if ($stock <= $product_data['minstockproduct_count']) $this->sendMinStockMail($data['productkey']);
+						
+				}
+				
 			}
 			
@@ -674,4 +686,35 @@
 		} // public function checkReduceStock(&$data, &$product_data)
 		
+		/**
+		 * Sendet eine Mail bei erreichen des Mindestbestandes
+		 */
+		public function sendMinStockMail($product_key)
+		{
+				
+			$product_id = $this->shop->getProduktID($product_key);
+			$product_data = $this->shop->cache->loadProduct($product_id);
+				
+			if ($this->shop->get_option('wpsg_htmlmail') === '1')
+			{
+		
+				$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_stock/stockmail_html.phtml', false);
+		
+			}
+			else
+			{
+		
+				$mail_html = false;
+		
+			}
+				
+			$mail_text = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_stock/stockmail.phtml', false);
+				
+			$to = $product_data['minstockproduct_mail'];
+			if (!wpsg_isSizedString($to)) $to = get_bloginfo('admin_email');
+				
+			list($subject, $text) = $this->shop->sendMail($mail_text, $to, 'wpsgmodstockminstockmail', array(), false, false, $mail_html, wpsg_translate(__('Der Minimalbestand im Produkt #1# wurde erreicht.', 'wpsg'), $product_data['name']));
+				
+		} // public function sendMinStockMail($product_key)
+		
 	} // class wpsg_mod_stock extends wpsg_mod_basic
 
Index: /views/mods/mod_stock/produkt_edit_sidebar.phtml
===================================================================
--- /views/mods/mod_stock/produkt_edit_sidebar.phtml	(revision 5804)
+++ /views/mods/mod_stock/produkt_edit_sidebar.phtml	(revision 5824)
@@ -9,2 +9,8 @@
 <?php echo wpsg_drawForm_Checkbox('wpsg_mod_stock_stock_count', __('Lagerbestand zÃ€hlen', 'wpsg'), wpsg_getStr($this->view['data']['stock_count'], '0')); ?>
 <?php echo __('Lagerbestand = Bestand(Variante 1) + Bestand(Variante 2) + Bestand(Variante X)','wpsg'); ?>
+
+<?php /* Mailbenachrichtigung beim Erreichen des Minimalbestandes des Produktes */ ?>
+<?php if ($this->get_option('wpsg_mod_stock_minstockproduct') == '1') { ?>
+<?php echo wpsg_drawForum_Input('wpsg_mod_minstockproduct', __('Mindestlagerbestand', 'wpsg'), wpsg_getStr($this->view['data']['minstockproduct_count'])); ?>
+<?php echo wpsg_drawForum_Input('wpsg_mod_stock_minstockproduct_mail', __('Benachrichtigung an', 'wpsg'), wpsg_getStr($this->view['data']['minstockproduct_mail'])); ?>	
+<?php }?>
Index: /views/mods/mod_stock/settings_edit.phtml
===================================================================
--- /views/mods/mod_stock/settings_edit.phtml	(revision 5804)
+++ /views/mods/mod_stock/settings_edit.phtml	(revision 5824)
@@ -33,4 +33,7 @@
 <?php echo wpsg_drawForm_Checkbox('wpsg_mod_stock_showProduct', __('Bestand in Produkt (Frontend) anzeigen', 'wpsg'), $this->get_option('wpsg_mod_stock_showProduct'), array('help' => 'wpsg_mod_stock_showProduct')); ?>
 
+<br />
+
+<?php echo wpsg_drawForm_Checkbox('wpsg_mod_stock_minstockproduct',  __('Minimalbestand im Produkt hinterlegen', 'wpsg'), $this->get_option('wpsg_mod_stock_minstockproduct'), array('help' => 'wpsg_mod_stock_minstockproduct')); ?>
 
 <script type="text/javascript">/* <![CDATA[ */
Index: /views/mods/mod_stock/stockmail.phtml
===================================================================
--- /views/mods/mod_stock/stockmail.phtml	(revision 5824)
+++ /views/mods/mod_stock/stockmail.phtml	(revision 5824)
@@ -0,0 +1,17 @@
+<?php
+
+	/**
+	 * Dieses Template wird fÃŒr die HTML Mail beim Erreichen des Mindestlagerbestandes eines Produktes verwendet
+	 */
+
+	$this->htmlMail = false;
+
+?>
+
+<?php echo __('Hallo Administrator,', 'wpsg'); ?>
+ 
+<?php echo wpsg_translate(__('Ein Produkt hat das Erreichen des minimalen Lagerbestand am #1# um #2# Uhr gemeldet', 'wpsg'), date('d.m.Y'), date('H:i')); ?>
+ 
+<?php echo __('Mit freundlichen GrÃŒÃen', 'wpsg'); ?>
+
+<?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?>
Index: /views/mods/mod_stock/stockmail_html.phtml
===================================================================
--- /views/mods/mod_stock/stockmail_html.phtml	(revision 5824)
+++ /views/mods/mod_stock/stockmail_html.phtml	(revision 5824)
@@ -0,0 +1,17 @@
+<?php
+
+	/**
+	 * Dieses Template wird fÃŒr die HTML Mail beim Erreichen des Mindestlagerbestandes eines Produktes verwendet
+	 */
+
+	$this->htmlMail = true;
+
+?>
+
+<p><?php echo __('Hallo Administrator,', 'wpsg'); ?></p> 
+
+<p><?php echo wpsg_translate(__('Ein Produkt hat das Erreichen des minimalen Lagerbestand am #1# um #2# Uhr gemeldet', 'wpsg'), date('d.m.Y'), date('H:i')); ?></p>
+
+<p><?php echo __('Mit freundlichen GrÃŒÃen', 'wpsg'); ?></p>
+
+<p><?php echo __($this->get_option('wpsg_shopdata_name'), 'wpsg'); ?> - <?php echo __('Team', 'wpsg'); ?></p> 
