"auto");'; $tree.= '$'.'menu01 = new HTML_TreeMenuXL();'; //To select categories $cat_sql = "select Category_Id, Category_Name from ".CATEGORY." where Parent = 0"; $cat_result = mysql($db, $cat_sql); $maincategory_cnt=mysql_num_rows($cat_result); $nd=0; $i=0; while(list($catid, $catname) = mysql_fetch_array($cat_result)) { //To check whether subcategories available under the category //============================================================ $cat1_sql = "select Category_Id, Category_Name from ".CATEGORY." where Parent = '$catid' ORDER BY Category_Name"; $cat1_result = mysql($db, $cat1_sql); $count1 = mysql_num_rows($cat1_result); //To check whether products available under the category //============================================================ $prdt_count1 = chk_products($catid); //if($count1 > 0 || $prdt_count1 > 0) //{ $nd++; $link = "category_main.php?type=listfiles&root=".$catid."&level=0"; $tree.= '$'.'node'.$nd.' = new HTML_TreeNodeXL("'.$catname.'", "'.$link.'", '.'$'.'nodeProperties);'; $tree.='$'.'menu01->addItem('.'$'.'node'.$nd.');'; $link = "category_main.php?type=listproducts&root=".$catid."&level=0"; /*$tree.='$'.'nx = &'.'$'.'node'.$nd.'->addItem(new HTML_TreeNodeXL("Products", "'.$link.'", '.'$'.'nodeProperties));'; */ /* if($prdt_count1 > 0) { $tree.= list_products($catid,0); }*/ //To list out the sub categories //============================== $nx=0; while(list( $catid1, $catname1) = mysql_fetch_array($cat1_result)) { $nx=0; $link = "category_main.php?type=listfiles&root=".$catid1."&level=1"; $tree.='$'.'nx0 = &'.'$'.'node'.$nd.'->addItem(new HTML_TreeNodeXL("'.$catname1.'", "'.$link.'", '.'$'.'nodeProperties));'; $nx++; $link = "category_main.php?type=listproducts&root=".$catid1."&level=1"; $tree.= '$'.'nx'.$nx.' = &'.'$'.'nx0->addItem(new HTML_TreeNodeXL("Products", "'.$link.'", '.'$'.'nodeProperties));'; //To check whether products available under the category //============================================================ $prdt_count2 = chk_products($catid1); if($prdt_count2 > 0) { #$tree.= list_products($catid1); $prdt1_sql = "select Product_Id, Product_Name from ".PRODUCT_DETAILS." where Category_Id = '$catid1'"; $prdt1_result = mysql($db, $prdt1_sql); //To list out the products //========================= while(list($prdtid, $prdtname) = mysql_fetch_array($prdt1_result)) { $link = "category_main.php?type=editprdt&root=".$catid1."&level=1&prdt_id=".$prdtid; #$tree.='$'.'nx'.$nx.' ->addItem(new HTML_TreeNodeXL("'.$prdtname.'", "'.$link.'",'. '$'.'nodeProperties));'; } } $tree.=sublist($catid1, $nx, "",1); } } #$tree.='$'.'menu01->addItem('.'$'.'node01)'; $tree.='?>'; if($maincategory_cnt<3) { $maincat_link_start="   Product Catalog"; } else { $maincat_link_start="   Product Catalog"; } //To update category_tree.inc //=========================== $temp=fopen('category_tree.inc','r'); $temp_content=fread($temp,filesize('category_tree.inc')); fclose($temp); $tree_content = "".$tree.""; $temp_content = preg_replace('/(.*)/',$maincat_link_start,$temp_content); $temp_content = preg_replace('/(.*)/',$tree_content,$temp_content); $fp=fopen("category_tree.inc", "w"); fwrite($fp, $temp_content); fclose($fp); if($type == "cat_change") { //To update category_change.inc //============================= $temp=fopen('category_change.inc','r'); $temp_content=fread($temp,filesize('category_tree.inc')); fclose($temp); $tree_content = "".$tree.""; $temp_content = preg_replace('/(.*)/',$tree_content,$temp_content); $fp=fopen("category_change.inc", "w"); fwrite($fp, $temp_content); fclose($fp); include "category_change.php"; } if($type == "changecat_updated") { if($new_root != "") { //To select category id //===================== $sel_cat = "select Category_Id from ".CATEGORY." where Id='$new_root'"; $cat_result = mysql($db, $sel_cat); list($catid) = mysql_fetch_array($cat_result); //To udpate product master //========================= $prdt_update = "update ".PRODUCT_DETAILS." set Category_Id='$catid' where Product_Id='$prdt_id'"; $prdt_result = mysql($db, $prdt_update); //To update association table (To find the root of the selected category) //====================================================================== $root_id = assoc($new_root); $assoc_update = "update ".PRODUCT_ASSOCIATE." set Category_Id='$catid', Root_Id='$root_id' where Product_Id='$prdt_id'"; $assoc_result = mysql($db, $assoc_update); echo ""; } else { echo ""; } } //Tree menu ends here //============================================================================================================ if($type == "Add" || $type == "add") { if($root == "") $root = 0; //To get the Max(Category_Id) from Category_Master table //======================================================= $catqry = "select max(Category_Id)+1 from ".CATEGORY; $catsql = mysql($db, $catqry); list($catid) = mysql_fetch_array($catsql); if($catid == "" || $catid == 0) { $catid = 1; } //To insert category details into the Category_Master table //========================================================= if($status == "") $status = 'N'; if($emailstatus == "") $emailstatus = 0; $catdesc0 = preg_replace("/\r|\n/", '', $catdesc0); if(!get_magic_quotes_runtime()) $catdesc0 = addslashes($catdesc0); if($cat_name != "") { $insert_qry = "INSERT INTO ".CATEGORY."(Category_Id, Category_Name, Description , Parent, Status,Email_Status,template_type) values ('$catid','$cat_name','$catdesc0','$root','$status','$emailstatus','$template_type')"; } $insert_result = mysql($db, $insert_qry); if($catimage!="" && $hidcatimage!="") { if(!is_file($catimage) || filesize($catimage)<=0) { $flag=1; #echo ""; exit; } else { list($width,$height,$type,$attr)=getimagesize("$catimage"); if($width>650 || $height > 200) { $imgpath="gallery_images/cate_images"; $show_catimage_path=resize_imagefile($catimage,$hidcatimage,'650','200',$imgpath,$catid,'catimg'); } else { $imgpath="gallery_images/cate_images"; $show_catimage_path=upload_files($catimage,$hidcatimage,$imgpath,$catid,'catimg'); } $upd_cat_qry="UPDATE ".CATEGORY." SET Image ='$show_catimage_path' WHERE Category_Id ='$catid'"; mysql($db,$upd_cat_qry); } } //To select id //============ $id_sql = "select Category_Id from ".CATEGORY." where Category_Id = '$catid'"; $id_result = mysql($db, $id_sql); list($id) = mysql_fetch_array($id_result); //To redirect to the category modify page //======================================= echo ""; #echo ""; } if($type == "Modify") { //This is to get the Product Description value //============================================== $catdesc0 = preg_replace("/\r|\n/", '', $catdesc0); if(!get_magic_quotes_runtime()) $proddesc0 = addslashes($catdesc0); if($status == "") $status = 'N'; if($emailstatus == "") $emailstatus = 0; $template_type = $_POST['template_type']; if($cat_name != "") { $update_qry = "UPDATE ".CATEGORY." SET Category_Name = '$cat_name', Description='$catdesc0',Status='$status',Email_Status='$emailstatus',template_type='$template_type' WHERE Category_Id = '$cat_id'"; } $update_result = mysql($db, $update_qry); if($catimage!="" && $hidcatimage!="") { if(!is_file($catimage) || filesize($catimage)<=0) { $flag=1; #echo ""; exit; } else { list($width,$height,$type,$attr)=getimagesize("$catimage"); //Modified the condition for fixing the issue of image upload fail for the size 664 and 313 if($width==664 && $height==313) { $imgpath="gallery_images/cate_images"; $show_catimage_path=upload_files($catimage,$hidcatimage,$imgpath,$cat_id,'catimg'); } else { $imgpath="gallery_images/cate_images"; $show_catimage_path=resize_imagefile($catimage,$hidcatimage,'664','313',$imgpath,$cat_id,'catimg'); } $upd_cat_qry="UPDATE ".CATEGORY." SET Image ='$show_catimage_path' WHERE Category_Id ='$cat_id'"; mysql($db,$upd_cat_qry); } } //For Small image start if($catimage_small !="" && $hidcatsmallimage!="") { if(!is_file($catimage_small) || filesize($catimage_small)<=0) { $flag=1; #echo ""; exit; } else { list($width,$height,$type,$attr)=getimagesize("$catimage_small"); if($width>650 || $height>200) { $imgpath="gallery_images/cate_small_images"; $show_catimage_path=resize_imagefile($catimage_small,$hidcatsmallimage,'650','200',$imgpath,$cat_id,'catimg'); } else { $imgpath="gallery_images/cate_small_images"; if(($root == 1) && ($level == 0)) { $prefix = "made"; } else { $prefix = "catimg"; } $show_catimage_path=upload_files($catimage_small,$hidcatsmallimage,$imgpath,$cat_id,$prefix); //$show_catimage_path=upload_files($catimage_small,$hidcatsmallimage,$imgpath,$cat_id,'catimg'); } $upd_cat_qry="UPDATE ".CATEGORY." SET Image_Small ='$show_catimage_path' WHERE Category_Id ='$cat_id'"; mysql($db,$upd_cat_qry); } } // End //To update product status in association table //============================================= $update_status ="UPDATE ".PRODUCT_ASSOCIATE." SET Cat_Status ='$status' WHERE Category_Id ='$cat_id'"; $update_result = mysql($db, $update_status); //To select the Id of the Category //================================= $sel_id = "select Category_Id from ".CATEGORY." where Category_Id = '$cat_id'"; $id_result = mysql($db, $sel_id); list($parent) = mysql_fetch_array($id_result); //To check whether child available for the parent //================================================ $sel_qry = "Select count(Category_Id) from ".CATEGORY." where Parent = '$parent'"; $sel_result = mysql($db, $sel_qry); list($row_cnt) = mysql_fetch_array($sel_result); if($row_cnt > 0) { //To update the status of siblings //================================ update_status($parent,$status); } //To redirect to the category modify page //======================================= echo ""; #echo ""; } if($type == "Delete") { if($root == "") $root = 0; //This is to select the parent and it's image //============================================ $sel_qry = "SELECT Image , Parent FROM ".CATEGORY." WHERE Category_Id='$root'"; $sel_result = mysql($db, $sel_qry); list($catimgname,$id) = mysql_fetch_array($sel_result); //This is to remove the category Image //===================================== if(is_file("../gallery_images/cate_images/$catimgname")) { unlink ("../gallery_images/cate_images/$catimgname"); } $del_qry = "DELETE FROM ".CATEGORY." WHERE Category_Id='$root'"; $del_result = mysql($db, $del_qry); echo ""; # echo ""; } if($type=="indiv_catimg") { if($imagetype=="cat") { //This is to remove the individual category Image //================================================ $sel_indivcatimg_qry="SELECT Image FROM ".CATEGORY." WHERE Category_Id='$cat_id'"; $sel_indivcatimg_res=mysql($db,$sel_indivcatimg_qry); $sel_indivcatimg_cnt=mysql_num_rows($sel_indivcatimg_res); if($sel_indivcatimg_cnt>0) { list($indivcatimg)=mysql_fetch_array($sel_indivcatimg_res); if(is_file("../gallery_images/cate_images/$indivcatimg")) { unlink("../gallery_images/cate_images/$indivcatimg"); } } } else if($imagetype=="cat_small") { //This is to remove the individual category Image //================================================ $sel_indivcatimg_qry="SELECT Image_Small FROM ".CATEGORY." WHERE Category_Id='$cat_id'"; $sel_indivcatimg_res=mysql($db,$sel_indivcatimg_qry); $sel_indivcatimg_cnt=mysql_num_rows($sel_indivcatimg_res); if($sel_indivcatimg_cnt>0) { list($indivcatimg)=mysql_fetch_array($sel_indivcatimg_res); if(is_file("../gallery_images/cate_small_images/$indivcatimg")) { unlink("../gallery_images/cate_small_images/$indivcatimg"); } } } echo ""; } if($type == "add_prdt") { $dt = date("Y-m-d"); if($cart_state == "") $cart_state = 'N'; //This is to get the Product Description value //============================================== $proddesc0 = preg_replace("/\r|\n/", '', $proddesc0); if(!get_magic_quotes_runtime()) $proddesc0 = addslashes($proddesc0); $qry_insert = "INSERT INTO ".PRODUCT_DETAILS."(Category_Id, Product_Code, Product_Name , Titlebar_Keyword , Meta_Keywords , Meta_Desc , Product_Desc , Cart_Status , Price ) VALUES ('$cat_id','$pcode','$pname','$title_key','$meta_keyword','$key_desc','$proddesc0','$cart_state' ,'$prd_price' )"; $result_insert = mysql($db, $qry_insert); //To select the product id //========================= $qry_sel = "select max(Product_Id) from ".PRODUCT_DETAILS; $qry_result = mysql($db, $qry_sel); list($pid) = mysql_fetch_array($qry_result); //This is to insert into the Product Image details //================================================= $j=1; for($i=1;$i<=1;$i++) { $AltText=$_POST['alt_txt'.$i]; $Caption=$_POST['caption'.$i]; $Actual_Imgpath='img_file'.$i; $Hid_Imgpath='hidimg_file'.$i; $Imgdesc=$_POST['img_desc'.$i]; $file_cnt=$pid."_".$j; $flg=0; if(${$Actual_Imgpath}!="") { if(!is_file(${$Actual_Imgpath}) || filesize(${$Actual_Imgpath})<=0) { $flg1=1; } else { list($width,$height,$type,$attr)=getimagesize(${$Actual_Imgpath}); if($width>300 || $height > 200) { $storeimgpath="gallery_images/prd_images"; $insert_path=upload_files(${$Actual_Imgpath},${$Hid_Imgpath},$storeimgpath,$file_cnt,'subprdimg'); //$insert_path=resize_imagefile(${$Actual_Imgpath},${$Hid_Imgpath},'300','200',$storeimgpath,$file_cnt,'subprdimg'); } else { $storeimgpath="gallery_images/prd_images"; $insert_path=upload_files(${$Actual_Imgpath},${$Hid_Imgpath},$storeimgpath,$file_cnt,'subprdimg'); } $j+=1; } $small_flag=0; //echo $hidimg_small_image_name; if($small_image_name !="" && $hidimg_small_image_name!="") { list($width,$height,$type,$attr)=getimagesize("$small_image_name"); if($width>300 || $height>200) { $imgpath="gallery_images/prd_small_images"; $insert_path_small=upload_files($small_image_name,$hidimg_small_image_name,$imgpath,$file_cnt,'subprdimg'); //$insert_path_small=resize_imagefile($small_image_name,$hidimg_small_image_name,'650','200',$imgpath,$file_cnt,'subprdimg'); } else { $imgpath="gallery_images/prd_small_images"; $insert_path_small=upload_files($small_image_name,$hidimg_small_image_name,$imgpath,$file_cnt,'subprdimg'); } $small_flag=1; } if($small_flag==0 && $small_image_name =="") { $insert_path_small=$hidimg_small_image_name; } if($flg==0) { $ins_imgdetail_qry="INSERT INTO ".PRODUCT_IMAGE_DETAILS." SET Product_Id='$pid', Alt_Text ='$AltText', Caption='$Caption', Image_Name='$insert_path', Image_Desc='$Imgdesc', Small_Alt_Text='$small_image_alt', Small_Caption='$small_image_caption', Small_Image_Name='$insert_path_small', Small_Image_Desc='$small_image_desc' "; $ins_imgdetail_res=mysql($db,$ins_imgdetail_qry); } } } $qry_sel = "select max(Product_Id) from ".PRODUCT_IMAGE_DETAILS; $qry_result = mysql($db, $qry_sel); list($pid) = mysql_fetch_array($qry_result); //For Small image start // End //To fill association table (To find the root of the selected category) //====================================================================== $root_id = assoc($root); //To find the status of the category //================================== $cat_status = cat_status($root); if($pid != 0 && $pid != "") { $insert_qry = "INSERT INTO ".PRODUCT_ASSOCIATE." (Product_Id, Category_Id, Root_Id, Cat_Status) VALUES('$pid','$cat_id','$root_id','$cat_status')"; $result = mysql($db, $insert_qry); } $chkpdf=0; if($prd_pdf!="" && $hidprd_pdf!="") { if(!is_file($prd_pdf) || filesize($prd_pdf)<=0) { $chkpdf=1; } else { $pdfpath="gallery_images/PDF_files"; $insert_pdfpath=upload_files($prd_pdf,$hidprd_pdf,$pdfpath,$pid,'prdpdf'); $concat_file=" Product_PDF ='$insert_pdfpath' ,"; } } $chkcad1=0; if($cad1!="" && $hidcad1!="") { if(!is_file($cad1) || filesize($cad1)<=0) { $chkcad1=1; } else { $cad1path="gallery_images/CAD1_images"; $insert_cad1path=upload_files($cad1,$hidcad1,$cad1path,$pid,'cad1_'); $concat_file.=" CAD_Drawing1='$insert_cad1path', "; } } $chkcad2=0; if($cad2!="" && $hidcad2!="") { if(!is_file($cad2) || filesize($cad2)<=0) { $chkcad2=1; } else { $cad2path="gallery_images/CAD2_images"; $insert_cad2path=upload_files($cad2,$hidcad2,$cad2path,$pid,'cad2_'); $concat_file.=" CAD_Drawing2 ='$insert_cad2path', "; } } $chkspec=0; if($spec1!="" && $hidspec1!="") { if(!is_file($spec1)|| filesize($spec1)<=0) { $chkspec=1; } else { $specpath="gallery_images/spec_documents"; $insert_specpath=upload_files($spec1,$hidspec1,$specpath,$pid,'spec'); $concat_file.=" Spec_Document ='$insert_specpath' "; } } if($concat_file) { $concat_file=eregi_replace(",$","",$concat_file); $upd_docmts_qry=" UPDATE ".PRODUCT_DETAILS." SET $concat_file WHERE Product_Id ='$pid'"; mysql($db,$upd_docmts_qry); } if($chkpdf==1 || $chkcad1 == 1 || $chkcad2==1 || $chkspec==1) { echo "Not valid file"; #echo ""; exit; } #echo ""; #echo ""; #echo ""; } if($type == "modify_prdt") { $value = $root; $dt = date("Y-m-d"); if($status == "") $status = 'N'; //This is to get the Product Description value //============================================== $proddesc0 = preg_replace("/\r|\n/", '', $proddesc0); if(!get_magic_quotes_runtime()) $proddesc0 = addslashes($proddesc0); //To update product master //======================== $qry_update = "UPDATE ".PRODUCT_DETAILS." SET Category_Id='$cat_id', Product_Code='$pcode', Product_Name='$pname' , Titlebar_Keyword ='$title_key', Meta_Keywords='$meta_keyword', Meta_Desc='$key_desc', Product_Desc='$proddesc0', Cart_Status='$cart_state', Price='$prd_price' WHERE Product_Id = '$prdt_id'"; $result_update = mysql($db, $qry_update); //This is to delete the database entries //======================================= $del_prddetail_qry="DELETE FROM ".PRODUCT_IMAGE_DETAILS." WHERE Product_Id ='$prdt_id'"; $del_prddetail_res=mysql($db,$del_prddetail_qry); //This is to insert into the Product Image details //================================================= $j=1; for($i=1;$i<=1;$i++) { $AltText=$_POST['alt_txt'.$i]; $Caption=$_POST['caption'.$i]; $Actual_Imgpath='img_file'.$i; $Hid_Imgpath='hidimg_file'.$i; $Imgdesc=$_POST['img_desc'.$i]; $file_cnt=$prdt_id."_".$j; $flg=0; //For Small image start $small_flag=0; if($small_image_name !="" && $hidimg_small_image_name!="") { list($width,$height,$type,$attr)=getimagesize("$small_image_name"); if($width>300 || $height>200) { $storeimgpath="gallery_images/prd_small_images"; $insert_path_small=upload_files($small_image_name,$hidimg_small_image_name,$storeimgpath,$file_cnt,'subprdimg'); // $insert_path_small=resize_imagefile($small_image_name,$hidimg_small_image_name,'300','200',$storeimgpath,$file_cnt,'subprdimg'); } else { $storeimgpath="gallery_images/prd_small_images"; $insert_path_small=upload_files($small_image_name,$hidimg_small_image_name,$storeimgpath,$file_cnt,'subprdimg'); } // $ins_imgdetail_small_qry="INSERT INTO ".PRODUCT_IMAGE_DETAILS." SET"; //$ins_imgdetail_small_res=mysql($db,$ins_imgdetail_small_qry); } if($small_flag==0 && $small_image_name =="") { $insert_path_small=$hidimg_small_image_name; } // End if(${$Actual_Imgpath}!="" && ${$Hid_Imgpath}!="") { if(!is_file(${$Actual_Imgpath}) || filesize(${$Actual_Imgpath})<=0) { $flg1=1; } else { list($width,$height,$type,$attr)=getimagesize(${$Actual_Imgpath}); if($width==664 && $height==313) { $storeimgpath="gallery_images/prd_images"; $insert_path=upload_files(${$Actual_Imgpath},${$Hid_Imgpath},$storeimgpath,$file_cnt,'subprdimg'); //$insert_path=resize_imagefile(${$Actual_Imgpath},${$Hid_Imgpath},'300','200',$storeimgpath,$file_cnt,'subprdimg'); } else { $storeimgpath="gallery_images/prd_images"; $insert_path=resize_imagefile(${$Actual_Imgpath},${$Hid_Imgpath},'664','313',$storeimgpath,$file_cnt,'subprdimg'); } # $insert_path=upload_files(${$Actual_Imgpath},${$Hid_Imgpath},'gallery_images/prd_images',$file_cnt,'subprdimg'); $j+=1; } if($flg==0) { $ins_imgdetail_qry="INSERT INTO ".PRODUCT_IMAGE_DETAILS." SET Product_Id='$prdt_id', Alt_Text ='$AltText', Caption='$Caption', Image_Name='$insert_path', Image_Desc='$Imgdesc', Small_Alt_Text='$small_image_alt', Small_Caption='$small_image_caption', Small_Image_Name='$insert_path_small', Small_Image_Desc='$small_image_desc' "; $ins_imgdetail_res=mysql($db,$ins_imgdetail_qry); } } else if(${$Actual_Imgpath}=="" && ${$Hid_Imgpath}!="") { $copypath="gallery_images/prd_images"; $insert_path=copy_img(${$Hid_Imgpath},$copypath,$file_cnt,'subprdimg'); $ins_imgdetail_qry="INSERT INTO ".PRODUCT_IMAGE_DETAILS." SET Product_Id='$prdt_id', Alt_Text ='$AltText', Caption='$Caption', Image_Name='$insert_path', Image_Desc='$Imgdesc', Small_Alt_Text='$small_image_alt', Small_Caption='$small_image_caption', Small_Image_Name='$insert_path_small', Small_Image_Desc='$small_image_desc' "; $ins_imgdetail_res=mysql($db,$ins_imgdetail_qry); $j+=1; } } $chkpdf=0; if($prd_pdf!="" && $hidprd_pdf!="") { if(!is_file($prd_pdf) || filesize($prd_pdf)<=0) { $chkpdf=1; } else { $pdfpath="gallery_images/PDF_files"; $insert_pdfpath=upload_files($prd_pdf,$hidprd_pdf,$pdfpath,$prdt_id,'prdpdf'); $concat_file=" Product_PDF ='$insert_pdfpath' ,"; } } $chkcad1=0; if($cad1!="" && $hidcad1!="") { if(!is_file($cad1) || filesize($cad1)<=0) { $chkcad1=1; } else { $cad1path="gallery_images/CAD1_images"; $insert_cad1path=upload_files($cad1,$hidcad1,$cad1path,$prdt_id,'cad1_'); $concat_file.=" CAD_Drawing1='$insert_cad1path' ,"; } } $chkcad2=0; if($cad2!="" && $hidcad2!="") { if(!is_file($cad2) || filesize($cad2)<=0) { $chkcad2=1; } else { $cad2path="gallery_images/CAD2_images"; $insert_cad2path=upload_files($cad2,$hidcad2,$cad2path,$prdt_id,'cad2_'); $concat_file.=" CAD_Drawing2 ='$insert_cad2path' ,"; } } $chkspec=0; if($spec1!="" && $hidspec1!="") { if(!is_file($spec1)|| filesize($spec1)<=0) { $chkspec=1; } else { $specpath="gallery_images/spec_documents"; $insert_specpath=upload_files($spec1,$hidspec1,$specpath,$prdt_id,'spec'); $concat_file.=" Spec_Document ='$insert_specpath' "; } } if($concat_file) { $concat_file=eregi_replace(",$","",$concat_file); $upd_docmts_qry=" UPDATE ".PRODUCT_DETAILS." SET $concat_file WHERE Product_Id ='$prdt_id'"; mysql($db,$upd_docmts_qry); } if($chkpdf==1 || $chkcad1 == 1 || $chkcad2==1 || $chkspec==1) { echo ""; exit; } echo ""; #echo ""; } if($type=="saveseq") { $len_order=count($disp_order); for($i=0;$i<$len_order;$i++) { $upd_order="UPDATE ".PRODUCT_DETAILS." set Display_Order ='$disp_order[$i]' where Product_Id ='$hid_order[$i]'"; mysql($db,$upd_order); } # echo ""; echo ""; } //This is to delete the individual product Image //============================================== if($type=="indvidual_img") { $sel_individualinmg_qry="SELECT Image_Name FROM ".PRODUCT_IMAGE_DETAILS." WHERE Image_Id ='$individual_id'"; $sel_individualinmg_res=mysql($db,$sel_individualinmg_qry); $sel_individualinmg_cnt=mysql_num_rows($sel_individualinmg_res); if($sel_individualinmg_cnt>0) { list($individualinmg)=mysql_fetch_array($sel_individualinmg_res); if(is_file("../gallery_images/prd_images/$individualinmg")) { unlink("../gallery_images/prd_images/$individualinmg"); } } $del_individualinmg_qry="DELETE FROM ".PRODUCT_IMAGE_DETAILS." WHERE Image_Id ='$individual_id'"; mysql($db,$del_individualinmg_qry); #echo ""; echo ""; } if($type == "prddelete") { $prodcnt=count($chkprod); $nd = 0; $d = 0; $content = '
Product Catalogue
'; $not_del = '
 
