Page 1 of 1

Split Shipment Items Not Showing...

Posted: Mon Nov 22, 2010 9:27 am
by sweeperq
Scenario:

Customer orders 3 of an item and we only have 2 in stock. We split the order line (/Admin/Shipments/SplitShipment.aspx) so we can ship 2 right away. We ship the additional 1 when the item comes into stock.


When we split an order item line into two shipments, the item on the second shipment is not showing up on the packing slips. I could be wrong, but I think it is because of the way the split item is created:

Code: Select all

OrderItem splitItem = OrderItem.Copy(orderItem.OrderItemId, false);
From what I've seen during debugging, the orderItem.ParentItemId is equal to orderItem.OrderItemId. When a copy of that item is created using OrderItem.Copy(), the ParentItemId remains set equal to the original OrderItemId, rather than being updated to the new one or set to null. This results in the new splitItem not being shown on the packing slips because it's parent item is not a kit and does not have ItemizeChildProducts set to true.

Has anyone else encountered this?

How should I update the code?

Code: Select all

//SPLIT PART OF THIS ITEM TO ANOTHER SHIPMENT
OrderItem splitItem = OrderItem.Copy(orderItem.OrderItemId, false);
splitItem.Quantity = qty;
splitItem.OrderShipmentId = moveShipment.OrderShipmentId;
if (orderItem.ParentItemId == orderItem.OrderItemId)  // new if block
{
  splitItem.ParentItemId = 0;
}
splitItem.Save();
OR

Code: Select all

//SPLIT PART OF THIS ITEM TO ANOTHER SHIPMENT
OrderItem splitItem = OrderItem.Copy(orderItem.OrderItemId, false);
splitItem.Quantity = qty;
splitItem.OrderShipmentId = moveShipment.OrderShipmentId;
splitItem.Save();
if (orderItem.ParentItemId == orderItem.OrderItemId)  // new if block
{
  splitItem.ParentItemId = splitItem.OrderItemId;
  splitItem.Save();
}
The difference between the two is that in the first block I just set the parent to null. In the second block, I set the parent = to itself (as it appears my other order items are doing) but it requires an additional DB save.

Re: Split Shipment Items Not Showing...

Posted: Tue Nov 23, 2010 4:47 pm
by triplw
I've encounted this too on 7.0.5. Did you decide which update to use?

Re: Split Shipment Items Not Showing...

Posted: Wed Nov 24, 2010 9:07 am
by sweeperq
Yeah, since the original record had a reference to itself in the ParentId, I went with the second option. I don't like that I need 2 database updates, but its not like we're doing hundreds of them a day and you don't notice a difference in performance.

Re: Split Shipment Items Not Showing...

Posted: Mon Feb 21, 2011 2:14 pm
by Logan Rhodehamel
I ought to note the issue was tested and confirmed, and we've also gone with the second option of setting the parent to itself. The page isn't high enough traffic to justify additional optimization.