diff --git a/sites/all/modules/simpleads/includes/simpleads.helper.inc b/sites/all/modules/simpleads/includes/simpleads.helper.inc
index cbd3532..42ba046 100644
--- a/sites/all/modules/simpleads/includes/simpleads.helper.inc
+++ b/sites/all/modules/simpleads/includes/simpleads.helper.inc
@@ -24,7 +24,7 @@
 
     $ad_settings = _simpleads_adgroup_settings($tid);
     $order_delta = isset($ad_settings['ads_order']) ? $ad_settings['ads_order'] : 'random';
-    $queries = module_invoke_all('simpleads_order', $order_delta, $term_ids, $limit);
+    $queries = module_invoke_all('simpleads_order', $order_delta, $term_ids, $limit, $ad_settings);
 
     if (count($queries) > 0) {
       foreach ($queries as $i => $query) {
@@ -503,4 +503,4 @@
     ->execute()
     ->fetchField();
   return (int)$node_status;
-}
\ No newline at end of file
+}
diff --git a/sites/all/modules/simpleads/simpleads.api.php b/sites/all/modules/simpleads/simpleads.api.php
index 5624c71..a4588bf 100644
--- a/sites/all/modules/simpleads/simpleads.api.php
+++ b/sites/all/modules/simpleads/simpleads.api.php
@@ -22,7 +22,7 @@
  * @param int $limit
  * @return type
  */
-function hook_simpleads_order($delta, $term_ids, $limit) {
+function hook_simpleads_order($delta, $term_ids, $limit, $ad_settings) {
   if ($delta == 'delta_1') {
     $query = db_select('node', 'n');
     $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
@@ -96,4 +96,4 @@
  *
  * @param object $node
  */
-function hook_simpleads_ad_impression($op, $node) {}
\ No newline at end of file
+function hook_simpleads_ad_impression($op, $node) {}
diff --git a/sites/all/modules/simpleads/simpleads.js b/sites/all/modules/simpleads/simpleads.js
index b88c6de..6e16af4 100644
--- a/sites/all/modules/simpleads/simpleads.js
+++ b/sites/all/modules/simpleads/simpleads.js
@@ -28,6 +28,11 @@
       $('form#block-admin-configure #edit-ads-rotation-type').change(function(){
         _simpelads_switch_block_settings($(this).val(), 'delay');
       });
+      var ads_order = $('form#block-admin-configure #edit-ads-order').val();
+      _simpelads_switch_block_setting_view(ads_order);
+      $('form#block-admin-configure #edit-ads-order').change(function(){
+        _simpelads_switch_block_setting_view($(this).val());
+      });
     }
   };
 }(jQuery));
@@ -69,6 +74,30 @@
       el_flash.show();
       el_image.hide();
       el_text.hide();
+    }
+  }(jQuery));
+}
+
+/**
+ * Show/hide block settings.
+ */
+function _simpelads_switch_block_setting_view(ad_order_option) {
+  (function ($) {
+    ads_order_setting_view = $('form#block-admin-configure .form-item-ads-order-setting-view');
+    ads_order_setting_view_arguments = $('form#block-admin-configure .form-item-ads-order-setting-view-arguments');
+    ads_order_setting_new_items_bottom_list = $('form#block-admin-configure .form-item-ads-order-setting-new-items-bottom-list');
+
+    if(ads_order_setting_view.length) {
+      if (ad_order_option == 'draggableviews_asc' || ad_order_option == 'draggableviews_desc') {
+        ads_order_setting_view.show();
+        ads_order_setting_view_arguments.show();
+        ads_order_setting_new_items_bottom_list.show();
+      }
+      else {
+        ads_order_setting_view.hide();
+        ads_order_setting_view_arguments.hide();
+        ads_order_setting_new_items_bottom_list.hide();
+      }
     }
   }(jQuery));
 }
@@ -140,7 +169,7 @@
     return this.each(function(){
       (new $.simpleads_rotator($(this), options));
     });
