Commerce Server General - How can i convert OrderForm("_discounts") to a simplelist

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > April 2004 > How can i convert OrderForm("_discounts") to a simplelist





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 How can i convert OrderForm("_discounts") to a simplelist
Ajay

2004-04-06, 2:35 am

I have to convert OrderForm("_discounts") to a simplelist, since i
have to search for some items . But its giving cast type error.
Actually I am working on 'Gift With Purchase', so that i have to
manually find the free items and add to basket.

Thanks for any help

Ajay
Jorge Sanchez

2004-04-06, 3:43 pm

Hi Ajay

Look at these lines, may be you can find them a little interesting.

basketDiscountListItems = CType(txContext.CartOrderForm.Item("_qualifying_discounts"), SimpleList)
allDiscounts = CType(txContext.CartOrderForm.Item("_discounts"), ContentList)
For Each basketDiscountItem In basketDiscountListItems
freeDiscount = allDiscounts.Search("item_id", basketDiscountItem)
If CInt(freeDiscount.Fields("order_level").Value) = 0 Then ' ITEMLEVEL
If CInt(freeDiscount.Fields("offer_type").Value) = 2 Then ' Percentage
If CInt(freeDiscount.Fields("offer_value").Value) = 100 Then
' Assume: EXPRESSION NAME = PRODUCT ID
tempExprID = freeDiscount.Fields("award_expr").Value
Dim prodID as String = expressionStoreObj.GetExprName(CInt(tempExprID))
' If the product doesn't have variants then you can add it to the basket.
End If
End If
End If
Next

Just for reference:

Dim tempExprID as Object
Dim basketDiscountListItems as SimpleList
Dim allDiscounts as ContentList
Dim freeDiscount as RowCollection
Dim basketDiscountItem As Object

Hope this help.

Jorge

Ajay

2004-04-07, 6:58 am

Hi Jorge,
Thanks a lot for your help. I could solve my problem.

Regards
Ajay
>-----Original Message-----
>Hi Ajay
>
>Look at these lines, may be you can find them a little

interesting.
>
> basketDiscountListItems = CType

(txContext.CartOrderForm.Item("_qualifying_discounts"),
SimpleList)
> allDiscounts = CType

(txContext.CartOrderForm.Item("_discounts"), ContentList)
> For Each basketDiscountItem In

basketDiscountListItems
> freeDiscount = allDiscounts.Search

("item_id", basketDiscountItem)
> If CInt(freeDiscount.Fields

("order_level").Value) = 0 Then ' ITEMLEVEL
> If CInt(freeDiscount.Fields

("offer_type").Value) = 2 Then ' Percentage
> If CInt(freeDiscount.Fields

("offer_value").Value) = 100 Then
> ' Assume: EXPRESSION NAME =

PRODUCT ID
> tempExprID =

freeDiscount.Fields("award_expr").Value
> Dim prodID as String =

expressionStoreObj. GetExprName(CInt(tempExprID))
> ' If the product doesn't have

variants then you can add it to the basket.
> End If
> End If
> End If
> Next
>
>Just for reference:
>
>Dim tempExprID as Object
>Dim basketDiscountListItems as SimpleList
>Dim allDiscounts as ContentList
>Dim freeDiscount as RowCollection
>Dim basketDiscountItem As Object
>
>Hope this help.
>
>Jorge
>
>.
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com