Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $total = 0;
- $all_products=0;
- foreach ($_SESSION as $name => $value) {
- if($value > 0){
- if(substr($name, 0, 8 ) == "product_"){
- $length = strlen($name) -8;
- $item_id = substr($name,8 , $length);
- $query = "SELECT *
- FROM gallery2
- WHERE gallery2.id =".escape_string($item_id). "";
- $run_item = mysqli_query($conn,$query);
- while($rows = mysqli_fetch_assoc($run_item)){
- $vari = $rows['variante'];
- $num = $rows['title'];
- $id = $rows['id'];
- if(!isset($_SESSION['icms'.$id])) {
- $_SESSION['icms'.$id]='0';
- }else{
- $_SESSION['icms'.$id];
- }
- $btn_add ='<button type="button" class="btn btn-success actions plus" data-action="plus" product_id="'.$id.'"><i class="fa fa-plus fa-lg" aria-hidden="true" add_btn></i></button>';
- $btn_remove ='<button type="button" class="btn btn-warning actions less" data-action="remove" product_id="'.$id.'"><i class="fa fa-minus fa-lg" aria-hidden="true" remove_btn></i></button>';
- $btn_delete ='<button type="button" class="btn btn-default actions" data-action="delete" product_id="'.$id.'" onclick="deleteRow(this)"><i class="fa fa-times fa-lg" aria-hidden="true"></i></button>';
- if($rows['variante'] < 1){
- $dash="";
- $vari="";
- }else{
- $dash="-";
- $vari =$rows['variante'];
- }
- $subtotal=$value * $_SESSION['icms'.$id];
- $cost=$_SESSION['icms'.$id];
- $all_products +=$value;
- $_SESSION['Products_cart'] = '
- <tr>
- <td style="width:100px; "><img src="../'.$rows['image'].'" style="width:90%;border: 1px solid black;"></td>
- <td>'.$num.''.$dash.''.$vari.'</td>
- <input type="hidden" value="'.$num.'" name="numero[]">
- <input type="hidden" value="'.$vari.'" name="vari[]">
- <input type="hidden" value="'.$rows['image'].'" name="desenho[]">
- <td style="width:15%;" class="row">
- <select name="fabric[]" class="fabric select form-control selectpicker" required="" data-id="'.$id.'" >
- '. $fabric_options . '
- </select>
- </td>
- <td class="row">
- <select data-id="'.$id.'" class="select size form-control selectpicker" required style="width:80%;" name="size[]">
- <option value="'.$t50.'" name="'.$t50.'">50x'.$t50.'</option>
- <option value="'.$t45.'" name="'.$t50.'">45x'.$t45.'</option>
- </select>
- </td>
- <td name="qnty[]" class="product'.$id.' " value="'.$value.'" type="text" >'.$value.'</td>
- <input type="hidden" name="qnty[]" value="'.$value.'"/>
- <td name="cost[]" class="cost" data-id="'.$id.'" name="'.$cost.'">R$:'.$cost.'</td>
- <input type="hidden" name="cost[]" value="'.$cost.'"/>
- <td name="subtotal[]" class="subtotal" data-id="'.$id.'" >R$:'.number_format($subtotal, 2, '.', '') .'</td>
- <input class="subtotal" type="hidden" name="subtotal[]" value="'.number_format($subtotal, 2, '.', '') .'"/>
- <td>
- '.$btn_add.' '.$btn_remove.' '.$btn_delete.'
- </td>
- <input type="hidden" name="all[]" value="'. $_SESSION['total'].'"/>
- </tr>';
- echo $_SESSION['Products_cart'];
- ////closing brackets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement