Variable price kits don't use new price in the cart

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
SteveHiner
Lieutenant (LT)
Lieutenant (LT)
Posts: 58
Joined: Thu Jun 21, 2007 8:27 pm

Variable price kits don't use new price in the cart

Post by SteveHiner » Mon Nov 28, 2011 2:29 am

We're using the variable price feature combined with some custom fields to handle quantity discounts on our site. When an item is added to the basket the correct price is calculated and the basket item is added after changing the Price property to the desired price. This works great on the site, however, we recently added a kit to the site with the same type of quantity discount. I've found that when the kit is added to the cart the codebehind properly sets the price and saves the BasketItem into the cart but when it gets to the mini-cart or the main cart the base price is shown rather than the value the Price property was set to.

Is there a reason kits don't use the Price property once they are added to the cart like normal products do? Is there a different way to handle this with kits? What we are doing is working so well with products I'd love to be able to use the same technique with kits if at all possible. I noticed that there is a KitPrice property but it's read-only. I have verified that the KitPrice gets set to the new discounted price once I have changed the Price property so I know the BasketItem is set up correctly (at least as far as I know how to set it up).

Thank you in advance for any help or ideas.
Steve

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

Re: Variable price kits don't use new price in the cart

Post by AbleMods » Tue Nov 29, 2011 10:57 pm

SteveHiner wrote:I have verified that the KitPrice gets set to the new discounted price once I have changed the Price property so I know the BasketItem is set up correctly (at least as far as I know how to set it up).
Unfortunately Able isn't going to let you get away with that. Kit prices are determined from a different set of routines.

The problem arises any time _Basket.Recalculate() is fired. Able code loops through all the basket items and force-updates any kit items with newly calculated prices, weights etc.

Here's the actual code and what specifically gets overwritten in .Recalculate():

Code: Select all

// UPDATE CALCULATED PROPERTIES
childItem.Name = kitProduct.DisplayName;
childItem.Quantity = (short)(kitProduct.Quantity * basketItem.Quantity);
childItem.TaxCodeId = product.TaxCodeId;
childItem.Shippable = product.Shippable;
childItem.Price = kitProduct.CalculatedPrice / kitProduct.Quantity; ;
childItem.Weight = kitProduct.CalculatedWeight / kitProduct.Quantity;
Any price you set manually on the object will get overridden by the above code if it's a kit item.

The only way (that I've found) to manipulate pricing on a basketitem kit component is to adjust the KitList value to point to a different kit choice with the pricing you want. Unfortunately that trick isn't going to really work for you in your situation.

I use the variable-price trick all the time, works great in about every situation except kits.
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

SteveHiner
Lieutenant (LT)
Lieutenant (LT)
Posts: 58
Joined: Thu Jun 21, 2007 8:27 pm

Re: Variable price kits don't use new price in the cart

Post by SteveHiner » Wed Nov 30, 2011 10:41 pm

AbleMods wrote:Unfortunately Able isn't going to let you get away with that. Kit prices are determined from a different set of routines.
...
I use the variable-price trick all the time, works great in about every situation except kits.
Thank you Joe. While that isn't good news at least I can stop trying. I agree, it works wonderfully for normal products. I was quite surprised that kits didn't work.
Steve

Post Reply