spree/spree — pull request #5138 by adammathys (2014-08-05 20:46:58+00:00)
Title: Tiered promotion calculator

Two simple calculators that make it possible to offer tiered discounts in promotions. Basically, they provide the ability to have a promotion that will adjust it's rate based on the order total. For example, you could set up a tiered percentage discount as follows:

Order Total | Discount
---------------|------------
$50 | 5%
$100 | 10%
$250 | 25%

Then for an order costing $127, the customer would receive a $12.70 (10%) discount. However, if the customer removed a couple of items from their cart, dropping their total to $68, the discount would only be $3.40 (5%). The calculator supports a theoretically unlimited number of tiers.

In order to make the admin usable, I updated the existing calculator views to be easily extensible. (By dynamically rendering a different partial based on which type of calculator was selected.)