I am coding a custom commerce CMS in PHP.
I have been integrating the UPS XML API for getting Shipping Rates and currently have it working. I am using Mark Sandborn's PHP class http://code.google.com/p/ups-php/
The API requires input of the final package's Length, Width, Height and Weight. My product database has this info for each respective product, so no problem when someone purchases just one item. Slightly different story when multiple products are added to the cart... The final Package Weight is still easy since it I can just grab the sum of all product weights.
However what are best practices for estimating the final package's Length, Width and Height to pass to UPS when multiple products are in the cart?
Amendment
It seems to me that any developer working with the UPS API in a store environment must deal with this same issue. More so than a solution to the knapsack problem I'm hoping I am misunderstanding something about how the API works and that there's actually a simple way to deal with this or even a way to hand off this to UPS to calculate.