Combining Basket Items

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Combining Basket Items

Post by keats76 » Thu Apr 03, 2008 12:18 pm

Is there a way for me to ensure that the CanCombine(BasketItem) method always returns false?

I am generating custom quoted products (each product is unique). I have created some basic parent Product objects to reference with my custom BasketItems, but everytime I go to the Basket.aspx page, my unique items are lost and they are combined into one BasketItem (because they are based on the same generic product).

Any suggestions on the best method of tackling this situation?

Should I create custom Products on the fly and then associate those with the BasketItems? I like having each of my unique creations associated with a generic product, but I can't have them combined at checkout time as this doesn't make sense for my business.

Thanks,
Mike

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Combining Basket Items

Post by sohaib » Thu Apr 03, 2008 12:23 pm

What aspect of your products is different? Is it some custom field value?

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Combining Basket Items

Post by keats76 » Thu Apr 03, 2008 12:39 pm

I have a unique situation where each product I ship will be custom built from a stock set of materials. I've written a quoting plug-in to allow me to auto quote a price for each custom build based on time and materials.

Therefore, I've created some default products that represent the materials in use. I create a new BasketItem for each build and then I associate the BasketItem with my generic Product. I give my BasketItem a custom Name, Price, Quantity, and Weight.

Hopefully there is a property or something that I can set that will allow me to disable the combining features of the basket.

Thanks!
Mike

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Combining Basket Items

Post by sohaib » Thu Apr 03, 2008 1:11 pm

Just add a custom filed to the Product and make sure you have a unique value for the custom field for each unique product.

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Combining Basket Items

Post by keats76 » Thu Apr 03, 2008 1:12 pm

Thanks, I'll give it a shot!

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Combining Basket Items

Post by keats76 » Thu Apr 03, 2008 1:36 pm

I'm probably doing something wrong, but it didn't seem to work ... here is a code snippet:

ProductCustomField customField = new ProductCustomField();
customField.FieldName = part.FileName + part.Material;
customField.FieldValue = part.FileName;

BasketItem basketItem = GetBasketItem(productId);
basketItem.Product.CustomFields.Add(customField);

I created a new custom field that should always be unique, then I added the new field to the Product referenced in the basketItem. Unfortunately, AC still wants to combine the basketItems together (when the same generic product is referenced).

Any thoughts?

Thanks,
Mike

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Combining Basket Items

Post by keats76 » Thu Apr 03, 2008 2:23 pm

OK, I got it to work using a similar principal ... I created a custom LineMessage for each BasketItem. I'm guessing two BasketItems must have the same (or no) LineMessage in order to be combinable.

Coolio.

Thanks,
Mike

Post Reply