Hello. I have made an article and loaded a module inside it, so in product details page the customer can click to read a shipping estimation cost.
The link loads a popup window with the article and gets the product weight thus etsimating the cost for dispatch.
For products <=3 kg the cost shows up perfect. For products >3 kg I have problems. Here is the code inside flexi custom code module.
<?php
$ZoneCost = 3;
$CostPerKilo = 1;
if ($product_weight <= 3) {
$rate = number_format($ZoneCost,2);
echo $rate. " €";
echo " excluding VAT.";
}
elseif ($product_weight > 4){
$rate = number_format($ZoneCost+($product_weight - 3)*$CostPerKilo,2);
echo $rate. " €";
echo " excluding VAT.";
}
?>
Can someone help pls?