Vote count:
0
Alright the issue that I am having is that I need to get multiple lines into a variable to output later in the code. my $pieces variable is not returning anything, much less missing parts of it, but even the text code is not returning.
foreach($packages as $pack)
{
$weight+=$pack->weight;
$items_no++;
$weight=$pack->weight;
$length=$pack->length;
$height=$pack->height;
$width=$pack->width;
$pieces .= "<piece actual_weight=".$weight." length=".$lenght." height=".$height." width=".$width.">";
}
if(!empty($post_code) && $weight>0 && $items_no>0)
{
$data='?shipment='.urlencode('<shipment weight_system="IMPERIAL" shipper_number="'.$this->shipper_number.'" destination_postal_code="'.$post_code.'" service_type="'.$service.'">'.$pieces.'</shipment>').'&token='.$this->token;
// $woocommerce->add_message('Items No:'.$items_no.'- Postalcode:'.$post_code.'- ');
$resp=file_get_contents($this->canpar_url.$data,false,$context);
If I do this in another method that only requires a single line (getting the total weight and number of items) it works fine, but this does not return the proper shipping cost for low weight items. On a site where higher weight items is shipped the plugin works fine. However I need to modify it to work based on dimensions. The result I am looking for is something like this:
http://ift.tt/1wWgfyy
<shipment weight_system="IMPERIAL" shipper_number="42500047" destination_postal_code="M1M1M1" service_type="1">
<piece actual_wieght="7" length="24" height="24" width="24"/>
<piece actual_wieght="5" length="10" height="12" width="14"/>
</shipment>
&token=WZHBRS4KQYNA
asked 17 secs ago
Aucun commentaire:
Enregistrer un commentaire