Split Shipment Items Not Showing...
Posted: Mon Nov 22, 2010 9:27 am
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:
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?
OR
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.
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);
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();
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();
}