<?php  
    if(isset($product_size)){
        foreach ($product_size as $row2) {
            $size_id = $row2['size_id'];
            $p_pv = $row2['p_pv'];
            $color_id = $row2['color_id'];
            $query3 = $this->db->query("select * from tbl_size where size_id = $size_id ");
            foreach ($query3->result_array() as $row3) {
                $size_name = $row3['size_name'];
            }
            
            if(isset($color_id) && !empty($color_id)){
                $query4 = $this->db->query("select * from tbl_color where color_id = $color_id ");
                foreach ($query4->result_array() as $row4) {
                    $color_name = $row4['color_name'];
                }
            }
            else{
                $color_id = '';
                $color_name = '';
            }
        ?>
                <div class="p-1 pb-2 border-bottom">
                <div class="bg-white">
                    <div class="form-check-inline text-center">
                        <label class="form-check-label" 
                        <?php if($row2['p_qty']>0){ ?>
                        onclick="Myvalueput($('#size_for_1_<?=$row2['p_id']; ?><?=$row2['size_id']?><?=$row2['color_id']?>').val());$('#sizeModal').modal('hide');$('#size2_<?=$row2['p_id']; ?>').val('<?=$size_name;?> <?php if(empty($color_name)){}else{?>(<?=$color_name;?>)<?php } ?>');"
                        <?php }  ?>>
                            <?=$size_name;?>
                            &nbsp;&nbsp;<span class="badge badge-sm" style="background-color: <?=$color_name;?>;"><?=$color_name;?></span>
                            &nbsp;&nbsp;<del>&#8377;<?=$row2['p_old_price']?></del>
                            &nbsp;&nbsp;&#8377;<?=$row2['p_current_price']?>
                            &nbsp;&nbsp; <?=$row2['p_pv']?>PV
                            &nbsp;
                        <?php
                              $a=$row2['p_current_price'];
                              $b=$row2['p_old_price'];
                              
                              if($b!='' && $b!=$a)
                              {
                              $c=$b-$a;
                              $d=$c/$b;
                              ?>
                           
                              <?php
                                 $var= $d*100;
                                 echo '<span class="badge bg-success offer-animation" id="offer_'.$row2['p_id'].'">'.number_format($var,0).' % off </span>';
                                 ?>
                           <?php }
                           
                        ?>
                        &nbsp;&nbsp;
                        <?php if($row2['p_qty']>0){ ?>
                            <i class="fa fa-check-circle text-success"></i> Available
                            &nbsp;&nbsp;
                        <input type="radio" value="<?=$row2['size_id']?>,<?=$row2['p_old_price']?>,<?=$row2['p_current_price']?>,<?=$row2['p_qty']?>,<?=$size_name;?>,<?=$row2['p_id']; ?>,<?=$color_id; ?>,<?=$color_name;?>,<?=$p_pv; ?>" id="size_for_1_<?=$row2['p_id']; ?><?=$row2['size_id']?><?=$row2['color_id']?>" name="size_">
                        <?php }else{ ?>
                            <i class="fa fa-times-circle text-danger"></i> Out Of Stock
                            &nbsp;&nbsp;
                        <input type="radio" value="<?=$row2['size_id']?>,<?=$row2['p_old_price']?>,<?=$row2['p_current_price']?>,<?=$row2['p_qty']?>,<?=$size_name;?>,<?=$row2['p_id']; ?>,<?=$color_id; ?>,<?=$color_name;?>,<?=$p_pv; ?>" id="size_for_1_<?=$row2['p_id']; ?><?=$row2['size_id']?><?=$row2['color_id']?>" name="size_" disabled>
                        <?php } ?>
                        
                        </label>
                        </div>
                        </div>
                </div>
                </a>
                <?php
        }
    }
?>