Hello guys,
In the table EcomLoyaltyUserTransaction, for lines of type EcomOrderLine, Dynamicweb is storing the OrderId and not the OrderLineId. Why is that? Even in code there are contradictions:
When you create a transaction with the LoyaltyRepository.CreateTransaction method, you fill the ObjectElement with the order line id, and then before saving the object Dynamicweb overrides the value of ObjectElement by calling this method:
Private Shared Function GetTransactionObjectElement(transaction As UserTransaction) As String
...
Return transaction.Order.Id
End Function
and the Order property on the transaction object is defined like this:
If _objectType = TransactionObjectType.EcomOrderLine Then
Dim orderLine As OrderLine = Services.OrderLines.GetById(ObjectElement)
If orderLine IsNot Nothing Then
Return orderLine.Order
End If
End If
Return Nothing
So, we are passing the OrderLineId in the ObjectElement property, and then Dynamicweb based on it overrides that value with its OrderId after getting the line, and then its order. Then, when someone will call again the Order property on that transaction, the order will not be found, as the Order property expects in the ObjectElement property to be an order line id, and not an order id.
Regards,
Emil