Below Products are available in Sales table. So they cannot be deleted

'; $del = '
S.No Product
 
Below Products deleted successfully

'; for($i=0;$i<$prodcnt;$i++) { $sales_count = 0; //To check whether the product available in Sales_Details table //============================================================== $chk_sales = "select count(Product_Id) from ".SALES_DETAILS." where Product_Id = '$chkprod[$i]'"; $sales_result = mysql($db, $chk_sales); list($sales_count) = mysql_fetch_array($sales_result); $sel_prdt = "SELECT Product_Name FROM ".PRODUCT_DETAILS." WHERE Product_Id ='$chkprod[$i]'"; $prdt_result = mysql($db, $sel_prdt); list($pdtname) = mysql_fetch_array($prdt_result); if($sales_count > 0) { $nd++; $not_del.= ''; } else { $d++; $del.= ''; //To delete files //=============== $img_path = "../gallery_images/"; //To delete from Product_Master table //=================================== $sel_img = "SELECT Product_PDF , CAD_Drawing1 , CAD_Drawing2 , Spec_Document FROM ".PRODUCT_DETAILS." WHERE Product_Id = '$chkprod[$i]'"; $img_result = mysql($db, $sel_img); list($dprd_pdf,$dcad1,$dcad2,$dspec1) = mysql_fetch_array($img_result); if(is_file("../gallery_images/PDF_files/$dprd_pdf")) { unlink("../gallery_images/PDF_files/$dprd_pdf"); } if(is_file("../gallery_images/CAD1_images/$dcad1")) { unlink("../gallery_images/CAD1_images/$dcad1"); } if(is_file("../gallery_images/CAD2_images/$dcad2")) { unlink("../gallery_images/CAD2_images/$dcad2"); } if(is_file("../gallery_images/spec_documents/$dspec1")) { unlink("../gallery_images/spec_documents/$dspec1"); } //To delete from Product table //======================================== $del_sql = "DELETE from ".PRODUCT_DETAILS." where Product_Id = '$chkprod[$i]'"; $del_result = mysql($db,$del_sql); //To Delete the Product Image details //==================================== $sel_imgdetail_qry="SELECT Image_Name FROM ".PRODUCT_IMAGE_DETAILS." WHERE Product_Id ='$chkprod[$i]'"; $sel_imgdetail_res=mysql($db,$sel_imgdetail_qry); while(list($detailimg)=mysql_fetch_array($sel_imgdetail_res)) { if(is_file("../gallery_images/prd_images/$detailimg")) { unlink("../gallery_images/prd_images/$detailimg"); } } //To Delete the Product Image Details //==================================== $del_imgdetail_qry="DELETE FROM ".PRODUCT_IMAGE_DETAILS." WHERE Product_Id ='$chkprod[$i]'"; $del_imgdetail_res=mysql($db,$del_imgdetail_qry); //To delete from Product_Association table //======================================== $del_sql = "DELETE FROM ".PRODUCT_ASSOCIATE." WHERE Product_Id = '$chkprod[$i]'"; $del_result = mysql($db,$del_sql); } } $not_del.="
S.No Product
'.$nd.' '.$pdtname.'
'.$d.' '.$pdtname.'
"; $del.="
"; if($d > 0) $content.= $del."
0) $content.= $not_del."

"; $content.=""; #echo ""; } ?>






The image you have uploaded is not a valid one. Please upload valid image files only
'; } if ($type == "error3") { echo '






The image you have uploaded is not a valid one. Please upload valid image files only
'; $colors = split(":",$clr); foreach($colors as $temp) { $del_qry = "Delete from ".PdtSubDtls." where Product_Id = '$pid'"; $del_result = mysql($db, $del_qry); } echo ""; } if ($type == "error3") { echo '






The main image you have uploaded is not a valid one. Please upload valid image files only
'; if($parent == "") { $product = "prdt_".$root; echo ""; } else { $product = "prdt_".$parent; echo ""; } } if ($type == "error4") { echo '






The image you have uploaded is not a valid one. Please upload valid image files only
'; //echo ""; } if ($type == "error5") { echo '






The image you have uploaded is not a valid one. Please upload valid image files only
'; //echo ""; } if($type == "delete") { echo $content; } echo $content; ?>