[ic] proposal: Interchange6 Cart costs change

Dan Bergan danbergan at gmail.com
Mon Sep 22 15:51:19 UTC 2014


On Wed, Sep 17, 2014 at 4:43 AM, Peter Mottram <peter at sysnix.com> wrote:
>
> Yesterday I started working on extending the Interchange6::Cart costs
> framework to allow costs to be applied to cart products in addition to
> the cart itself. One major issue that was discovered is the handling of
> taxes along with discounts which is currently messed up. Having
> discussed this with racke we now propose to change the way discounts are
> handled.
>
> Currently discounts can only be applied to the cart as a whole as a
> negative cost. You may continue to do that if you wish but do NOT expect
> that to work correctly with taxes. The new proposal is as follows:
>
> Interchange6::Cart::Product will have the following attributes added:
>
> discount
> discount_percent
> original_price
> subtotal
>
> With no discount applied 'original_price' will hold the same value as
> 'price' and both discount and discount_percent will be zero. Discount
> can be applied to the product as it is added to the cart using ::Cart's
> 'add' method:
>
- snip -

+1 for this idea!  We do something very similar for our
coupon/discount processing in IC 5.x.

The only possible difference is that we always truncate the new
discounted price, rather than rounding. If we are advertising "10%
off" we want to be sure that the customer is always getting at least
10% off.  So, a calculated discount price of $9.9975 would be $9.99,
not $10.00.


>
> Currently there are no plans to allow a fixed amount of cart discount to
> be applied though this is left as a possibility for the future if there
> is demand.
>

We also take a cart discount and apply it to each item in IC 5.X (so
the taxes will come out correct.)  And, again, we want to make sure
our customers are getting the full discount amount, so a $10 off
coupon on a cart with 3 items will actually end up being $3.34 off of
each item, for a total of $10.03 discount.

Dan



More information about the interchange-users mailing list