Skip to Content
0
Former Member
May 11, 2009 at 12:36 PM

Automatically process coupons on shopping cart

27 Views

Hi,

Following a very useful post on this subject I am halfway towards satisfactorily processing coupons automatically when shopping.aspx loads.

I find that sometimes the code works and other times it fails. The discount is also lost when saving a cart and retrieving it.

I have noticed that clearing the cart - so that there is no current cart ensures that the discount gets applied so the issue is with a cart pre-existing ... but exactly what else needs to be tested in the code to ensure that it fires every time shopping.aspx is loaded? I can see that this may be tied up with CustomerKey but how?

{

NPBasePage bp = (NPBasePage)Page;

NPOrder order = new NPOrder(bp.UserID, bp.SessionID);

NPOrderDiscount disc = new NPOrderDiscount("5%Discount", bp.ConnectionString);

NPOrderDiscount disc1 = new NPOrderDiscount("10%Discount", bp.ConnectionString);

try

{

disc.QualifyDiscount(order);

}

// account was not authorised to use the disc code

catch (Exception discex)

{

}

try

{

disc1.QualifyDiscount(order);

}

catch (Exception discex)

{

}