View Single Post
  #40  
Old 12-04-2007, 12:18 PM
  Qdox's Avatar 
Qdox Qdox is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 57
 

Default Re: UPS - Setting Maximum Weight per box

Hi, for my structured I liked the one from "wsanders", althought it limits me to 2 packages of 300 but that work for me for now. I also tried the previous mod, but the calculations were not right, and this one give me a very close estimate of what I get on the ups web site while doing a manual shipment. This one works for 4.1.8.

Quote:


</ShipTo>
EOT;
#Custom Code for Orders weighing over 150lbs. change this code of mod_UPS.php after line 349.
global $cart;
$maxed_weight = 149;
if ($UPS_weight >= $maxed_weight) {
#If order weighs more than 149lbs ship 149lb packages and the remaining lbs in a package.
$maxed_outs = floor($UPS_weight/149); #number of 149lb packages
$leftover = $UPS_weight - ($maxed_outs*149); #lbs left over
for($i=0; $i < $maxed_outs; $i++){
#send all 149lb packages
$query .=<<<EOT
<Package>
<PackagingType>
<Code>$packaging_type</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>$UPS_wunit</Code>
</UnitOfMeasurement>
<Weight>$maxed_weight</Weight>
</PackageWeight>
$dimensions_query
$pkgparams
</Package>
$shipment_options_xml
$handling_xml
$negotiated_rates_xml
EOT;
}
#send the leftover weight
$query .=<<<EOT
<Package>
<PackagingType>
<Code>$packaging_type</Code>
</PackagingType>
<PackageWeight>
<UnitOfMeasurement>
<Code>$UPS_wunit</Code>
</UnitOfMeasurement>
<Weight>$leftover</Weight>
</PackageWeight>
$dimensions_query
$pkgparams
</Package>
$shipment_options_xml
$handling_xml
$negotiated_rates_xml
EOT;
}
else
{
#send one package of whatever lbs if order is under 149lbs
$query .=<<<EOT
<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
EOT;
}
$query .=<<<EOT
</Shipment>
</RatingServiceSelectionRequest>
EOT;

__________________
QdoxGroup
X-Cart version 4.1.8 Pro
HandsOnWebHosting.
Web server Apache/2.0.52 (Red Hat)
http://www.justinthenet.com/
Reply With Quote