I would like to be able to create a coupon that will discount both a product and the shipping cost. Here's an example:
A customer comes to the site with a coupon code for product X and discounted shipping.
They add Product X to the cart.
During checkout they enter the coupon code.
The code will take $20 off of product X, as well as a maximum of $15 off of the shipping cost.
/end example
Has anyone been able to accomplish this using a single coupon?
I was also poking around in the database and found a table called ac_CouponCombos. Does anyone know what purpose this table serves?
Combination Coupons
Combination Coupons
Ian Keith
Vortx, Inc.
Website Design and Custom Development for E-Commerce Solutions
Vortx... very tech
Vortx, Inc.
Website Design and Custom Development for E-Commerce Solutions
Vortx... very tech
Re: Combination Coupons
I have tried to make 2 coupons both with the same code, But that dose not work. I would also like a fix for this as well.
Re: Combination Coupons
At last - validation!
No problem guys - it was a feature in AC7 RC1 (Jan '08). Just install that version
.
I went around and around this topic last spring. As of June '08 there were no plans by Able to introduce this functionality.
No problem guys - it was a feature in AC7 RC1 (Jan '08). Just install that version

I went around and around this topic last spring. As of June '08 there were no plans by Able to introduce this functionality.
Details here: http://bugs.ablecommerce.com/show_bug.cgi?id=6774nickc wrote:I'm concerned that the resolution of this issue will not result in the behavior we are looking for. During my testing and development, "Order" coupons affected the entire order - product, shipping, tax; everything, making it possible to reduce the total amount due by the site user to 0.00. Our decision to purchase Able was influenced by this behavior. However, several references made by Able staff point to a different Order coupon behavior as related to a previous version of Able software (5.5) - not affecting shipping costs. So it sounds like there is a need to develop a 4th coupon type to allow both expectations to be met.
Nick Cole
http://www.ethofy.com
http://www.ethofy.com
Re: Combination Coupons
I have been the biggest whiner about this issue; here's a solution that's (slightly) less onerous than the RC1 install and works perfectly for me - go figure
. Oh well. Eagerly awaiting the real solution from Able in 7.0.3.
Caveats:
- This is a hack. A teeny, ugly, little hack
. It does not take into account a large number of possible conditions that may occur in the world of coupons. You'd have to figure out your own specific conditions and code them.
- I use an Avalara tax provider. This was enormously helpful, as I can call a tax recalculate outside the context of a basket recalculate. Frankly, this hack is probably not worth anything without that flexibility.
Use:
Drop the text below into a class file in App_Code.
Add namespace references in basket.ascx.cs and onepagecheckout.ascx.cs.
Comment out "basket.Recalculate();" and insert "basket = CommerceHelper.Recalculate(basket);" in basket.ascx.cs and onepagecheckout.ascx.cs.

Caveats:
- This is a hack. A teeny, ugly, little hack

- I use an Avalara tax provider. This was enormously helpful, as I can call a tax recalculate outside the context of a basket recalculate. Frankly, this hack is probably not worth anything without that flexibility.
Use:
Drop the text below into a class file in App_Code.
Add namespace references in basket.ascx.cs and onepagecheckout.ascx.cs.
Comment out "basket.Recalculate();" and insert "basket = CommerceHelper.Recalculate(basket);" in basket.ascx.cs and onepagecheckout.ascx.cs.
Code: Select all
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CommerceBuilder.Orders;
using CommerceBuilder.Common;
using CommerceBuilder.Marketing;
using System.Collections.Generic;
using CommerceBuilder.Taxes;
namespace Utility.Code
{
/// <summary>
/// CommerceHelper: CommerceBuilder workarounds and wrappers
/// </summary>
public class CommerceHelper
{
/// <summary>
/// Clean up after Able's CommerceBuilder Basket.Recalculate Method
/// </summary>
/// <param name="_basket">
/// The basket object to be examined. BasketItem objects may be added or removed; value may be changed
/// </param>
/// <returns>
/// The original or an updated basket object
/// </returns>
public static Basket Recalculate(Basket _basket)
{
// Ugh. If there's another way to do this without API source, love to know how.
// TaxProviderAvalara.dll has been updated to consider shipping, handling basketitems eligible for Order type coupon discounts
// ONLY HANDLES FIXED $ ORDER COUPONS
LSDecimal shipcost = new LSDecimal(0), unusedcouponvalue;
bool IsDirty = false;
// first, call the native recalculate method
_basket.Recalculate();
// Scenario 1
// Able "Order" coupons won't affect shipping costs, but we want them to; re-align coupon objects as necessary
List<BasketItem> coupons =
_basket.Items.FindAll(delegate(BasketItem t) { return t.OrderItemType == OrderItemType.Coupon; });
List<BasketItem> shipments =
_basket.Items.FindAll(delegate(BasketItem t) { return t.OrderItemType == OrderItemType.Shipping || t.OrderItemType == OrderItemType.Handling; });
// get the total shipping cost
foreach (BasketItem bi in shipments)
shipcost += bi.Price;
// increase coupon value to cover shipcost if appropriate
foreach (BasketItem bi in coupons)
{
Coupon coupon = CouponDataSource.LoadForCouponCode(bi.Sku);
unusedcouponvalue = bi.Price + coupon.DiscountAmount; // Price < 0
if (unusedcouponvalue > 0)
{
bi.Price -= unusedcouponvalue > shipcost ? shipcost : unusedcouponvalue;
bi.Save();
IsDirty = true;
}
}
// End Scenarios; tidy up and return the basket
if (IsDirty)
{
_basket.Save();
_basket = AdjustBasketTax(_basket);
}
return _basket;
}
private static Basket AdjustBasketTax(Basket _basket)
{
// get hold of tax gateway, call calculate method
TaxGateway tg = Token.Instance.Store.TaxGateways.Find(delegate(TaxGateway t) { return t.Name == "Avalara AvaTax"; });
if (tg == null)
return _basket;
(tg.GetProviderInstance()).Cancel(_basket);
LSDecimal tax = (tg.GetProviderInstance()).Calculate(_basket);
return _basket;
}
}
}
Nick Cole
http://www.ethofy.com
http://www.ethofy.com
Re: Combination Coupons
Best not to revise Basket.ascx.cs after all. Corner case exists where if 2 coupons are added to the basket on checkout and one of those coupons is only affecting shipping cost, and the basket page is recalled ("Edit Order"), the modification triggers a basket validation problem and a coupon must be removed in order to return to the checkout page. Mod isn't really required on basket page anyway - it's unlikely that coupons are added prior to checkout, and even if they are, corrections will take place on checkout.
Nick Cole
http://www.ethofy.com
http://www.ethofy.com