|
Home > Archive > Commerce Server General > August 2004 > Multiple products to select for basket in one action
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Multiple products to select for basket in one action
|
|
|
| Hi,
We would like to have the option that the user can add into the basket also
related products. So the product is shown and the related products are.
We would like to have the user to buy in once action the main product
including selected related items.
Anyone suggestions on how to do this? Is standard Commerce Server available?
Thanks,
Matthys van Leeuwen
| |
| Israel Vega 2004-08-19, 2:48 am |
| Here is a code fragment to search for and fetch a related product. Once you
have it, you can add it to the basket. You can perform this code in the
basket or on the "add to cart" action.
//Get the parent product
Product curProduct = CommerceContext.Current.CatalogSystem.GetCatalog("Your
Catalog Name").GetProduct("The product ID that has related products");
//**Check to see if the product has related products
DataSet relProductsDS = curProduct.GetRelatedProducts();
if (relProductsDS .Tables[0].Rows.Count > 0)
{
//**There are relationships set up, get the products
for (int i=0;i<relProductsDS.Tables[0].Rows.Count;i++)
{
//**Add evaluation logic here to filter the product
relationship in case you have more than one relationship
Product relProduct = curCatSystem.GetCatalog("Your Catalog
Name").GetProduct(relProductsDS.Tables[0].Rows[i]["Your Product ID
KEY"].ToString());
//**Now you can add the related product to the cart
//*break;
}
"Matt" <Matt@discussions.microsoft.com> wrote in message
news:5BFA3039-95B8-4981-BB5B-19AEDE56390F@microsoft.com...
> Hi,
>
> We would like to have the option that the user can add into the basket
also
> related products. So the product is shown and the related products are.
>
> We would like to have the user to buy in once action the main product
> including selected related items.
>
> Anyone suggestions on how to do this? Is standard Commerce Server
available?
>
> Thanks,
>
> Matthys van Leeuwen
|
|
|
|
|