November Happy Hour will be moved to Thursday December 5th.

Error getting lineitems from shipment

Vote:
 

Hi,

Yesterday we updated to the latest epi version. We seem to have a problem getting lineitem data from a shipment now.

Before we could use shipment.LineItems to get LineItem objects including all meta data but now we get InMemoryLineItem instead which is not castable to LineItem. 

What is the thinking here, that we iterate the lineitems from a shipment, and using the lineitemid to get the real lineitem from the orderform?

#151190
Jul 13, 2016 11:00
Vote:
 

Hi,

What would you do with the LineItems? Note that once you use shipment.LineItems, you enter the realm of abstractions and you should be using abstractions all the way.

/Q

#151197
Jul 13, 2016 11:23
Vote:
 

In 9.12 it was working fine to for example do a foreach (var lineitem in shipment.LineItems) and get access to lineitem["metafieldname"], lineitem.ListPrice and so on. That's what we've done in our order history feature for example.

I've changed to fetch the "real" lineitem from the orderform to make this work. I think this should be considered a breaking change.

#151201
Jul 13, 2016 11:32
Vote:
 

Yes it is indeed a breaking change, as IShipment/ILineItem,etc. were marked as BETA and is supposed to change - until 9.19 when it comes out of BETA.

For your case, I think you should still be able to access such field - both reading and saving via ILineItem.Property 

/Q

#151203
Jul 13, 2016 11:40
Vote:
 

Alright thanks. I didn't realize it was beta. I mean Shipment.LineItems has been around for ages. 

I can accept that the underlying implementation is beta, but the property itself which has been around since Mediachase should in my opinion not be. And should not change behavior so it breaks existing implementations.

#151209
Jul 13, 2016 12:55
Vote:
 

IShipment.LineItems had been always BETA. Previously there was only OrderForm.LineItems, and then you have to call Shipment.GetShipmentLineItems to get IEnumerable<LineItem> of a shipment.

#151210
Jul 13, 2016 13:00
Vote:
 

Alright, thanks for your quick replies :)

Sorry for mixing things up.

#151211
Jul 13, 2016 13:17
Vote:
 

Also you dont need to get from the order from.  You can just use Shipment.LineItems.First().Properties["ListPrice"] = 99;  Then if you call IOrderRepostitory.Save it will sync any of the meta fields to the lineitem implementation. 

#151294
Jul 14, 2016 11:10
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.