Fatal error: Call to a member function getOrderTotal() on a non-object in .../public_html/classes/CartRule.php on line 1050

Fatal error: Call to a member function getOrderTotal() on a non-object in .../public_html/classes/CartRule.php on line 1050 is error message when you trying to manually create an order for a customer via the back office and you try to use a cart rule (voucher) in the order. If you try to confirm an order that has a cart rule applied to it, you get a whitescreen.

The solution to solved that problem is simple :
1. Backup classes/CartRule.php
2. Open CartRule.php in your favorite text editor.
3. seek line 1047 until 1061.
4. replace code from that 1047 line until 1061, with the code from below
public function getCartAverageVatRate()
    {
        //$context = Context::getContext();
        $cart=new Cart(Context::getContext()->cart->id);
        $cart_amount_ti = $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS);
        $cart_amount_te = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);

        $cart_vat_amount = $cart_amount_ti - $cart_amount_te;

        if ($cart_vat_amount == 0 || $cart_amount_te == 0)
            $cart_average_vat_rate = 0;
        else
            $cart_average_vat_rate = Tools::ps_round($cart_vat_amount / $cart_amount_te, 3);

        return (float)$cart_average_vat_rate;
    }