wholesale for some customers

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
ryanstowasser
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 90
Joined: Tue Oct 30, 2007 4:28 pm
Contact:

wholesale for some customers

Post by ryanstowasser » Fri Aug 22, 2008 5:44 pm

I have set up a wholesale user group and all wholesale usergroup members get a percentage discount.

I set this up my creating a volume discount and applying the percentage discount, set discount scope to global and selected my user group.

The discount works great on the basket page.

Now I need to display the discounted price on the product detail page, and on the category page if the logged in user is part of the wholesale user group.

I need to know if a customer is part of the wholesale user group and also the discounted price.

So far I have this:

Code: Select all

     if (!Token.Instance.User.IsAnonymous)
                        {
                            VolumeDiscountCollection VolumeDiscounts = VolumeDiscountDataSource.LoadForProduct(product.ProductId);
                            foreach (VolumeDiscount discount in VolumeDiscounts)
                            {
                                if(discount.IsValidForUser(Token.Instance.User))
                                {
                                    //discount.CalculateDiscount(1,1,product.Price,);
                                    _IsWholesale = true;
                                }
                            }
                        }
This is all written in the ProductHelper file. Has anyone else done this before?

Thanks for the help,

Ryan

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: wholesale for some customers

Post by AbleMods » Sun Aug 24, 2008 11:16 pm

Volume discounts can already be assigned to specific groups.

Why are you modifying producthelper?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: wholesale for some customers

Post by Robbie@FireFold » Mon Aug 25, 2008 7:56 am

He is trying to display the correct discount on the product page. This is something I require also.

I was told by AblePartners it was impossible, but I find that hard to believe. Considering every software I have worked with does this feature out of the box.

Wish I could help, but coding is not our thing.
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: wholesale for some customers

Post by AbleMods » Mon Aug 25, 2008 8:01 am

No way?? It'll take the discount but it won't show the discount on the product page???
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: wholesale for some customers

Post by Robbie@FireFold » Mon Aug 25, 2008 8:12 am

If its not public it will not show the discount.

I.e. Product costs $10.00. I give a special group 50% off.

Product page says - $10.00.
What we would like the product page to show: $5.00

The discount does take, but again only shown at check out.
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: wholesale for some customers

Post by AbleMods » Mon Aug 25, 2008 8:31 am

"Not Public" as in the product record visibility setting or "Not Public" as in the user is part of a user group and thus the discount only applies to group members?
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: wholesale for some customers

Post by AbleMods » Mon Aug 25, 2008 8:33 am

but wait...it's a volume discount. The system is only going to be able to take a discount on the product page if the basket total currently qualifies. That may be why Able chose to apply them during checkout - at that point the basket contents are committed.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: wholesale for some customers

Post by Robbie@FireFold » Mon Aug 25, 2008 8:38 am

SolunarServices wrote:"Not Public" as in the product record visibility setting or "Not Public" as in the user is part of a user group and thus the discount only applies to group members?
Group wise.

Product would be public
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: wholesale for some customers

Post by Robbie@FireFold » Mon Aug 25, 2008 8:46 am

This is similar: viewtopic.php?f=45&t=7948
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

User avatar
ryanstowasser
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 90
Joined: Tue Oct 30, 2007 4:28 pm
Contact:

Re: wholesale for some customers

Post by ryanstowasser » Tue Sep 02, 2008 5:27 pm

I have everything working except the CalulateDiscount function. Does anyone know how this function works?

Code: Select all

  if (!Token.Instance.User.IsAnonymous)
                        {
                            VolumeDiscountCollection VolumeDiscounts = VolumeDiscountDataSource.LoadForStore();
                            foreach (VolumeDiscount discount in VolumeDiscounts)
                            {
                                if(discount.IsValidForUser(Token.Instance.User))
                                {
                                    discountedPrice = discount.CalculateDiscount(1, 1, discountedPrice, discountedPrice);
                                }
                            }
                        }

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: wholesale for some customers

Post by nickc » Tue Sep 02, 2008 6:16 pm

public LSDecimal CalculateDiscount(
int totalQuantity,
LSDecimal lineItemValue,
LSDecimal totalValue
)

totalQuantity (Int32)
Quantity of product (or line item) to be discounted.

lineItemValue (LSDecimal)
Extended Price of product (or line item) to be discounted.

totalValue (LSDecimal)
If grouping discount mode is enabled, this is the total Extended Price of all products from the same category; if line item discount mode is enabled, this should be the same value as lineItemValue.

Return Value
The calculated discount

User avatar
ryanstowasser
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 90
Joined: Tue Oct 30, 2007 4:28 pm
Contact:

Re: wholesale for some customers

Post by ryanstowasser » Tue Sep 02, 2008 6:47 pm

This code might help some other people out. The code displays a percentage discount on the Product Page.

The client we have does not give quantity discounts, but uses the options within Volume discounts to manage a wholesale percentage discount that is the same across a user group for all selected products or categories.

Code: Select all

 if (!Token.Instance.User.IsAnonymous)
                        {
                            VolumeDiscountCollection VolumeDiscounts = VolumeDiscountDataSource.LoadForStore();
                            foreach (VolumeDiscount discount in VolumeDiscounts)
                            {
                                if(discount.IsValidForUser(Token.Instance.User) && discount.Levels.Count > 0)
                                {
                                    //foreach (VolumeDiscountLevel level in discount.Levels)
                                    //{
                                    if (discount.Levels[0].IsPercent)
                                    {
                                        discountedPrice = discountedPrice * (1 - (discount.Levels[0].DiscountAmount / 100));
                                    }
                                    //}
                                }
                            }
                        }

Post Reply