title: Prestashop 1.7 check available stock at final order step
body: <p>I had something working on Prestashop 1.6 to check cart quantities before the customer can buy. Here is my problem on Prestashop 1.7 :
  If a customer put an item in his cart today, he comes back in 2 days and he is still logged in. The cart is still available while the product, in reality, became out of stock.
  The customer can make the order and the quantity in my stock is -1. Since I upgraded to prestashop 1.7 it's a disaster, I have quantities at -5, -10...because if this non-checked scenario.</p>
  
  <pre><code>abstract class PaymentModule extends PaymentModuleCore
  {
      public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
          $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
          $secure_key = false, Shop $shop = null)
      {
  
          if (!isset($this-&gt;context))
              $this-&gt;context = Context::getContext();
          $this-&gt;context-&gt;cart = new Cart($id_cart);
  
          if (!$this-&gt;context-&gt;cart-&gt;checkQuantities()){
              Tools::redirect(__PS_BASE_URI__.'order.php?step=0');
          }
          return parent::validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method, $message, 
              $extra_vars, $currency_special, $dont_touch_amount, $secure_key, $shop);
      }
  }
  </code></pre>