<?php
for($i=0;$i<sizeof($cartdataset);$i++){
    
    $pro_cart_img = $imgfadd.$cartdataset[$i]['img'];
    $pro_cart_name = $cartdataset[$i]['name'];
    $pro_cart_price = $cartdataset[$i]['price'];
	$pro_cart_price = $queries -> fa_number($pro_cart_price);
    $pro_cart_count = $cartdataset[$i]['count'];
    $pro_cart_id = $cartdataset[$i]['id'];
    $pro_cart_total = floatval($cartdataset[$i]['count']) * floatval($cartdataset[$i]['price']);
    $pro_cart_total = $queries -> fa_number($pro_cart_total);
    
    $handletypes = ($cartdataset[$i]['f_j']==0);

    if($handletypes){
        
        $countsofp = '';  
        for($j=1;$j<201;$j++){
            
            if($j == $pro_cart_count){
                $countsofp .= '<option class=" py-4" value="'.$j.'" selected>'.$j.'</option> ';
				
            }else{
                $countsofp .= '<option class=" py-4" value="'.$j.'">'.$j.'</option> ';
				
            }
    
            
          }
        
         
        
        $handletypesres = ' <select class=" custom-select mt-1 mb-1 text-right  border-0 bg-light rounded " id="cartitemscount" name="cartitemscount" dir="rtl" style="font-size: 0.85rem; color: #121212; font-weight: 700;">'.$countsofp.'</select>';
		$intitle="تعداد";
    }else{
        
         $countsofp = '';  
        for($k=100;$k<3000;$k=$k+100){
            
            
            $kvalue = $k * 0.001; 
            
            $unittitle = $k." گرم ";
            if($k > 999){
                 $unittitle = $k." گرم ";
            }
            
            if($kvalue == $pro_cart_count){
                $countsofp .= '<option class=" py-4" value="'.$kvalue.'" selected>'.$unittitle.'</option> ';
				
            }else{
                $countsofp .= '<option class=" py-4" value="'.$kvalue.'">'.$unittitle.'</option> ';
				
            }
    
            
          }
        
         
        
        $handletypesres = ' <select class=" custom-select mt-1 mb-1 text-right  border-0 bg-light rounded " id="cartitemscount" name="cartitemscount" dir="rtl" style="font-size: 0.85rem; color: #121212; font-weight: 700;">'.$countsofp.'</select>';
        
        
     //   $handletypesres = '<input type="text" name="cartitemscount" class="form-control  border-0 bg-light text-right rounded currencyTextBox" value="'.$pro_cart_count.'" placeholder="واحد کیلوگرم">';
		$intitle="وزن";
    }
    
    
echo '
    

    <div class="col-12 mt-2 text-right my-3 ">

    <div class="row m-1">


        <div class="col-xl-3 col-lg-5 col-md-6 order-md-1 order-2">
            <form class="" dir="rtl" method="post" action="cart.php">
                <div class="form-row bg-light rounded">

                    <div class="col-3  d-flex align-items-center justify-content-center border-left border-white" style="font-size: 0.85rem; color: #121212; font-weight: 700;">

                        <div class="">'.$intitle.'</div>
                    </div>

                    <div class="col-5  d-flex align-items-center ">
                          '.$handletypesres.'
                    </div>





                    <div class="col-2 border-right  border-white bg-light px-0 d-flex align-items-center ">



                        <button class="btn  w-100 bg-light product-title text-success" name="updatecart" type="submit">
                            <span class="text-success ">

                                <i class="fa fa-sync"></i>

                            </span>

                        </button>
                    </div>

                    <div class="col-2 d-flex align-items-center justify-content-center  border-white border-right">
                        <a href="cart.php?cart='.$pro_cart_id.'" class="btn w-100  product-title text-danger"><i class="fa-trash fas"></i></a>


                    </div>
                    
                                        <div class="col-12  d-flex align-items-center ">
                        <input class="form-control  border-0 bg-light my-auto text-right d-none" style="font-size: 0.8rem;" type="text" name="cartitems" value="'.$pro_cart_id.'"  hidden>
                    </div>

                </div>
            </form>

        </div>



        <div class="col-xl-9 col-lg-7 col-md-6 order-md-2 order-1 d-flex align-items-center mb-md-0 mb-3">

            <div class="flex-fill">

                <div class="mx-2 product-sub d-flex flex-column align-items-between text-right">
                    <div class="mb-1">'.$pro_cart_name.'</div>
                    <div>تعداد: '.$pro_cart_count.'</div>
                    <div>قیمت واحد: '.$pro_cart_price.'</div>
                    <div>قیمت کل: '.$pro_cart_total.'</div>

                </div>

            </div>

            <div class="cart-image" style="background-image: url('.$pro_cart_img.');"></div>

        </div>


    </div>



</div>
                        
';                        
}

?>