-  }
+  };
 
   function run_rotation(element, options) {
     elem_id = element.attr('id');
@@ -154,7 +183,7 @@
 
     $('#' + elem_id + " div").hide();
     var simpleads_elem = $('#' + elem_id + " > div:eq(" + $.simpleads_globals.pos[options.delta] + ")");
-    
+
     if (options.rotation_type == 1) {
       simpleads_elem.show();
     }
@@ -168,7 +197,7 @@
   }
 
   function simpleads_start(element, options) {
-    run_rotation(element, options); 
+    run_rotation(element, options);
     setInterval(function(){run_rotation(element, options);}, options.delay);
   }
 
@@ -178,4 +207,4 @@
     delta: 0
   };
 
-}(jQuery));
\ No newline at end of file
+}(jQuery));
diff --git a/sites/all/modules/simpleads/simpleads.module b/sites/all/modules/simpleads/simpleads.module
index b7881bd..d0d30b2 100644
--- a/sites/all/modules/simpleads/simpleads.module
+++ b/sites/all/modules/simpleads/simpleads.module
@@ -210,6 +210,9 @@
       'block_delta' => $block_delta,
       'ads_page' => '',
       'ads_order' => 0,
+      'ads_order_setting_view' => '',
+      'ads_order_setting_view_arguments' => '',
+      'ads_order_setting_new_items_bottom_list' => '',
     );
 
     db_insert('simpleads_blocks')
@@ -260,7 +263,10 @@
           'ads_limit' => $data['ads_limit'],
           'ads_page' => $data['ads_page'],
           'ads_width' => $data['ads_width'],
-          'ads_height' => $data['ads_height'])
+          'ads_height' => $data['ads_height'],
+          'ads_order_setting_view' => !empty($data['ads_order_setting_view']) ? $data['ads_order_setting_view'] : '',
+          'ads_order_setting_view_arguments' => !empty($data['ads_order_setting_view_arguments']) ? $data['ads_order_setting_view_arguments'] : '',
+          'ads_order_setting_new_items_bottom_list' => !empty($data['ads_order_setting_new_items_bottom_list']) ? $data['ads_order_setting_new_items_bottom_list'] : '')
         ),
       );
     }
@@ -318,6 +324,32 @@
         '#default_value' => isset($data['ads_order']) ? $data['ads_order'] : 'random',
         '#options' => $order_options,
       );
