Closed danFbach closed 4 months ago
Otherwise you could do something like:
var shipments = await _shipmentService.GetShipmentsByOrderIdAsync(order.Id);
if(shipments.Any())
{
addressResult.CustomValues.Add("Tracking Number(s)", string.Join(",", shipments.Select(s => s.TrackingNumber)));
}
To keep the model unchanged.
Hi @danFbach. I'm very sorry, it looks like this is your code, since in the function you mentioned, as well as in the entire service, I could not find this problem area, here is a link to the method in version 4.60.6
shoot, you're right, forgot I added that 🤦♂️
nopCommerce version: 4.60.6
Towards the end of the
GetShippingAddressAsync
function inPdfService
there is:Wouldn't this inherently cause an error if there is multiple shipments?
CustomValues
is aDictionary<string, object>
, so if there is > 1 shipment, you will try adding theTracking Number
key again, and throwSystem.ArgumentException: An item with the same key has already been added. Key: Tracking Number
. Perhaps this should be aList<KeyValuePair<string, object>>
instead? I am currently encountering this while generating an invoice with multiple shipments.