|
Home > Archive > Commerce Server General > April 2004 > [URGENT HELP] Custom Pipeline Error
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 |
[URGENT HELP] Custom Pipeline Error
|
|
| Vivianne Montalvão 2004-04-01, 1:42 pm |
| Commerce Server 2002
Retail Site (ASP)
Windows 2000 Server
Someone can help me? I created a custom component that
calculates the shipping. I registred it using the
tool "PipeReg.exe", selecting shipping stage.
When I select the shipping in the site, the error is
raised:
Commerce.MtsTxPipeline (0x80004005)
Component Execution failed for component[0x3] hr:
0x80004005 ProgID: Commerce.ShippingDiscountAdjust.1
Dictionary error: Value for key '_cy_shipping_total' in
dictionary 'Order Dict' missing (expected a variant of
type 6) (orderform=default)
Code of Component:
' Execute() -- This function gets called when the
pipeline runs
' Return 1 for Success, 2 for shopper warnings, 3 for error
Private Function IPipelineComponent_Execute(ByVal
pdispOrder As Object, ByVal pdispContext As Object, ByVal
lFlags As Long) As Long
IPipelineComponent_Execute = 1
On Error GoTo ErrorHandler
' Initialize the orderform and context dictionaries as
CDictionary's
Dim Context As CDictionary, Orderform As CDictionary
Set Context = pdispContext
Set Orderform = pdispOrder
' Shipping components commonly look at the Addresses
datastruct, and Orderform.Items, and MessageManager
Dim Items As CSimpleList, Addresses As CDictionary,
MessageManager As Object
Set Items = Orderform.Value("Items")
Set Addresses = Orderform.Value("Addresses")
Set MessageManager = Context.Value("MessageManager")
Dim AddressShipping As Dictionary
Set AddressShipping = New Dictionary
' Shipping components iterate over a list of shipments
to process
Dim Shipment As CDictionary, ShipmentsToProcess As
CSimpleList
Set ShipmentsToProcess = Context.Value
("shipments_to_process")
For Each Shipment In ShipmentsToProcess
Dim ShipmentItemTotal As Currency, Item As
CDictionary, ItemPrice As Currency, ItemIndex As Variant
Dim dWeigth As Double, priceTotal As Currency,
weigthTotal As Double
Dim dictProd As CDictionary
Set dictProd = New CDictionary
' Each Shipment dictionary contains a simplelist
of orderform ItemIndexes
ShipmentItemTotal = 0
For Each ItemIndex In Shipment.Value("ItemIndexes")
' Get the indexed item from the orderform.items
Set Item = Items(ItemIndex)
' Get any item info needed to calculate
shipment price
ItemPrice = Item.[_cy_oadjust_adjustedprice]
If IsNull(Item.Value("peso")) Then
dWeigth = 1
Else
If Item.Value("peso") < 1 Then
dWeigth = 1
Else
dWeigth = Item.Value("peso")
End If
End If
weigthTotal = weigthTotal + dWeigth
priceTotal = priceTotal + ItemPrice
Next
' You could also look at the addresss info...
' Each shipment dictionary contains a
shipping_address_id, that refers to the address dict for
the shipment
Dim ShippingAddressId As String
ShippingAddressId = Shipment.Value
("shipping_address_id")
Dim Address As CDictionary, PostalCode As
String, RegionCode As String
Dim bCapital As Boolean, iAddressItem As
Variant
bCapital = False
Set Address = Addresses.Value
(ShippingAddressId)
PostalCode = Address.Value("postal_code")
RegionCode = Address.Value("region_code")
' Compute the shipping total for the shipment
Dim ShipmentShippingPrice As Currency
ShipmentShippingPrice = CCur(getValorFrete
(PostalCode, RegionCode, priceTotal, weigthTotal, Context
("TransactionConfigConnectionString")))
Shipment.[_cy_shipping_total] = RoundCurrency
(Orderform, ShipmentShippingPrice)
Next
ErrorHandler:
IPipelineComponent_Execute = 2
End Function
| |
| Michael 2004-04-02, 11:46 am |
| The best way to troubleshoot this issue is first verify that there is a
value in the "_cy_shipping_total" property of your orderform. You can do
this by inserting a dumporder.vbs script prior to your component (see
"Displaying the Contents of an Order Form" in the Commerce Server 2002
documentation). The error 0x80004005 is usually an error received when
there is no value present in the property or there exists a mismatch
(example: expecting integer, receiving bool). The dumporder script will
assist you in determining which is the problem.
~ Michael
mmushatt@online.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2004 Microsoft Corporation. All rights
reserved.
| |
| Vinayak Tadas [MS] 2004-04-11, 4:27 pm |
| This is the response from a developer in the team
The shipping discount adjust component is failing because it expected the
key "_cy_shipping_total" to be present in the dictionary when this component
was executed. That means its a responsibility of an upstream component to
calculate the shipping total and add it with the specified key. Now since
customer has written his own component to calculate shipping total this
component must write the key "_cy_shipping_total" and must be invoked before
the shipping adjust component.
Thanks
Vinayak Tadas
Microsoft
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
Get Secure! For more info visit http://www.microsoft.com/security. Please
reply to the newsgroups only. Thanks
"Vivianne Montalvão" <vivianne.montalvao@concretesolutions.com.br> wrote in
message news:207501c41816$3e4e4300$7d02280a@phx.gbl...
> Commerce Server 2002
> Retail Site (ASP)
> Windows 2000 Server
>
> Someone can help me? I created a custom component that
> calculates the shipping. I registred it using the
> tool "PipeReg.exe", selecting shipping stage.
> When I select the shipping in the site, the error is
> raised:
>
> Commerce.MtsTxPipeline (0x80004005)
> Component Execution failed for component[0x3] hr:
> 0x80004005 ProgID: Commerce.ShippingDiscountAdjust.1
> Dictionary error: Value for key '_cy_shipping_total' in
> dictionary 'Order Dict' missing (expected a variant of
> type 6) (orderform=default)
>
>
> Code of Component:
>
>
> ' Execute() -- This function gets called when the
> pipeline runs
> ' Return 1 for Success, 2 for shopper warnings, 3 for error
> Private Function IPipelineComponent_Execute(ByVal
> pdispOrder As Object, ByVal pdispContext As Object, ByVal
> lFlags As Long) As Long
> IPipelineComponent_Execute = 1
>
> On Error GoTo ErrorHandler
> ' Initialize the orderform and context dictionaries as
> CDictionary's
> Dim Context As CDictionary, Orderform As CDictionary
> Set Context = pdispContext
> Set Orderform = pdispOrder
>
> ' Shipping components commonly look at the Addresses
> datastruct, and Orderform.Items, and MessageManager
> Dim Items As CSimpleList, Addresses As CDictionary,
> MessageManager As Object
> Set Items = Orderform.Value("Items")
> Set Addresses = Orderform.Value("Addresses")
> Set MessageManager = Context.Value("MessageManager")
>
> Dim AddressShipping As Dictionary
> Set AddressShipping = New Dictionary
>
> ' Shipping components iterate over a list of shipments
> to process
> Dim Shipment As CDictionary, ShipmentsToProcess As
> CSimpleList
> Set ShipmentsToProcess = Context.Value
> ("shipments_to_process")
> For Each Shipment In ShipmentsToProcess
> Dim ShipmentItemTotal As Currency, Item As
> CDictionary, ItemPrice As Currency, ItemIndex As Variant
> Dim dWeigth As Double, priceTotal As Currency,
> weigthTotal As Double
>
> Dim dictProd As CDictionary
> Set dictProd = New CDictionary
>
> ' Each Shipment dictionary contains a simplelist
> of orderform ItemIndexes
>
> ShipmentItemTotal = 0
> For Each ItemIndex In Shipment.Value("ItemIndexes")
> ' Get the indexed item from the orderform.items
> Set Item = Items(ItemIndex)
> ' Get any item info needed to calculate
> shipment price
> ItemPrice = Item.[_cy_oadjust_adjustedprice]
> If IsNull(Item.Value("peso")) Then
> dWeigth = 1
> Else
> If Item.Value("peso") < 1 Then
> dWeigth = 1
> Else
> dWeigth = Item.Value("peso")
> End If
> End If
> weigthTotal = weigthTotal + dWeigth
> priceTotal = priceTotal + ItemPrice
> Next
>
> ' You could also look at the addresss info...
> ' Each shipment dictionary contains a
> shipping_address_id, that refers to the address dict for
> the shipment
> Dim ShippingAddressId As String
>
> ShippingAddressId = Shipment.Value
> ("shipping_address_id")
>
> Dim Address As CDictionary, PostalCode As
> String, RegionCode As String
> Dim bCapital As Boolean, iAddressItem As
> Variant
>
> bCapital = False
>
> Set Address = Addresses.Value
> (ShippingAddressId)
>
> PostalCode = Address.Value("postal_code")
> RegionCode = Address.Value("region_code")
>
> ' Compute the shipping total for the shipment
> Dim ShipmentShippingPrice As Currency
>
> ShipmentShippingPrice = CCur(getValorFrete
> (PostalCode, RegionCode, priceTotal, weigthTotal, Context
> ("TransactionConfigConnectionString")))
>
> Shipment.[_cy_shipping_total] = RoundCurrency
> (Orderform, ShipmentShippingPrice)
>
> Next
>
> ErrorHandler:
> IPipelineComponent_Execute = 2
>
> End Function
>
>
|
|
|
|
|