Commerce Server General - Looping through line items to search for a specific ProductId

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > March 2005 > Looping through line items to search for a specific ProductId





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 Looping through line items to search for a specific ProductId
Tbone

2005-03-04, 5:49 pm

We have an item that is designated to ship free. I've been tasked to put any
order that contains this free shipping item on hold. That is to prevent our
BizTalk adaptor from sending this order to our legacy transaction system.

The code exist to put orders on hold for various reasons and I'm trying to
leverage this functionality.

What I need to do is to loop through the LineItem.ProductId of all items in
a cart and determine if any of those items are the free shipping item.

This is a C# commerce site. I'm new to the lanquage and the APIs.

If anyone has something to share to point me in a direction the help would
be most appreciated.
Sudha Raghavan [MSFT]

2005-03-23, 6:01 pm

Assuming that you are on CS2002 + Fp1, you could try something like this

foreach (OrderForm orderForm in basket.OrderForms)
{
foreach (LineItem lineItem in orderForm.LineItems)
{
Product prod =
catalogContext.GetProduct(lineItem.ProductCatalog, lineItem.ProductId,
lineItem.ProductVariantId);
if
(prod.Information.CatalogItems.Rows[0]["YourPropertyName"].ToString().Equals
("Free shipping"))
{
//Put the "basket" on hold
break;
}

Thanks
Sudha

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

--------------------
Thread-Topic: Looping through line items to search for a specific ProductId
thread-index: AcUg+WDDnvN6Ld1ISsSGmNIOamlaAA==
X-WBNR-Posting-Host: 64.3.182.226
From: "=?Utf-8?B?VGJvbmU=?=" <Tbone@discussions.microsoft.com>
Subject: Looping through line items to search for a specific ProductId
Date: Fri, 4 Mar 2005 12:33:09 -0800
Lines: 14
Message-ID: <1EFC0A79-76CD-4F4B-8DFE-9FECD7262918@microsoft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.commerceserver.general:15710
X-Tomcat-NG: microsoft.public.commerceserver.general

We have an item that is designated to ship free. I've been tasked to put
any
order that contains this free shipping item on hold. That is to prevent our
BizTalk adaptor from sending this order to our legacy transaction system.

The code exist to put orders on hold for various reasons and I'm trying to
leverage this functionality.

What I need to do is to loop through the LineItem.ProductId of all items in
a cart and determine if any of those items are the free shipping item.

This is a C# commerce site. I'm new to the lanquage and the APIs.

If anyone has something to share to point me in a direction the help would
be most appreciated.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com