Hello,
You're right, the solution will be to change these lines :
$ct = count($pkg_values);
$x = 1;
foreach($pkg_values as $pkg) {
if($pkg['PackageWeight']['UnitOfMeasurement']['Code'] == "LBS"){
$uom = "LB";
} else {
$uom = $pkg["PackageWeight"]["UnitOfMeasurement"]['Code'];
}
if(is_array($pkg['Dimensions'])){
$dimensions = array("Dimensions"=>array(
'Length' => $pkg['Dimensions']['Length'],
'Width' => $pkg['Dimensions']['Width'],
'Height' => $pkg['Dimensions']['Height'],
'Units' => $pkg['Dimensions']['UnitOfMeasurement']['Code'])
);
}
$packageLineItem = array(
'SequenceNumber'=>$x,
'GroupPackageCount'=>$ct,
'Weight' => array(
'Value' => $pkg['PackageWeight']['Weight'],
'Units' => $uom
),
$dimensions
);
$x++;
}
);
By:
$x = 0;
foreach($pkg_values as $pkg) {
if($pkg['PackageWeight']['UnitOfMeasurement']['Code'] == "LBS"){
$uom = "LB";
} else {
$uom = $pkg["PackageWeight"]["UnitOfMeasurement"]['Code'];
}
if(is_array($pkg['Dimensions'])){
$dimensions = array("Dimensions"=>array(
'Length' => $pkg['Dimensions']['Length'],
'Width' => $pkg['Dimensions']['Width'],
'Height' => $pkg['Dimensions']['Height'],
'Units' => $pkg['Dimensions']['UnitOfMeasurement']['Code'])
);
}
$packageLineItem[$x] = array(
'SequenceNumber'=>$x+1,
'GroupPackageCount'=>1,
'Weight' => array(
'Value' => $pkg['PackageWeight']['Weight'],
'Units' => $uom
),
$dimensions
);
$x++;
}
);
And change these lines :
}
if(($this->freight==true && $this->classicMethod==false) || ($heavyProduct==true && $this->freight==true))
$data['XMLpackage'].=$this->_createPackage($data, $product, $rate, $order );
else
$data['XMLpackage'].=$this->_createPackage($data, $product, $rate, $order, true );
By :
if(($this->freight==true && $this->classicMethod==false) || ($heavyProduct==true && $this->freight==true))
$data['XMLpackage'].=$this->_createPackage($data, $product, $rate, $order );
else
$data['XMLpackage'].=$this->_createPackage($data, $product, $rate, $order, true );
}
Thanks for your feedback.