+      if(module_exists('draggableviews')){
+        $form['ads_order_setting_view'] = array(
+          '#title' => t('Select Ads order view'),
+          '#description' => t('Select the View used to sort this group of Ads.'),
+          '#type' => 'select',
+          '#options' => _draggableviews_get_views_options(),
+          '#default_value' => !empty($data['ads_order_setting_view']) ? check_plain($data['ads_order_setting_view']) : '',
+        );
+        $form['ads_order_setting_view_arguments'] = array(
+          '#title' => t('Ads order view arguments'),
+          '#description' => t('Select the View used to sort this group of Ads.'),
+          '#type' => 'radios',
+          '#options' => array(
+            'field_ad_category_tid' => t('Use the category Term Id'),
+            'none' => t('Do not use any arguments (use empty arguments)'),
+            'ignore' => t('Ignore arguments (no argument condition will be used). Be careful, this option can generate undesired results'),
+          ),
+          '#default_value' => !empty($data['ads_order_setting_view_arguments']) ? check_plain($data['ads_order_setting_view_arguments']) : 'field_ad_category_tid',
+        );
+        $form['ads_order_setting_new_items_bottom_list'] = array(
+          '#type' => 'checkbox',
+          '#title' => t('New items appear bottom of the list'),
+          '#description' => t('New items means elements (for example nodes) that do not have saved weight (newly created).'),
+          '#default_value' => !empty($data['ads_order_setting_new_items_bottom_list']) ? check_plain($data['ads_order_setting_new_items_bottom_list']) : FALSE,
+        );
+      }
       $effects = _simpleads_rotation_effects();
       $form['ads_rotation_type'] = array(
         '#type' => 'select',
@@ -356,6 +388,11 @@
       $data['ads_order'] = $edit['ads_order'];
       $data['ads_rotation_type'] = $edit['ads_rotation_type'];
       $data['ads_rotation_delay'] = $edit['ads_rotation_delay'];
+      if(module_exists('draggableviews')){
+        $data['ads_order_setting_view'] = $edit['ads_order_setting_view'];
+        $data['ads_order_setting_view_arguments'] = $edit['ads_order_setting_view_arguments'];
+        $data['ads_order_setting_new_items_bottom_list'] = $edit['ads_order_setting_new_items_bottom_list'];
+      }
 
       db_update('simpleads_blocks')
       ->fields(array(
@@ -610,6 +647,11 @@
   $delta['order_modified_desc'] = t('Order by modifed date DESC');
   $delta['order_title_asc'] = t('Order by node title ASC');
 
+  if(module_exists('draggableviews')){
+    $delta['draggableviews_asc'] = t('Order by draggableviews weight ASC');
+    $delta['draggableviews_desc'] = t('Order by draggableviews weight DESC');
+  }
+
   // Nodequeue module integration
   if (module_exists('nodequeue')) {
     $qids = nodequeue_get_qids('simpleads');
@@ -624,7 +666,7 @@
 /**
  * Implements hook_simpleads_order().
  */
-function simpleads_simpleads_order($delta, $term_ids, $limit) {
+function simpleads_simpleads_order($delta, $term_ids, $limit, $ad_settings) {
 
   $query = db_select('node', 'n');
   $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
@@ -658,6 +700,66 @@
     $query->orderBy('n.title', 'ASC');
     return $query->execute();
   }
+
+  // Order by draggableviews weight ASC / DESC
+  if (module_exists('draggableviews') && ($delta == 'draggableviews_asc' || $delta == 'draggableviews_desc')) {
+    if (!empty($ad_settings['ads_order_setting_view'])) {
+      if (!empty($ad_settings['ads_order_setting_view_arguments'])) {
+        if ($ad_settings['ads_order_setting_view_arguments'] == 'none') {
+          $view_arguments = array();
+        }
+        elseif ($ad_settings['ads_order_setting_view_arguments'] == 'field_ad_category_tid') {
+          if (count($term_ids)==1) {
+            $view_arguments = array();
+            $view_arguments['field_ad_category_tid'] = $term_ids[0];
+          }
+          else {
+            foreach($term_ids as $tid) {
+              $view_arguments['field_ad_category_tid'][] = array($tid => $tid);
+            }
+          }
+        }
+      }
+
+      // LEFT JOIN to include ads that have been not ordered yet, so they are not
+      // in the draggableviews structure
+      $view_parts = explode(':', $ad_settings['ads_order_setting_view']);
+      $view_argument_join = '';//empty($view_arguments) ? '' : ' AND dv.args = \''.json_encode($view_arguments).'\'';
+      $query->leftJoin('draggableviews_structure', 'dv', 'n.nid = dv.entity_id AND dv.view_name = \''.$view_parts[0].'\' AND dv.view_display = \''.$view_parts[1].'\''.$view_argument_join);
+
+      // When using dv.args='json_encode($view_arguments)' in the leftJoin, it
+      // does not joins correctly. Using OR in the WHERE clause is a workaround
+      if (!empty($view_arguments)) {
+        $or = db_or();
+        $or->condition('dv.args', json_encode($view_arguments));
+        $or->isNull('dv.args');
+        $query->condition($or);
+      }
+
+      // Define the orderBy
+      $ads_order_setting_new_items_bottom_list = !empty($ad_settings['ads_order_setting_new_items_bottom_list']) ? $ad_settings['ads_order_setting_new_items_bottom_list'] : NULL;
+      if(empty($ads_order_setting_new_items_bottom_list) || !$ads_order_setting_new_items_bottom_list) {
+        if ($delta == 'draggableviews_asc') {
+          $query->orderBy('dv.weight', 'ASC');
+        }
+        else {
+          $query->orderBy('COALESCE(dv.weight, 2147483647)', 'DESC');
+        }
+
+      }
+      else {
+        if ($delta == 'draggableviews_asc') {
+          $query->orderBy('COALESCE(dv.weight, 2147483647)', 'ASC');
+        }
+        else {
+          $query->orderBy('dv.weight', 'DESC');
+        }
+      }
+
+      return $query->execute();
+    }
+  }
+
   // Nodequeue module integration
   if (module_exists('nodequeue')) {
     $qids = nodequeue_get_qids('simpleads');
@@ -763,4 +865,4 @@
 
   }
 
-}
\ No newline at end of file
+}