Discount Coupons

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
I am having a lot of trouble getting discount coupons to work for a specific category.

This is what is populated in Nop_discounts

11928  2  1  CODE  1  10.0000  0.0000  2010-05-14 00:00:00.000  2011-05-20 00:00:00.000  1  CODE  0  0

Nop_DiscountType = 2
Nop_DiscountRequirement = 1
Nop_DiscountLimitation = 0

I then went and did a SQL to insert the CODE into the Nop_Category_Discount_Mapping
and I did this for the discount code and the 2 categories where I want the code to work (Can't use admin console because it literally takes 45 minutes just to load a tree view for my categories - I'll fix that later)

When I add products to my card that are part of the categories added to the Nop_Category_Discount_Mapping nothing happens when I apply the coupon code.

I have tried to trace the code and I can see the following:
GetAllowedDiscounts in the PriceHelper is looping through the categories to see if there is a discount for the category but category.Discounts is not populated.

var productCategories = CategoryManager.GetProductCategoriesByProductID(productVariant.ProductID);
            foreach (var _productCategory in productCategories)
            {
                var category = _productCategory.Category;
                if (category != null)
                {
                    foreach (var _discount in category.Discounts)
                    
I tried to see where this get's populates and checked the reader as well as the stored procedures but doesn't see where it is populating category.Discounts
GetCategoryFromReader in SQLCategryProvider - I don't see the category.Discounts here either

Please help
13 лет назад
Is there ANYONE in the nopcommerce team that can just tell me where the discount codes assosiated with the categories are retrieved so that I can see why the discount code is not displayed in the category.discount of the object.  I really need to get this to work as soon as possible.
13 лет назад
i don't follow what you are trying to do

are you just trying to apply  a particular discount to an entire category?
13 лет назад
That's it - it is all I am trying to do and it is not working for me.

I created the discount (values specified above) and then I associated the discount with a category but whenever I add products from that category in my cart, and type in the discount code and click apply discount nothing happens.

I am trying to troubleshoot and have tracked it down to where the categories are retrieved for a specific product and then the code checks to see if the discount code entered match a discount code on the category.  The problem is that my Category object shows 0 where the discount code is suppose to be.

I can't find anywhere in the code or stored procedures where the discount code is retrieved from the Nop_Category_Discount_Mapping and associated with the particular category.  All I need to know is where this code is so that I can see why it is not applying the discount for my category.
13 лет назад
If you are trying to create a coupon that allows one customer to  get a discount from only one of your categories, i don't think you can (not without code modification at least)

but if you want to create a discount that applies to a category - you can do this and the discount will be applied to any items from that category which are put into the cart - you would not have to enter a coupon, the discount would happen automatically

when you create the discount, make it apply to product sku's

and don't tick 'requires coupon code'

Discount limitation =   unlimited


then you go into the category and assign this new discount to the category
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.