/** * Show the total pending order and the resulting discount amount. * * This method fails if there is no Customer logged in or if there * is some weird problem with the Discount class. * @param double $orderAmount The amount of the current order * @global array $_ARRAYLANG Language array * @return boolean True on success, false otherwise. * @author Reto Kohli <*****@*****.**> */ static function showCustomerDiscount($orderAmount) { if (!self::$objCustomer) { return false; } $objDiscount = new Discount(self::$objCustomer->id(), $orderAmount); if (!$objDiscount) { return false; } // Calculate Customer "discount". // If this is false or zero, we don't bother to set anything at all. $newTotalOrderAmount = $objDiscount->getNewTotalOrderAmount(); if ($newTotalOrderAmount) { $newDiscountAmount = $objDiscount->getNewDiscountAmount(); $totalOrderAmount = $objDiscount->getTotalOrderAmount(); $discountAmount = $objDiscount->getDiscountAmount(); self::$objTemplate->setVariable(array('SHOP_CUSTOMER_TOTAL_ORDER_AMOUNT' => number_format($totalOrderAmount, 2, '.', '') . ' ' . Currency::getActiveCurrencySymbol(), 'SHOP_CUSTOMER_DISCOUNT_AMOUNT' => number_format($discountAmount, 2, '.', '') . ' ' . Currency::getActiveCurrencySymbol(), 'SHOP_CUSTOMER_NEW_TOTAL_ORDER_AMOUNT' => number_format($newTotalOrderAmount, 2, '.', '') . ' ' . Currency::getActiveCurrencySymbol(), 'SHOP_CUSTOMER_NEW_DISCOUNT_AMOUNT' => number_format($newDiscountAmount, 2, '.', '') . ' ' . Currency::getActiveCurrencySymbol())); } return true; }