QTY
|
Product
|
Carrier
|
Charge
|
mysql_select_db('ecosmar_products', $dbcnx);
$i = 0;
while($i < $prod_count){
$getem = @mysql_query("SELECT id,productname,type,o_country,o_city,o_code,weight_lb,fixed_price,minimum,percent_of_sale FROM shipping WHERE productname='$prod_name[$i]'");
if (!$getem) {
echo('Error retrieving Shipping Data. ' . 'Error: '. mysql_error(). ' ');
}else{
$shipit = mysql_fetch_array($getem);
$id = $shipit['id'];
$productname = $shipit['productname'];
$type = $shipit['type'];
if($type == ""){
$type = 'Best';
}
$o_country = $shipit['o_country'];
$o_city = $shipit['o_city'];
$o_code = $shipit['o_code'];
$weight_lb = $shipit['weight_lb'];
$shiptypeone[] = $type;
$fixed_price = $shipit['fixed_price'];
$minimum = $shipit['minimum'];
$percent_of_sale = $shipit['percent_of_sale'];
if($id ==""){
$shipman[] = $i;
}elseif($type == 'UPS'){
$upsman[] = $i;
$upso_code[] = $o_code;
$ups_weight[] = $weight_lb;
}else{
if($fixed_price != 0){
$shipcharge = $fixed_price * $prod_qty[$i];
}
elseif($percent_of_sale > 0){
$shipcharge = $full_amount[$i] * $percent_of_sale;
}
if($minimum > 0 AND $shipcharge < $minimum){
$shipcharge = $minimum;
}
$shipwrit = sprintf("%01.2f", $shipcharge);
echo("$prod_qty[$i] | $productname | $type | $shipwrit | ");
$shiptotal[] = $shipcharge;
}
}
$i = $i+1;
}
$shipit = array_sum($shiptotal);
$shipprice = sprintf("%01.2f", $shipit);
$shipcheck = count($shipman);
$upscheck = count($upsman);
if($shipcheck > 0 or $upscheck > 0){
echo("Shipping Subtotal: | $shipprice | " .
"Complete the following shipping information. | ");
$a = 0;
while($a < $upscheck){
$b = $upsman[$a];
echo("$prod_qty[$b] | $prod_name[$b] | " .
" " .
"UPS | " .
" | ");
$a = $a + 1;
}
foreach($shipman as $value){
echo("$prod_qty[$value] | $prod_name[$value] | " .
" | " .
" | ");
}
}else{
echo("Total Shipping Charges | $shipprice | ");
}
?>
| Sales Tax
Enter Sales Tax Per Cent.
%
|