View file File name : product-list.php Content :<?php session_start(); include("../include/config.php"); include("../include/functions.php"); validate_admin(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo SITE_TITLE; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/admin.css" rel="stylesheet" type="text/css" /> <script> function del_prompt(frmobj,comb) { //alert(comb); if(comb=='Delete'){ if(confirm ("Are you sure you want to delete record(s)")) { frmobj.action = "product-del.php"; frmobj.what.value="Delete"; frmobj.submit(); } else{ return false; } } else if(comb=='Deactivate'){ frmobj.action = "product-del.php"; frmobj.what.value="Deactivate"; frmobj.submit(); } else if(comb=='Activate'){ frmobj.action = "product-del.php"; frmobj.what.value="Activate"; frmobj.submit(); } else if(comb=='Make Latest'){ frmobj.action = "product-del.php"; frmobj.what.value="Make Latest"; frmobj.submit(); } else if(comb=='Remove Latest'){ frmobj.action = "product-del.php"; frmobj.what.value="Remove Latest"; frmobj.submit(); } } </script> <script type="text/javascript"> function showPriceChange(id,chk){ $.ajax({ url:"showPriceChange.php", data:{id:id,chk:chk}, success:function(data){ $("#msg").html("Record updated successfully").show().fadeOut('slow'); } }) } </script> </head> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php include("header.php") ?> <script type="text/javascript"> $(document).ready(function(){ $("#check_all").click(function(){ if($(this).is(":checked")){ $(".checkall").attr("checked","checked"); }else{ $(".checkall").removeAttr("checked"); } }) }) </script> <script type="text/javascript"> function makeLatest(id,chk){ $.ajax({ url:"makeLatest.php", data:{id:id,chk:chk}, success:function(data){ //alert(data); } }) } </script> <tr> <td align="right" class="paddRtLt70" valign="top"> <table width="99%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <!------------ Search Section -----------------> <tr> <td align="left" valign="middle" class="bodr" style="padding-bottom:20px;"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td class="headingbg bodr text14" style="padding-left:20px;">Search<span style="float:right; padding-right:10px;"></span></td> </tr> <tr><td height="10"></td></tr> <tr> <td> <form name="searchForm" method="post" action="product-list.php"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="72%"><table width="89%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="10%" align="right" ><strong>Category:</strong></td> <td width="15%"><select name="search_cat_id" style="width:150px;" > <option value="">Select Category</option> <?php $catArr=$obj->query("select * from $tbl_maincategory where parent_id=0 and status=1 order by id ",$debug=-1); while($resultCat=$obj->fetchNextObject($catArr)){ ?> <option value="<?php echo $resultCat->id; ?>"<?php if($resultCat->id==$_REQUEST['search_cat_id']){?>selected<?php } ?>><?php echo stripslashes($resultCat->maincategory); ?></option> <?php } ?> </select></td> <td width="10%" align="right" ><strong>Product Name:</strong></td> <td width="15%"><input type="text" name="search_pname" value="<?php echo $_REQUEST['search_pname']; ?>"/></td> </tr> </table> </td> <td width="28%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="26%"><input type="submit" class="button" name="search" value="Search" /></td> <td width="74%"><a href="product-list.php">View All</a></td> </tr> </table> </td> </tr> </table> </td></tr> </table> </form> </td> </tr> </table> </td> </tr> <tr><td height="10"></td></tr> <!----- Search End ---------> <tr> <td align="left" valign="middle" class="headingbg bodr text14"> <em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>Admin: View Products <span style="float:right; padding-right:10px;"> <input type="button" name="add" value="Add Product" class="button" onclick="location.href='product-addf.php'" /></span> </td> </tr> <form name="frm" method="post" action="product-del.php" enctype="multipart/form-data"> <tr> <td height="100" align="left" valign="top" bgcolor="#FFFFFF" class="bodr"> <table width="100%" cellpadding="0" cellspacing="0"> <?php if($_SESSION['sess_msg']){ ?> <tr><td align="center"><font color="#FF0000"><strong><?php echo $_SESSION['sess_msg'];$_SESSION['sess_msg']='';?></strong></font></td></tr> <?php }?> <tr><td align="center"><font color="#FF0000" id="msg"><strong><?php echo $_SESSION['sess_msg'];$_SESSION['sess_msg']='';?></strong></font></td></tr> <tr> <td align="left"> <?php $where=''; if($_REQUEST['storeid']){ $where.=" and storeid=".$_REQUEST['storeid']." "; } if($_REQUEST['search_cat_id']){ $where.=" and categories like ('%".$_REQUEST['search_cat_id']."%') "; } if($_REQUEST['search_pname']){ $where.=" and product_name like '%".$_REQUEST['search_pname']."%' "; } $start=0; if(isset($_GET['start'])) $start=$_GET['start']; $pagesize=50; if(isset($_GET['pagesize'])) $pagesize=$_GET['pagesize']; $order_by='id'; if(isset($_GET['order_by'])) $order_by=$_GET['order_by']; $order_by2='desc'; if(isset($_GET['order_by2'])) $order_by2=$_GET['order_by2']; $sql=$obj->Query("select * from $tbl_product where 1=1 $where order by $order_by $order_by2 limit $start, $pagesize"); $sql2=$obj->query("select * from $tbl_product where 1=1 $where order by $order_by $order_by2",$debug=-1); $reccnt=$obj->numRows($sql2); if($reccnt==0) { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle"><font face="Arial, Helvetica, sans-serif" color="#FF0000" size="+1">No Record</font></td> </tr> </table> <?php } else { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle"><strong><?php echo $reccnt;?> Record Found.</strong></td> </tr> <tr> <td valign="top" align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>S No.</strong></td> <td width="13%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Product Name</strong><?php echo sort_arrows('product_name') ?></td> <td width="24%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Category</strong></td> <td width="7%" align="left" bgcolor="#f3f4f6" class="padd5"><strong>Store</strong></td> <td width="16%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Image</strong></td> <!-- <td width="10%" align="center" bgcolor="#e7efef" class="padd5"><strong>New Arrival</strong></td> --> <td width="6%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Status</strong></td> <td width="13%" align="center" class="padd5" bgcolor="#f3f4f6"><strong>Action</strong></td> <td width="6%" align="center" bgcolor="#f3f4f6" class="padd5" ><strong>Don't Hike</strong></td> <td width="12%" align="center" bgcolor="#f3f4f6" class="padd5" > <input name="check_all" type="checkbox" id="check_all" value="check_all" /></td> </tr> <?php $i=0; while($line=$obj->fetchNextObject($sql)) { $i++; if($i%2==0) { $bgcolor = "#f3f4f6"; } else { $bgcolor = ""; } ?> <tr bgcolor="<?php echo $bgcolor;?>"> <td class="padd5"><strong><?php echo $i+$start; ?>.</strong></td> <td class="padd5"> <?php echo ucwords(stripslashes($line->product_name)); ?> </td> <td class="padd5"> <?php echo getCategoryTree($line->cat_id,$array=''); ?> </td> <td class="padd5" align="center"><img src="../seller/upload_images/store/thumb/<?php echo getFieldWhere('photo','stores','storeid',$line->storeid); ?>" width="80" ><br /> <?php echo ucwords(getFieldWhere('storename','stores','storeid',$line->storeid));?></td> <td align="center" class="padd5"> <?php if(is_file("../upload_images/product/thumb/".$line->photo)){ ?> <img src="../upload_images/product/thumb/<?php echo $line->photo; ?>" /> <?php } ?> </td> <!-- <td align="center" valign="middle" class="padd5"> <input type="checkbox" name="latest" value="<?php echo $line->id;?>" <?php if($line->latest==1){ ?>checked<?php } ?> onclick="return makeLatest(this.value,this.checked)" /> </td> --> <td align="center" valign="middle" class="padd5"> <?php if($line->status==1){?><img src="images/enable.gif" border="0" title="Activated" /> <?php } else{ ?><img src="images/disable.gif" border="0" title="Deactivated" /><?php }?> </td> <td align="center" valign="middle" class="padd5"> <a href="product-edit.php?id=<?php echo $line->id;?>" ><img src="images/edit3.gif" border="0" title="Edit" /></a><br/> <?php $sql_pro_price=$obj->query("select * from $tbl_productprice where product_id='".$line->id."' and status=1"); $num_prod=$obj->numRows($sql_pro_price); ?> <a href="productprice-list.php?product_id=<?php echo $line->id;?>" ><strong>Manage Price/Size(<?php echo $num_prod?>)</strong></a><br/> <a href="photo-list.php?product_id=<?php echo $line->id;?>" ><strong>Manage Gallery</strong></a> </td> <td align="center" valign="middle" class="padd5"><input type="checkbox" value="1" <?php if($line->price_change==1){ ?>checked<?php } ?> onclick="return showPriceChange(<?php echo $line->id; ?>,this.checked)"/></td> <td align="center" valign="middle" class="padd5"> <input type="checkbox" name="ids[]" class="checkall" value="<?php echo $line->id;?>" /> </td> </tr> <?php } ?> <tr> <td valign="top" colspan="10" align="right"> </td> </tr> <tr> <td valign="top" colspan="10" align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?></td> </tr> <tr> <td align="right" style="padding-right:80px;" colspan="10"> </td> </tr> <tr> <td align="right" style="padding-right:80px;" colspan="10"> </td> </tr> <tr><td align="right" style="padding-right:80px;" colspan="10"> <input type="hidden" name="what" value="what" /> <!-- <input type="submit" name="Submit" value="Make Latest" class="button" onclick="return del_prompt(this.form,this.value)" /> <input type="submit" name="Submit" value="Remove Latest" class="button" onclick="return del_prompt(this.form,this.value)" /> --> <input type="submit" name="Submit" value="Activate" class="button" onclick="return del_prompt(this.form,this.value)" /> <input type="submit" name="Submit" value="Deactivate" class="button" onclick="return del_prompt(this.form,this.value)" /> <input type="submit" name="Submit" value="Delete" class="button" onclick="return del_prompt(this.form,this.value)" /></td></tr> </table> <?php }?> </td> </tr> </table> </td> </tr> </form> </table> </td> </tr> </table> </td> </tr> <tr><td height="100"></td></tr> <?php include('footer.php'); ?> </table> </body> </html>