Commerce Server General - Add to marshaled_data in BasketGroup

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > April 2004 > Add to marshaled_data in BasketGroup





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 Add to marshaled_data in BasketGroup
John

2004-04-11, 4:27 pm

Hi , I'm trying to add a custom key/value entry to a line item to indicate gift wrap selection, here's the code:

Dim thisOrderForm As Orders.OrderForm = _basket.OrderForms(0)
Dim orderFormDict As IDictionary = thisOrderForm.Dictionary
Dim lineItemDict As IDictionary
Dim itemsList As ISimpleList = CType(orderFormDict("Items"), ISimpleList)
Dim enu As IEnumerator = itemsList.GetEnumerator()
While enu.MoveNext
lineItemDict = CType(enu.Current(), IDictionary)
Dim liEnu As IEnumerator = lineItemDict.GetEnumerator()
If Me.Sku.CompareTo(CType(lineItemDict("product_variant_id"), String)) = 0 Then
'this is the line item
If Me.IncludeGiftWrap Then
lineItemDict("GiftWrapId") = _getGiftWrapSelection()
Else
lineItemDict("GiftWrapId") = String.Empty
End If
lineItemDict("GiftWrapMessage") = Me.GiftMessage
Exit While
End If
End While

_basket.Save()


The final line, _basket.Save() throws an error about COM mismatch. It appears to not like my adding custom properties to the line item, what am I doing wrong?

Thanks
William Hickson

2004-04-14, 3:33 pm

John,

We do this frequently in our code (C# unfortunately). Perhaps the error is
not related to the new dictionary item. Here is a snippet of our code.

_orderForm = _basket.OrderForms[_strOrderFormName];

_orderForm.LineItems[k]["cy_price_override"] =
Convert.ToDecimal(priceOverride.Text);

_basket.Save();

..

William

"John" <tmorrisnospam@firsteggnospam.com> wrote in message
news:71904EB0-616E-4AA9-A0C6-977A61257D23@microsoft.com...
> Hi , I'm trying to add a custom key/value entry to a line item to indicate

gift wrap selection, here's the code:
>
> Dim thisOrderForm As Orders.OrderForm = _basket.OrderForms(0)
> Dim orderFormDict As IDictionary = thisOrderForm.Dictionary
> Dim lineItemDict As IDictionary
> Dim itemsList As ISimpleList = CType(orderFormDict("Items"),

ISimpleList)
> Dim enu As IEnumerator = itemsList.GetEnumerator()
> While enu.MoveNext
> lineItemDict = CType(enu.Current(), IDictionary)
> Dim liEnu As IEnumerator = lineItemDict.GetEnumerator()
> If Me.Sku.CompareTo(CType(lineItemDict("product_variant_id"),

String)) = 0 Then
> 'this is the line item
> If Me.IncludeGiftWrap Then
> lineItemDict("GiftWrapId") = _getGiftWrapSelection()
> Else
> lineItemDict("GiftWrapId") = String.Empty
> End If
> lineItemDict("GiftWrapMessage") = Me.GiftMessage
> Exit While
> End If
> End While
>
> _basket.Save()
>
>
> The final line, _basket.Save() throws an error about COM mismatch. It

appears to not like my adding custom properties to the line item, what am I
doing wrong?
>
> Thanks



David Messner [MSFT]

2004-04-27, 4:35 pm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com