Split Shipment Items Not Showing...

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sweeperq
Commodore (COMO)
Commodore (COMO)
Posts: 497
Joined: Tue Jan 03, 2006 2:45 pm

Split Shipment Items Not Showing...

Post by sweeperq » 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:

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.

User avatar
triplw
Commander (CMDR)
Commander (CMDR)
Posts: 144
Joined: Sat Jan 12, 2008 5:34 pm
Contact:

Re: Split Shipment Items Not Showing...

Post by triplw » Tue Nov 23, 2010 4:47 pm

I've encounted this too on 7.0.5. Did you decide which update to use?

sweeperq
Commodore (COMO)
Commodore (COMO)
Posts: 497
Joined: Tue Jan 03, 2006 2:45 pm

Re: Split Shipment Items Not Showing...

Post by sweeperq » Wed Nov 24, 2010 9:07 am

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.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Split Shipment Items Not Showing...

Post by Logan Rhodehamel » Mon Feb 21, 2011 2:14 pm

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.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Post Reply