AndyMcKenna wrote:I'm on a modified version of 2.3 so stop me if this is fixed in a later version. I looked at GetShippingOptionRequest in CodePlex and it seemed unchanged.
I'm using the UPS plugin. I have a widget that is 5 lbs. and 12x12x2. I want to ship 5 of them. Total size should be 12x12x10, right? The CreateShippingOptionRequest class will return the sums of all the dimensions so that the UPS plugin thinks my total size is 60x60x10. The difference in shipping cost is about double from the few tests that I've ran.
From what I can tell, a more accurate way would be to get the max length, max width, and then sum the heights. That would give me a 12x12x10 total. If you threw in something that was larger like 16x10x5 that would only increase the package size by what is necessary to:
5 widgets @ 12x12x2 +
1 thing @ 16x10x5 =
--------------------------
16x12x15 total size
Hi
It still exist in 2.5 I modified this way in the getshippingoptionrequest and it gave me a better package size calculation, I can´t remember if it always requires the height to be the shortest side when making the product dimensions:
/// <returns>Total width</returns>
public decimal GetTotalWidth()
{
decimal totalWidth = decimal.Zero;
foreach (var shoppingCartItem in this.Items)
{
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
totalWidth += productVariant.Width * 1; ///shoppingCartItem.Quantity;
}
return totalWidth;
}
/// <summary>
/// Gets total length
/// </summary>
/// <returns>Total length</returns>
public decimal GetTotalLength()
{
decimal totalLength = decimal.Zero;
foreach (var shoppingCartItem in this.Items)
{
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
totalLength += productVariant.Length * 1; ///shoppingCartItem.Quantity;
}
return totalLength;
}
/// <summary>
/// Gets total height
/// </summary>
/// <returns>Total height</returns>
public decimal GetTotalHeight()
{
decimal totalHeight = decimal.Zero;
foreach (var shoppingCartItem in this.Items)
{
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
totalHeight += productVariant.Height * shoppingCartItem.Quantity;
}
return totalHeight;
}