<?php
$art_promo_desc = $load1["art_promo_desc"];

if ($art_promo_desc > 0) 
{
    if (isset($_SESSION["clie_id"])) 
    {
        $casa1 = mysqli_query(
            $con,
            "SELECT * FROM precio WHERE tarifas_tar_id='$tarifas_tar_id' AND articulos_art_id='" . $load1["art_id_art"] . "' "
        ) or die(mysqli_error($con));
        $load2 = mysqli_fetch_array($casa1);
?>
        <span class="current_price" style="color: gray; font-size: 1em; text-decoration: line-through;">
            $<?php echo number_format($load2["pre_precio"], 0, ",", "."); ?>
        </span>
        <br>
        <?php
        $casa3 = mysqli_query(
            $con,
            "SELECT * FROM precio WHERE tarifas_tar_id='$tarifas_tar_id' AND articulos_art_id='" . $load1["art_id_art"] . "' "
        ) or die(mysqli_error($con));
        $load4 = mysqli_fetch_array($casa3);

        $pre_precio = $load4["pre_precio"];
        $desc_promo = $art_promo_desc / 100;
        $desc_art = $desc_promo * $pre_precio;
        $total_desc = $pre_precio - $desc_art;
    ?>
        <span class="current_price">$<?php echo number_format($total_desc, 0, ",", "."); ?></span>
        <label style="color: red; width: 40px; height: auto; font-size: 15px; align-items: center; justify-content: center; text-align: center;">
            -<?php echo number_format($art_promo_desc); ?>%
        </label>
    <?php
           
    } 
    else {
            $casa2 = mysqli_query(
                $con,
                "SELECT * FROM precio WHERE tarifas_tar_id='$tar_destacada' AND articulos_art_id='" . $load1["art_id_art"] . "' "
            ) or die(mysqli_error($con));
            $load3 = mysqli_fetch_array($casa2);
            ?>
            <span class="current_price" style="color: gray; font-size: 1em; text-decoration: line-through;">
                $<?php echo number_format($load3["pre_precio"], 0, ",", "."); ?>
            </span>
            <br>
            <?php
            $casa3 = mysqli_query(
                $con,
                "SELECT * FROM precio WHERE tarifas_tar_id='$tar_destacada' AND articulos_art_id='" . $load1["art_id_art"] . "' "
            ) or die(mysqli_error($con));
            $load4 = mysqli_fetch_array($casa3);

            $pre_precio = $load4["pre_precio"];
            $desc_promo = $art_promo_desc / 100;
            $desc_art = $desc_promo * $pre_precio;
            $total_desc = $pre_precio - $desc_art;
        ?>
            <span class="current_price">$<?php echo number_format($total_desc, 0, ",", "."); ?></span>
            <label style="color: red; width: 40px; height: auto; font-size: 15px; align-items: center; justify-content: center; text-align: center;">
                -<?php echo number_format($art_promo_desc); ?>%
            </label>
        <?php
                
        }
} else {
    if (isset($_SESSION["clie_id"])) {
        $casa1 = mysqli_query(
            $con,
            "SELECT * FROM precio WHERE tarifas_tar_id='$tarifas_tar_id' AND articulos_art_id='" . $load1["art_id_art"] . "' "
        ) or die(mysqli_error($con));
        $load2 = mysqli_fetch_array($casa1);

        if ($load2 && $load2["pre_precio"] > 0) { ?>
            <label style="margin-right: 500px;"></label>
            <span class="current_price">$<?php echo number_format($load2["pre_precio"], 0, ",", "."); ?></span>
        <?php
        }
    } else {
        $casa2 = mysqli_query(
            $con,
            "SELECT * FROM precio WHERE tarifas_tar_id='$tar_destacada' AND articulos_art_id='" . $load1["art_id_art"] . "' "
        ) or die(mysqli_error($con));
        $load3 = mysqli_fetch_array($casa2);

        if ($load3 && $load3["pre_precio"] > 0) { ?>
          <label style="margin-right: 500px;"></label>
            <span class="current_price">$<?php echo number_format($load3["pre_precio"], 0, ",", "."); ?></span>
<?php
        }
    }
}
?>