diff --git a/Makefile b/Makefile
index b5b21c126beb26fb369a735bb95d9f47b7fa9c51..26d48e5d69b7c99ee6e645c411a21fe0b07d192f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 BASE=downloads_for_sale
 PLUGINTYPE=vmcustom
-VERSION=1.5.5
+VERSION=1.6
 
 PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
 
diff --git a/downloads_for_sale.php b/downloads_for_sale.php
index f4c499206eb12cc7ce1275370fe45930603f4dea..bf70cc4177533c8bfe15cdc5dd2b941acae9842b 100644
--- a/downloads_for_sale.php
+++ b/downloads_for_sale.php
@@ -13,18 +13,15 @@ defined('_JEXEC') or 	die( 'Direct Access to ' . basename( __FILE__ ) . ' is not
  * other free or open source software licenses.
  * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
  *
- * http://kainhofer.com
+ * http://open-tools.net
  */
-if (!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php');
-if(!class_exists('VmTable'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmtable.php');
-
-if (JVM_VERSION === 2) {
-    if (!defined('VMDLSALE_PLUGINPATH')) define('VMDLSALE_PLUGINPATH', JPATH_SITE.DS.'plugins'.DS.'vmcustom'.DS.'downloads_for_sale');
-    if (!defined('VMDLSALE_PLUGINWEBROOT')) define('VMDLSALE_PLUGINWEBROOT', 'plugins/vmcustom/downloads_for_sale');
-} else {
-    if (!defined('VMDLSALE_PLUGINPATH')) define('VMDLSALE_PLUGINPATH', JPATH_SITE.DS.'plugins'.DS.'vmcustom');
-    if (!defined('VMDLSALE_PLUGINWEBROOT')) define('VMDLSALE_PLUGINWEBROOT', 'plugins/vmcustom');
-}
+if (!class_exists('vmCustomPlugin')) 
+	require(JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php');
+if(!class_exists('VmTable'))
+	require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmtable.php');
+
+if (!defined('VMDLSALE_PLUGINPATH')) define('VMDLSALE_PLUGINPATH', JPATH_SITE.DS.'plugins'.DS.'vmcustom'.DS.'downloads_for_sale');
+if (!defined('VMDLSALE_PLUGINWEBROOT')) define('VMDLSALE_PLUGINWEBROOT', 'plugins/vmcustom/downloads_for_sale');
 
 class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 
@@ -40,8 +37,11 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 			'paid_status'=>array(array('S', 'C'), 'array'),
 			'downloaded_status'=>array('', 'char'),
 		);
-		$this->setConfigParameterable('custom_params',$varsToPush);
-		$this->onStoreInstallPluginTable($this->_psType);
+		if (!defined('VM_VERSION') or VM_VERSION < 3) {
+			$this->setConfigParameterable ('custom_params', $varsToPush);
+		} else {
+			$this->setConfigParameterable ('customfield_params', $varsToPush);
+		}
 	}
 
 	function getDownloadFiles () {
@@ -57,8 +57,9 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 	
 	function getCustomfieldOrderitems ($field, $user, $show_warnings) {
 		$orderModel = VmModel::getModel('orders');
-		$order_number = JRequest::getString('order_number', null);
-		$order_pass = JRequest::getString('order_pass', null);
+		$input = new JInput();
+		$order_number = $input->getString('order_number', null);
+		$order_pass = $input->getString('order_pass', null);
 		$orders = array();
 		if ($order_number && $order_pass) {
 			$order_id = $orderModel->getOrderIdByOrderPass ($order_number, $order_pass);
@@ -127,13 +128,14 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		if ($orderitem) {
 			if (in_array($orderitem->order_status, $field->paid_status)) {
 				return true;
-			} elseif ($show_warnings) {
+			} elseif ($show_warnings) { // FIXME: Translation!
 				JFactory::getApplication()->enqueueMessage(JText::sprintf("Order status %s does not allow download (allowed states are %s)", $orderitem->order_status, join($field->paid_status, ", ")), 'error');
 			}
 		}
 		return false;
 	}
 
+	// Legacy support for VM2. VM3 has its own function.
 	function loadCustomfieldData ($customfield_id) {
 		$db = JFactory::getDbo();	
 		$q = 'SELECT * FROM `#__virtuemart_customs` LEFT JOIN `#__virtuemart_product_customfields` USING (`virtuemart_custom_id`, `custom_value`) WHERE `virtuemart_customfield_id` = '.(int)$customfield_id . ' AND `custom_value`=\''.$db->getEscaped($this->_name).'\'';
@@ -197,6 +199,7 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 				return false;
 			}
 		} else {
+			JFactory::getApplication()->enqueueMessage(JText::_('VMCUSTOM_DLSALE_NO_FILE_FOUND'), 'error');
 			$output = JText::_('VMCUSTOM_DLSALE_NO_FILE_FOUND');
 		}
 		return false;
@@ -208,7 +211,7 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		$sql = "SELECT `id` FROM `" . $this->_tablename . "` WHERE `virtuemart_customfield_id`=" . (int)$field->virtuemart_customfield_id .
 		       " AND `virtuemart_order_item_id`=" . (int)($orderitem?$orderitem->virtuemart_order_item_id:0);
 		$user = (int)JFactory::getUser()->get('id');
-		$date = JFactory::getDate()->toMySQL();
+		$date = JFactory::getDate()->toSql();
 		
 		$db->setQuery($sql);
 		$id = $db->loadResult();
@@ -240,28 +243,32 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		$orderdata['customer_notified'] = 0;
 		$orderdata['comments'] = '';
 		if ($order->order_status != $orderdata['order_status']) {
-			$orderModel->updateStatusForOneOrder($order->virtuemart_order_id, $orderdata, /*triggers=*/false);
+			// We need to call the triggers, in case some plugin depends on order status change notifications!
+			$orderModel->updateStatusForOneOrder($order->virtuemart_order_id, $orderdata, /*triggers=*/true);
 		}
 	}
 
 	function plgVmOnSelfCallFE($type,$name,&$render) {
 		if ($name != $this->_name || $type != 'vmcustom') return false;
 		$handled = false;
-		$field_id = JRequest::getInt('customfield_id',0);
+		$field_id = vRequest::getInt('customfield_id',0);
 		$customModel = VmModel::getModel('customfields');
 		if ($field_id) {
 
-			$field = $this->loadCustomfieldData ($field_id);
+			if (!defined('VM_VERSION') or VM_VERSION < 3) {
+				$field = $this->loadCustomfieldData ($field_id);
+			} else {
+				$field = $customModel->getCustomEmbeddedProductCustomField($field_id);
+			}
 			if ($field) {
-				$this->parseCustomParams($field);
 				$orderitems = $this->getCustomfieldOrderitems ($field, JFactory::getUser()->get('id'), true);
 				$orderitem = empty($orderitems)?null:$orderitems[0];
 				if ($this->checkDownloadable ($field, $orderitem, true)) {
 					$handled = true;
 					if ($this->downloadFile ($field->media_id, $render)) {
 						// Successful download, so set order status to shipped, then exit to prevent the normal joomla page formatting (we sent a potentially binary file already!)
-						$this->updateDownloadCounterSQL ($field, $orderitem);
 						$this->updateOrderStatus ($field, $orderitem);
+						$this->updateDownloadCounterSQL ($field, $orderitem);
 						JExit();
 					} else {
 						return true;
@@ -276,9 +283,9 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		if (!$handled) {
 			$user = JFactory::getUser()->get('id');
 			// If we have an order number and password, display all downloads of that order, even if the user is not logged in:
-			$field_id = JRequest::getInt('customfield_id',0);
-			$order_number = JRequest::getString('order_number', null);
-			$order_pass = JRequest::getString('order_pass', null);
+			$field_id = vRequest::getInt('customfield_id',0);
+			$order_number = vRequest::getString('order_number', null);
+			$order_pass = vRequest::getString('order_pass', null);
 			$orders = array();
 			if ($order_number && $order_pass) {
 				$orderModel = VmModel::getModel('orders');
@@ -319,14 +326,18 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 				foreach ($order['items'] as $i) {
 					$productinfo=$i;
 					$productinfo->downloads = array();
-					$customs = (array)$customModel->getproductCustomslist ($i->virtuemart_product_id);
+					if (method_exists($customModel, 'getCustomEmbeddedProductCustomFields')) { // V3.x
+						$customs = (array)$customModel->getCustomEmbeddedProductCustomFields (array ($i->virtuemart_product_id));
+					} else {
+						$customs = (array)$customModel->getproductCustomslist ($i->virtuemart_product_id); // V2.x
+					}
 					foreach ($customs as $field) {
 						$downloadable = ($field->custom_element == $this->_name);
 						if ($field->download_type == "paid_download") {
 							$downloadable = $downloadable && in_array($order['details']['BT']->order_status, $field->paid_status);
 						}
 						$downloadable = $downloadable && $this->checkDownloadable ($field, $i, false);
-						// Order needs to be downloadable and the individiaul field, too:
+						// Order needs to be downloadable and the individiual field, too:
 						if ($downloadable) {
 							$productinfo->downloads[] = $this->createDownloadLink ($field, 'order', $field->invoice_link_type, $i);
 						}
@@ -363,7 +374,13 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 	 */
 	function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) {
 		if ($field->custom_element != $this->_name) return '';
-		$this->parseCustomParams($field);
+		if(!defined('VM_VERSION') or VM_VERSION < 3){
+			$this->parseCustomParams ($field);
+			$paramName = 'custom_param';
+		} else {
+			$paramName = 'customfield_params';
+		}
+
 		$html = '';
 		$html .='<fieldset>
 			<legend>'. JText::_('VMCUSTOM_DLSALE') .'</legend>
@@ -388,12 +405,12 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 			array('id'=>'registered_download', 'name'=>'VMCUSTOM_DLSALE_TYPE_REGISTERED'),
 			array('id'=>'paid_download', 'name'=>'VMCUSTOM_DLSALE_TYPE_PAID'),
 		);
-		$html .= VmHTML::row('select', 'VMCUSTOM_DLSALE_DOWNLOAD_FILE', 'custom_param['.$row.'][media_id]', $download_files, $field->media_id,'','virtuemart_media_id', 'file_title', false);
+		$html .= VmHTML::row('select', 'VMCUSTOM_DLSALE_DOWNLOAD_FILE', $paramName.'['.$row.'][media_id]', $download_files, $field->media_id,'','virtuemart_media_id', 'file_title', false);
 		if ($field->is_cart_attribute) {
-			$html .= VmHTML::row ('select','VMCUSTOM_DLSALE_INVOICE_LINK', 'custom_param['.$row.'][invoice_link_type]',$link_types,$field->invoice_link_type, '', 'link-id', 'link-name', false);
+			$html .= VmHTML::row ('select','VMCUSTOM_DLSALE_INVOICE_LINK', $paramName.'['.$row.'][invoice_link_type]',$link_types,$field->invoice_link_type, '', 'link-id', 'link-name', false);
 		}
-		$html .= VmHTML::row ('select','VMCUSTOM_DLSALE_PRODUCT_LINK', 'custom_param['.$row.'][product_link_type]',$link_types,$field->product_link_type, '', 'link-id', 'link-name', false);
-		$html .= VmHTML::row('select', 'VMCUSTOM_DLSALE_TYPE', 'custom_param['.$row.'][download_type]', $download_types,$field->download_type,'','id', 'name', false);
+		$html .= VmHTML::row ('select','VMCUSTOM_DLSALE_PRODUCT_LINK', $paramName.'['.$row.'][product_link_type]',$link_types,$field->product_link_type, '', 'link-id', 'link-name', false);
+		$html .= VmHTML::row('select', 'VMCUSTOM_DLSALE_TYPE', $paramName.'['.$row.'][download_type]', $download_types,$field->download_type,'','id', 'name', false);
 		$html .= '</table></fieldset>';
 
 		$retValue .= $html;
@@ -406,7 +423,10 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		$url = JURI::root().'index.php?option=com_virtuemart&view=plugin&name=downloads_for_sale&customfield_id='.(int)$field->virtuemart_customfield_id;
 		$_currentUser = JFactory::getUser();
 		$cuid = $_currentUser->get('id');
-		$this->parseCustomParams($field);
+		
+		if (!defined('VM_VERSION') or VM_VERSION < 3) { // Only needed in VM2
+			$this->parseCustomParams($field);
+		}
 		// TODO: Extract download statistics
 		switch ($field->download_type) {
 			case 'free_download':  break;
@@ -458,10 +478,22 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		}
 		return $return;	
 	}
+
+	// Legacy Support for VM3
+	function plgVmOnDisplayProductFEVM3(&$product,&$field) {
+		// default return if it's not this plugin
+		if ($field->custom_element != $this->_name) return '';
+		// NO $this->parseCustomParams($field); needed any more!
+		$output = $this->createProductDownloadLinks ($field, $field->product_link_type);
+		if (!empty($output)) {
+			$field->display .= $output;
+			return true;
+		} else {
+			return false;
+		}
+	}
 	
-	/**
-	 * plgVmOnDisplayProductVariantFE ... Called for product variant custom fields to display on the product details page
-	 */
+	// Legacy Support for VM2
 	function plgVmOnDisplayProductVariantFE($field,&$row,&$group) {
 		// default return if it's not this plugin
 		if ($field->custom_element != $this->_name) return '';
@@ -475,9 +507,7 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		}
 	}
 
-	/**
-	 * plgVmOnDisplayProductFE ... Called for NON-product variant custom fields to display on the product details page
-	 */
+	// Legacy Support for VM2
 	function plgVmOnDisplayProductFE( $product, &$idx,&$field){
 		// default return if it's not this plugin
 		if ($field->custom_element != $this->_name) return '';
@@ -491,6 +521,29 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 			return false;
 		}
 	}
+	
+	function plgVmOnViewCartVM3(&$product, &$productCustom, &$html) {
+		// if (empty($productCustom->custom_element) or $productCustom->custom_element != $this->_name) return false;
+		// return true;
+	}
+	function plgVmOnViewCartModuleVM3( &$product, &$productCustom, &$html) {
+		// return $this->plgVmOnViewCartVM3($product,$productCustom,$html);
+	}
+	function plgVmDisplayInOrderBEVM3( &$product, &$productCustom, &$html) {
+		// return $this->plgVmOnViewCartVM3($product,$productCustom,$html);
+	}
+
+	// VM2 legacy
+	function plgVmOnViewCartModule ($product, $row, &$html) {
+		return $this->plgVmOnViewCart ($product, $row, $html);
+    }
+
+	function plgVmOnViewCart ($product, $row, &$html) {
+		if (empty($product->productCustom->custom_element) or $product->productCustom->custom_element != $this->_name) return '';
+		return '';
+    }
+
+
 
 	/** 
 	 * plgVmDisplayInOrderBE ... Called to display product variants in the order list in the BE
@@ -512,10 +565,26 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 	/**
 	 * plgVmDisplayInOrderFE ... Called to display the dl link in the order in the frontend 
 	 */
+	function plgVmDisplayInOrderFEVM3(&$product, &$productCustom, &$html) {
+		if (empty($productCustom->custom_element) or $productCustom->custom_element != $this->_name) return false;
+		
+		$return = false;
+		$type = $productCustom->invoice_link_type;
+		if ($type != 'none') {
+			if ($this->checkDownloadable ($productCustom, $product, false)) {
+				$dllink = $this->createDownloadLink($productCustom, "order", $type, $product);
+				if (!empty($dllink)) {
+					$html .= $dllink;
+					$return = true;
+				}
+			}
+		}
+		return $return;
+	}
+
 	function plgVmDisplayInOrderFE($item, $row, &$html) {
 		if (empty($item->productCustom->custom_element) or $item->productCustom->custom_element != $this->_name) return '';
 		$item->productCustom = $this->loadCustomfieldData ($item->productCustom->virtuemart_customfield_id);
-		$this->parseCustomParams($item->productCustom);
 		$type = $item->productCustom->invoice_link_type;
 
 		$return = false;
@@ -531,26 +600,38 @@ class plgVmCustomDownloads_for_Sale extends vmCustomPlugin {
 		return $return;
 	}
 
-	/**
-	 * We must reimplement this triggers for joomla 1.7
-	 * vmplugin triggers note by Max Milbers
-	 */
 	public function plgVmOnStoreInstallPluginTable($psType, $name) {
 		return $this->onStoreInstallPluginTable($psType, $name);
 	}
 
+	function plgVmOnDisplayEdit($virtuemart_custom_id, &$customPlugin){
+		return $this->onDisplayEditBECustom($virtuemart_custom_id, $customPlugin);
+	}
+
+	/* New triggers for VM3 */
+	function plgVmDeclarePluginParamsCustomVM3(&$data){
+		return $this->declarePluginParams('custom', $data);
+	}
+
+	function plgVmGetTablePluginParams($psType, $name, $id, &$xParams, &$varsToPush){
+		return $this->getTablePluginParams($psType, $name, $id, $xParams, $varsToPush);
+	}
+	
+	/* Legacy support for VM2 */
 	function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){
 		return $this->declarePluginParams('custom', $name, $id, $data);
 	}
-
-	function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){
-		return $this->setOnTablePluginParams($name, $id, $table);
+	
+	public function plgVmPrepareCartProduct(&$product, &$customfield,$selected, &$modificatorSum){
+		// You can modify the product's price here
+		return true;
 	}
 
-	function plgVmOnDisplayEdit($virtuemart_custom_id,&$customPlugin){
-		return $this->onDisplayEditBECustom($virtuemart_custom_id,$customPlugin);
+	function plgVmSetOnTablePluginParamsCustom($name, $id, &$table,$xParams){
+		return $this->setOnTablePluginParams($name, $id, $table, $xParams);
 	}
 
+
 	/**
 	 * This function is called, when the order is confirmed by the shopper.
 	 *
diff --git a/downloads_for_sale.xml b/downloads_for_sale.xml
index f961c3deebf7977113f23523687dd3a686e5f625..7624e836cc1693101cebffe8c4ec5d2487d6e517 100644
--- a/downloads_for_sale.xml
+++ b/downloads_for_sale.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<install version="1.5" type="plugin" group="vmcustom" method="upgrade">
+<extension version="2.5" type="plugin" group="vmcustom" method="upgrade">
     <name>VMCUSTOM_DLSALE</name>
     <creationDate>2013-09-21</creationDate>
     <author>Reinhold Kainhofer</author>
     <authorUrl>http://www.open-tools.net/</authorUrl>
     <copyright>Copyright (C) 2013 Reinhold Kainhofer. All rights reserved.</copyright>
     <license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license>
-    <version>1.5.5</version>
+    <version>1.6</version>
     <description>VMCUSTOM_DLSALE_DESC</description>
     <files>
         <filename plugin="downloads_for_sale">downloads_for_sale.php</filename>
@@ -14,7 +14,8 @@
         <folder>downloads_for_sale</folder>
         <folder>language</folder>
         <filename>index.html</filename>
-	<folder>elements</folder>
+        <folder>elements</folder>
+        <folder>fields</folder>
     </files>
     <languages folder="language">
         <language tag="en-GB">en-GB/en-GB.plg_vmcustom_downloads_for_sale.ini</language>
@@ -23,6 +24,33 @@
         <language tag="de-DE">de-DE/de-DE.plg_vmcustom_downloads_for_sale.sys.ini</language>
     </languages>
     <scriptfile>downloads_for_sale.script.php</scriptfile>
+
+    <!-- VM 3.x support (fields rather than params): -->
+    <vmconfig>
+        <fields name="params" addfieldpath="/plugins/vmcustom/downloads_for_sale/fields">
+            <fieldset name="shipment" label="VMCUSTOM_DLSALE" addfieldpath="/administrator/components/com_virtuemart/fields">
+                <field name="invoice_link_type" type="list" default="link" label="VMCUSTOM_DLSALE_INVOICE_LINK" description="VMCUSTOM_DLSALE_INVOICE_LINK_DESC" >
+                    <option value="none">VMCUSTOM_DLSALE_LINK_NONE</option>
+                    <option value="compact">VMCUSTOM_DLSALE_LINK_COMPACT</option>
+                    <option value="long">VMCUSTOM_DLSALE_LINK_LONG</option>
+                </field>
+                <field name="product_link_type" type="list" default="image" label="VMCUSTOM_DLSALE_PRODUCT_LINK" description="VMCUSTOM_DLSALE_PRODUCT_LINK_DESC" >
+                    <option value="none">VMCUSTOM_DLSALE_LINK_NONE</option>
+                    <option value="compact">VMCUSTOM_DLSALE_LINK_COMPACT</option>
+                    <option value="long">VMCUSTOM_DLSALE_LINK_LONG</option>
+                </field>
+                <field name="download_type" type="list"  default="yes" label="VMCUSTOM_DLSALE_TYPE" description="VMCUSTOM_DLSALE_TYPE_DESC">
+                    <option value="free_download">VMCUSTOM_DLSALE_TYPE_FREE</option>
+                    <option value="registered_download">VMCUSTOM_DLSALE_TYPE_REGISTERED</option>
+                    <option value="paid_download">VMCUSTOM_DLSALE_TYPE_PAID</option>
+                </field>
+                <field name="paid_status" type="vmorderstate" scope="com_virtuemart" default="C,S" multiple="multiple" label="VMCUSTOM_DLSALE_STATUS_PAID" select="NONE" description="VMCUSTOM_DLSALE_STATUS_PAID_EXPLAIN" />
+                <field name="downloaded_status" type="vmdlorderstate" scope="com_virtuemart" default="" label="VMCUSTOM_DLSALE_STATUS_DOWNLOADED" description="VMCUSTOM_DLSALE_STATUS_DOWNLOADED_EXPLAIN" />
+            </fieldset>
+        </fields>
+    </vmconfig>
+
+    <!-- VM 2.1 support (fields rather than params): -->
     <params addpath="/plugins/vmcustom/downloads_for_sale/elements" />
     <params addpath="/administrator/components/com_virtuemart/elements">
         <param type="vmjpluginwarning" />
@@ -44,4 +72,4 @@
         <param name="paid_status" type="vmorderstates" scope="com_virtuemart" default="C, S" multiple="multiple" label="VMCUSTOM_DLSALE_STATUS_PAID" description="VMCUSTOM_DLSALE_STATUS_PAID_EXPLAIN" />
         <param name="downloaded_status" type="vmdlorderstate" scope="com_virtuemart" default="" label="VMCUSTOM_DLSALE_STATUS_DOWNLOADED" description="VMCUSTOM_DLSALE_STATUS_DOWNLOADED_EXPLAIN" />
     </params>
-</install>
+</extension>
diff --git a/fields/index.html b/fields/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/fields/vmdlorderstate.php b/fields/vmdlorderstate.php
new file mode 100644
index 0000000000000000000000000000000000000000..952720e7cbb25fcac73118081732eecdbf4f5b50
--- /dev/null
+++ b/fields/vmdlorderstate.php
@@ -0,0 +1,31 @@
+<?php
+defined ('_JEXEC') or die();
+/**
+ *
+ * @package    VirtueMart
+ * @subpackage Plugins - Fields
+ * @author Reinhold Kainhofer, Open Tools
+ * @link http://www.open-tools.net
+ * @copyright Copyright (c) 2014 Open Tools. All rights reserved.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
+ * VirtueMart is free software. This version may have been modified pursuant
+ * to the GNU General Public License, and as distributed it includes or
+ * is derivative of works licensed under the GNU General Public License or
+ * other free or open source software licenses.
+ */
+if (!class_exists('JFormFieldVmOrderState'))  
+	require(JPATH_VM_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'fields'.DS.'vmorderstate.php');
+
+/*
+ * This is an extension of JFormFieldVmOrderState, which prepends a value "Status unchanged" to the list of possible status selections 
+ */
+ class JFormFieldVmDLOrderState extends JFormFieldVmOrderState {
+
+	var $type = 'vmDLOrderState';
+	protected function getOptions() {
+		return array_merge (
+			array( '' => vmText::_('VMCUSTOM_DLSALE_STATUS_UNCHANGED')),
+			JFormFieldVmOrderState::getOptions());
+	}
+
+}