html - grouping product by php -
i beginning php developer , have found error internet doesn't have resource me reference. doing online shopping project multiple vendors ebay or others. need create shopping cart grouped vendors, pictures shown . products should show in table grouped different vendors. have no idea how that, after have done simple shopping cart coding.....
sample shopping cart
<div id="product_box"> <form action="" method="post" enctype="multiple/form-data"> <table align="center" width="700" bgcolor="white"> </tr> <tr align="center"> <th>delete</th> <th>product(s)</th> <th>shop</th> <th>single price</th> <th>quantity</th> <th>update quantity</th> </tr> <?php global $con; include("include/db.php"); $total = 0; $ip=getip(); $user_email = $_session['user_email']; $get_id = "select * user user_email='$user_email'"; $run_id = mysqli_query($con,$get_id); $row_id = mysqli_fetch_array($run_id); $user_id = $row_id['user_id']; $sqlproinfo=mysqli_query($con,"select * productorder join product on productorder.product_id=product.product_id ip_add='$ip' , user_id='$user_id'"); while($p_info=mysqli_fetch_array($sqlproinfo)){ $pro_id = $p_info['product_id']; $sqlpinfo=mysqli_query($con,"select * product inner join vendor on product.shop_name=vendor.vendor_id product_id='$pro_id'"); while($pp_info=mysqli_fetch_array($sqlpinfo)){ $product_price = array($pp_info['price']); $pro_name=$pp_info['product_name']; $shop_name = $pp_info['shop_name']; $product_image = $pp_info['product_image']; $single_price = $pp_info['price']; $value = array_sum($product_price); $total += $value; $sqlqtyinfo=mysqli_query($con,"select * productorder ip_add='$ip' , product_id='$pro_id' , user_id='$user_id'"); $qty_info=mysqli_fetch_array($sqlqtyinfo); $qty=$qty_info['quantity']; $total = $total * $qty; ?> <tr align="center"> <td><input type="checkbox" name="remove[]" value="<?php echo $pro_id;?>"/></td> <td><?php echo $pro_name; ?><br><img src="adminvendor_area/product_image/<?php echo $product_image;?>" width="60" height="60"/></td> <td><?php echo $shop_name; ?></td> <td><?php echo "myr" . $single_price; ?></td> <td><input type='number' style="-moz-box-sizing: border-box; width: 80px;" min='1' max='99' step='1' value='<?php echo "$qty"; ?>' name='qty[<?php echo "$pro_id";?>]' /></td> <?php echo"<td><input type='submit' name='updatecart[$pro_id])' value='$pro_id' style='color: rgba(0, 0, 0, 0);'/></td>"; if(isset($_post['updatecart'][$pro_id])){ $user_email = $_session['user_email']; $get_id = "select * user user_email='$user_email'"; $run_id = mysqli_query($con,$get_id); $row_id = mysqli_fetch_array($run_id); $user_id = $row_id['user_id']; $qty = $_post['qty'][$pro_id]; $special_id = $_post['updatecart'][$pro_id]; $sqlqty = mysqli_query($con, "update productorder set quantity='$qty' product_id='$special_id' , ip_add='$ip' , user_id='$user_id'"); echo "<script>alert('quantity has been updated!')</script>"; echo "<script>window.open('cart.php','_self')</script>";} }}?> </tr> <tr> <td colspan="4" align="right"><b>sub total:</b></td> <td><?php total_price();?></td> </tr>
Comments
Post a Comment