an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Apply Coupon Code not showing up for any role e...
Last Post 8/11/2009 8:16:41 AM By lukezy. 8 replies.
8/10/2009 1:56:21 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Apply Coupon Code not showing up for any role except Admin
Hey Luke,
 
I just noticed something, Apply Coupon code on Cart.aspx page is not showing up for any of the roles except administrator. What do you think might be the problem
 
The page load looks like this
 
if (!IsPostBack)
        {
            lblCheckout.Text = (string)HttpContext.GetGlobalResourceObject("Common", "ReadyToOrder");
            btnEstimateShipping.OnClientClick = string.Format("OpenResizablePopupWindow(\"{0}\", 400, 400)", SiteNavigation.ShippingEstimatorPage);
            Block block = Block.GetByName(Constant.UI.ProductSummaryBlockName, ProductSummaryData.DefaultBlock);
            productSummaryData = Utils.FromXml<ProductSummaryData>(block.Data.ToString());
            BindControls();
            if (null != Cart)
            {
                pnlGiftWrap.Visible = CommercialStoreConfigurationSection.GetSection().GiftWrapEnabled;
                couponDiscount = CoreHelper.GetCouponAmount(Cart);
                giftCertificateTotal = CoreHelper.GetGiftCertificatesAmount();
                UpdateTotals();
            }
            if ((!Roles.IsUserInRole("Distributor")) && (!Roles.IsUserInRole("Dealer")) && (!Roles.IsUserInRole("Partner")) && (!Roles.IsUserInRole("WirelessStore")) && (!Roles.IsUserInRole("Retailer")) && (!Roles.IsUserInRole("Jober")) && (!Roles.IsUserInRole("Administrator")))
            {
                      googleCheckoutButton.Visible = false;
            }
            else
            {
                pnlInStoreCheckout.Visible = InStoreCheckoutEnabled();
                googleCheckoutButton.Visible = !WebUtils.IsDiscountGroup();
                pnlCoupon.Visible = !WebUtils.IsDiscountGroup();
            }
8/10/2009 2:11:07 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Apply Coupon Code not showing up for any role except Admin
I changed the
 
pnlCoupon.Visible = !WebUtils.IsDiscountGroup(); 
 
to
 
pnlCoupon.Visible = true
 
Now the Apply Coupon shows up but i try to apply the coupon i get this error
 
 
 
The following error(s) were found:
  • Discount Group cannot use coupon.
8/10/2009 2:29:33 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Apply Coupon Code not showing up for any role except Admin
This is rather a business rule rather than anything else. If you wish to allow coupon to be applied on top of the discount group, please feel free to remove the code that blocks using the coupon.
DotShoppingCart Staff
8/10/2009 2:47:13 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Apply Coupon Code not showing up for any role except Admin
I am not sure where its getting blocked. I don't see it getting blocked in the above code. Where else it might be getting blocked?
8/10/2009 3:28:53 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Apply Coupon Code not showing up for any role except Admin
In Coupon.cs method Validate.
DotShoppingCart Staff
8/11/2009 6:38:31 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Apply Coupon Code not showing up for any role except Admin
What does the function WebUtils.IsDiscountGroup() return?
8/11/2009 7:34:25 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Apply Coupon Code not showing up for any role except Admin
It means that the current user is in the role which has discount on all the products.
DotShoppingCart Staff
8/11/2009 8:04:23 AM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Apply Coupon Code not showing up for any role except Admin
Shouldn't this line in coupon.cs
 
if (WebUtils.IsDiscountGroup())
                throw new ApplicationException("Discount Group cannot use coupon.");
 
be
 
if (!WebUtils.IsDiscountGroup())
                throw new ApplicationException("Discount Group cannot use coupon.");
 
 
???
 
 
Because the way it is now, it says  If user is in discount role, throw the exception.
 
 
 
8/11/2009 8:16:41 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Apply Coupon Code not showing up for any role except Admin
You just need to remove the line. The business logic is the discount group cannot use coupone.
DotShoppingCart Staff