Hi,
The methods offer in 3.0 Ecommerce is limited, but the custom query won't be needed as there's one query that should work for your aim. Instead of the construction directly over the OrderItem object collection (which is not available in 3.x and even next two versions)...
foreach(OrderItemInfo item in order) //How do I manipulate each order item row here prior to invoice generation?
The way to get the items of an order is through the
ecommerce.orderitem.selectallbyorderid query:
GeneralConnection conn = ConnectionHelper.GetConnection();
object[,] parameters = new object[1, 3];
parameters[0, 0] = "@OrderId";
parameters[0, 1] = orderId;
// Get dataset with all order items
DataSet ds = conn.ExecuteQuery("ecommerce.orderitem.selectallbyorderid", parameters);
Then you need to loop through the dataset and create the item using DataRow constructor:
if (ds.Tables.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
OrderItemInfo item = new OrderItemInfo(dr);
//use and process the item as you need
}
}
If you modify the OrderItemInfo objects after the Order is saved, the original SKUs shouldn't be overwritten in the DB. The generation of an invoice is made by instantiating a new ShoppingCartInfo objects from the OrderInfo(with its OrderItems).
Anyway, the current version (7) will offer you the best customization possibilities.
Regards,
Zdenek