<?php require_once 'protect.php'; ?>
<?php
// extraprices
$resexprice = $mysqli->query("SELECT id, price FROM extras WHERE type=1 AND item_id=$id AND lang_id=$lang ORDER BY price");
$exprices = mysqli_num_rows($resexprice);
$row = $resexprice->fetch_array(); 
$exprice=$row['price'];

if ($discount==0 && $discount2>0) { 
$discount=$discount2;
} 
else if ($discount==0 && $discount2==0) {
$discount=$sitediscount;
}
else{
$discount=$discount;
}

$price = $price-($price*(($discount+$langdiscount)/100));
$price = round($price, 2);
$offerprice = $offerprice-($offerprice*(($discount+$langdiscount)/100));
$offerprice = round($offerprice, 2);
$price1 = round($price1, 2);

if ($offerprice=='0.00') { 
$endprice=$price;
}else{
$endprice=$offerprice;
}
if ($exprice) {
$exprice = round($exprice, 2);
$price=$exprice;
$endprice=$exprice;
}
$amount=$endprice;

if ($endprice!='0.00' OR $rowspr>0) { 
$buttonname=$textrequest; 
} else { 
$buttonname=$textinquiry; 
}
?>
<?php if ($endprice!='0.00') { ?>
<div class="divprice">
<?php if ($exprice) { ?>
<span class="lowercase"><?php echo $textfrom ?></span> <span class="price"> <?php if ($decimalprice==1) { ?><?php printf ("%01.2f", $price); ?><?php }else{?><?php echo $price ?><?php } ?> &#8364;</span>
<?php }else{?>
<?php if (($discount>0 OR $langdiscount>0) AND $price!='0.00' AND $offerprice=='0.00') { ?>
<span class="price notvalid"> <?php if ($decimalprice==1) { ?><?php printf ("%01.2f", $price1); ?><?php }else{?><?php echo $price1 ?><?php } ?> &#8364;</span>
<span class="price"> <?php if ($decimalprice==1) { ?><?php printf ("%01.2f", $price); ?><?php }else{?><?php echo $price ?><?php } ?> &#8364;</span>
<?php }else{?>
<?php if ($price!='0.00') { ?>
<span <?php if ($offerprice!='0.00') { ?>class="price notvalid"<?php } else {?>class="price"<?php } php?>> <?php if ($decimalprice==1) { ?><?php printf ("%01.2f", $price); ?><?php }else{?><?php echo $price ?><?php } ?> &#8364;</span>
<?php } ?>
<?php if ($offerprice!='0.00') { ?>
<span class="price"> <?php if ($decimalprice==1) { ?><?php printf ("%01.2f", $offerprice); ?><?php }else{?><?php echo $offerprice ?><?php } ?> &#8364;</span>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } ?>