diff --git a/commerce_stock.module b/commerce_stock.module
index 49364c5..d173f17 100644
--- a/commerce_stock.module
+++ b/commerce_stock.module
@@ -518,7 +518,6 @@ function commerce_stock_order_has_out_of_stock($order) {
  *  custom action it shows you how you can write your own custom actions
  *  to handle the add to cart
  */
-
 function commerce_stock_test_cart_action($form, &$form_state) {
   $product_id = $form_state['values']['product_id'];
   $product = commerce_product_load($product_id);
@@ -526,4 +525,142 @@ function commerce_stock_test_cart_action($form, &$form_state) {
   // Ensure that page redirects back to its original URL without losing query parameters, such as pagers.
   // @todo Remove when http://drupal.org/node/171267 is fixed.
   $form_state['redirect'] = array(current_path(), array('query' => drupal_get_query_parameters()));
+}
+
+
+/**
+ * Implaments hook_field_formatter_info().
+ */
+function commerce_stock_field_formatter_info() {
+  // Returning array.
+  $settings = array();
+  for ($i=0;$i<5;$i++) {
+           $settings['display']["$i"]['seuil'] = '';
+           $settings['display']["$i"]['message'] = '';
+           $settings['display']["$i"]['classname'] = '';
+  }
+  return array(
+      'commerce_stock_formatter' => array(
+        'label' => t('Show stock display as message'),
+        'field types' => array('number_decimal'),
+        'settings' => $settings,
+      ),
+    'commerce_stock_formatter_2' => array(
+      'label' => t('Formatted Stock level'),
+      'field types' => array('commerce_price'),
+      'settings' => array(
+        'calculation' => FALSE,
+      ),
+    ),
+
+  );
+}
+
+/**
+ * Implaments hook_field_formatter_settings_form().
+ **/
+function commerce_stock_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
+  // This gets the view_mode where our settings are stored.
+  $display = $instance['display'][$view_mode];
+  // This gets the actual settings.
+  $settings = $display['settings'];
+  //print_r($settings);
+  //Initialize the element variable
+  $element = array();
+
+  $element['display'] = array(
+    '#markup'           => '',
+    '#prefix' => '<table style="width:100%;">',
+    '#suffix' => '</table>',
+    '#tree' => TRUE,
+   );
+
+  $element['display']['header'] = array(
+    '#markup' => '<thead>
+      <tr>
+        <th style="width:150px">&nbsp;</th>
+        <th style="width:100px">Seuil</th>
+        <th  style="width:300px">Message</th>
+        <th style="width:200px">classname</th>
+      </tr>
+    </thead>',
+  );
+
+  $rows = array();
+  for ($i=0;$i<5;$i++) {
+  //Add your select box
+  //$element = array();
+
+  $element['display'][$i] = array(
+    '#prefix' => '<tr>',
+    '#suffix' => '</tr>',
+  );
+  $element['display'][$i]["text"] = array(
+    '#markup'           => '<td style="width:150px">If stock &lt;=</td>'    ,
+    '#size' => 10,
+  );
+  $element['display'][$i]["seuil"] = array(
+    '#type'           => 'textfield',
+    '#default_value'  => ($i == 0 ? "0" : $settings['display'][$i]['seuil']),
+    '#size' => 5,
+    '#disabled' => ($i == 0),
+    '#prefix' => '<td>',
+    '#suffix' => '</td>',  );
+  $element['display'][$i]["message"] = array(
+    '#type'           => 'textfield',
+    '#default_value'  => ($i == 0 ? t('Out of stock') : $settings['display'][$i]['message']),
+    '#prefix' => '<td>',
+    '#size' => 30,
+    '#suffix' => '</td>',  );
+
+  $element['display'][$i]["classname"] = array(
+    '#type'           => 'textfield',
+    '#size' => 20,
+    '#default_value'  => $settings['display'][$i]['classname'],
+    '#prefix' => '<td>',
+    '#suffix' => '</td>',  );
+  }
+  return $element;
+}
+
+
+/**
+ * Implaments hook_field_formatter_settings_summary().
+ **/
+function commerce_stock_field_formatter_settings_summary($field, $instance, $view_mode) {
+  $display = $instance['display'][$view_mode];
+  $settings = $display['settings'];
+  $summary = "";
+  foreach ($settings['display'] as  $row => $seuilstr) {
+      $seuil = $seuilstr['seuil'];
+      if ($seuil != "") {
+        $summary .= t('print @message when stock is <= @seuil', array(
+          '@seuil'     => $settings['display'][$row]['seuil'],
+          '@message'  => $settings['display'][$row]['message'],
+        )) . "<br>";
+       }
+  }
+  return $summary;
+}
+
+
+/**
+ * Implaments hook_field_formatter_view().
+ **/
+function commerce_stock_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
+  $settings = $display['settings']; // get the settings
+  $element = array(); // Initialize the var
+  $stock = round($items[0]['value']);
+  $anc_seuil = -9999999;
+  foreach ($settings['display'] as  $row => $seuilstr) {
+      $seuil = $seuilstr['seuil'];
+      if ($seuil != "") {
+        if ($stock > $anc_seuil && $stock <= $seuil) {
+            $element[0]['#markup'] = "<span class='" . $seuilstr['classname'] . "'>" . t($settings['display'][$row]['message'],array("@stock" => $stock)) . "</span>";
+            break;
+         }
+        $anc_seuil = $seuil;
+      }
   }
+  return $element;
+}
\ No newline at end of file
