I've read through the numerous posts about UPS weight limitations, no help from X-Cart devs, update in version 5, costs for custom modifications, etc, so instead of wasting time worrying about the situation, I decided I would try to take anything that was available and make it work for what I needed it to do.
I took the code from nick1628 and modified it slightly to fit into the templates for version 4.1.7. The code was completely different from the start so I had to do some trial and error. Everything looks like it is working properly, and shipping is now calculated based upon each individual product weight, then added together.
cart.php ----- original starting at line 198
Code:
#
# Add product to the cart
#
$add_product = array();
$add_product["productid"] = abs(intval($productid));
$add_product["amount"] = abs(intval($amount));
$add_product["product_options"] = $product_options;
$add_product["price"] = abs(doubleval($price));
cart.php ----- new starting at same point
Code:
#
# Add product to the cart
#
$add_product = array();
$add_product["productid"] = abs(intval($productid));
$add_product["amount"] = abs(intval($amount));
$add_product["product_options"] = $product_options;
$add_product["weight"] = $weight;
$add_product["price"] = abs(doubleval($price));
shipping/mod_UPS.php ----- original starting at line 349
Code:
</ShipTo>
<Package>
<PackagingType>
<Code>$packaging_type</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>$UPS_wunit</Code>
</UnitOfMeasurement>
<Weight>$UPS_weight</Weight>
</PackageWeight>
$dimensions_query
$pkgparams
</Package>
$shipment_options_xml
$handling_xml
$negotiated_rates_xml
</Shipment>
</RatingServiceSelectionRequest>
EOT;
shipping/mod_UPS.php ----- new starting at same point
Code:
</ShipTo>
EOT;
global $cart;
foreach($cart['products'] as $prodKey => $prodArray)
{
for($quantity=0; $quantity<$prodArray['amount'];$quantity++)
{
$prodWeight = $prodArray['weight'];
$query .=<<<EOT
<Package>
<PackagingType>
<Code>$packaging_type</Code>
</PackagingType>
<PackageWeight>
<UnitofMeasurement>
<Code>$UPS_wunit</Code>
</UnitofMeasurement>
<Weight>$prodWeight</Weight>
</PackageWeight>
$dimensions_query
$pkgparams
</Package>
$shipment_options_xml
$handling_xml
$negotiated_rates_xml
EOT;
}
}
$query .=<<<EOT
</Shipment>
</RatingServiceSelectionRequest>
EOT;
I might try to tweak this some more because my client actually ships in packages of 2. Currently the shipping is charging slightly more than it should, so we'll see what happens.