volume Discounts, implementing start and end dates

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
trice
Ensign (ENS)
Ensign (ENS)
Posts: 5
Joined: Wed Nov 05, 2008 8:29 am

volume Discounts, implementing start and end dates

Post by trice » Thu May 14, 2009 2:10 pm

I'm working on a site that is using volume discounts rather heavily. A new requirement I have is to add start/end dates to the discounts.

Unless I'm mistaken, AC doesn't have support for this. I've added a custom table to the data model to store a date range linked to a VolumeDiscountId. As far as display is concerned, I can conditionally show/hide discounts based on these custom fields. However, the discount is still applied to the basket by the Recalculate() method. I'm not sure that I can override that.

Has anyone ever attempted to integrate dates with discounts before? At this point, I'm considering handling it outside of AbleCommerce with a scheduled task that runs against the database on a regular basis. I suppose I could toggle the StoreId of the VolumeDiscount record to a dummy StoreId to inactivate it and then switch it back to the live StoreId to re-enable it.

P.S. We are using Specials, which supports dates, for the non-volume based deals.

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: volume Discounts, implementing start and end dates

Post by heinscott » Fri May 15, 2009 7:00 am

What about trying this...
After the recalculate is run, trying cycling through all the basket items, and checking to see if a discount exists, and if so, leave it in place or remove it based on the rules you setup.

like...

foreach(BasketItem bi in Token.User.Basket.Items)
{
if (bi.OrderItemType.Equals(OrderItemType.Discount))
{
....perform your checks here, to determine if discount is valid
}
}

We do something similar with our shipping methods.

Scott

trice
Ensign (ENS)
Ensign (ENS)
Posts: 5
Joined: Wed Nov 05, 2008 8:29 am

Re: volume Discounts, implementing start and end dates

Post by trice » Wed May 20, 2009 7:45 am

heinscott wrote:What about trying this...

Thanks, that helped a lot. I created a static method in a helper class that runs through the logic and performs the validation checks. There were a few different controls that were making calls to Basket.Recalculate(). I had to make sure to call this new discount validation method after each Recalculate() call and then everything looked good.

Post Reply