I have a need to add to cart from an external entity a product that has options.
http://wiki.ablecommerce.com/index.php/ ... nal_entity
I found the wiki article above, however it states that products with options can't be added.
if (product.HasChoices)
{
//CANT ADD DIRECTLY TO BASKET, SEND TO MORE INFO
Response.Redirect(product.NavigateUrl);
}
Can this be done?
Add to cart product with options
-
- Ensign (ENS)
- Posts: 5
- Joined: Sun Nov 22, 2009 7:56 pm
Re: Add to cart product with options
I have the same problem, anyone can help us out? Thanks in advance.
My web site : http://www.devisdetective.com
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Add to cart product with options
Me 3.. would love to see this option.
Re: Add to cart product with options
You can use this code:
You would have to do the validation to make sure all options have been selected.
Code: Select all
BasketItem basketItem = BasketItemDataSource.CreateForProduct(_ProductId, (short)tempQuantity, optionList, AlwaysConvert.ToList(",", _SelectedKitProducts));
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Add to cart product with options
If you are hard coding URL links then I suppose you would not need to verify it. Where would you use this code?
Re: Add to cart product with options
It's looking for
1) the product Id
2) quantity
3) a string of 8 comma separated numbers to know what options are selected. For example, if your product had 2 options the the string would be something like: 12,35,0,0,0,0,0,0
4) kit products selected
The hard part is figuring out what numbers are assigned to the different options. You could see it in the database tables: ac_products, ac_productvariants and ac_productoptions.
1) the product Id
2) quantity
3) a string of 8 comma separated numbers to know what options are selected. For example, if your product had 2 options the the string would be something like: 12,35,0,0,0,0,0,0
4) kit products selected
The hard part is figuring out what numbers are assigned to the different options. You could see it in the database tables: ac_products, ac_productvariants and ac_productoptions.