Guest Posted April 21, 2004 Share Posted April 21, 2004 Hey All I Made Adding Options A Little Bit Easier This Is What It Does When you edit a product there is a new row which says "Add Options" by clicking this, it opens a little window like this: With this wondow, when you chose the option and the option value you just click "Add to Product" and the window refreshes to its self adding the option instantly. You dont have to keep finding that product in the drop down list when adding multiple options to it. Which we all now that it gets very frustrating the only changes you need to make is in the edit_product.php, which a very small edit, all the rest in just an upload Even all the products that you have given option already will incorperate into this mod. The only thing that i didnt change is when you want to add a new option value and name you have to add it the same way. But after you add that option name and value then just go to the product that you want to give option to and add a way Also after you add a option to a product it displays it below the drop downs giving you the option to delete or edit that option. You can also edit any option that you gavwe to a product. Once you click the edit on that option the "Add to Product" button automaticly changes to "Edit Product Option". O YA one more thing is that you can even view that product by clickinh the magnifyer. This opens a new window were you can see the options you just added Let me know if you guys need more info on this mod or if ANY ONE wants to have this mod. Best Regards, wildbill Link to comment Share on other sites More sharing options...
Guest evelight Posted April 22, 2004 Share Posted April 22, 2004 This sounds like a winner How can we avail ourselves of it please. Regards Link to comment Share on other sites More sharing options...
Guest Diane Posted April 22, 2004 Share Posted April 22, 2004 Bill, I sell vinyl stickers and shirts so anything that makes adding options easier, I would dearly be interested in. For shirts, my options now are: style (long sleeve, short sleeve) size color lettering color Hmmm.... did you do the group option mod? It's been months since I looked at that. Wonder if your new mod and the group option mod would make for a killer combo? Diane Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2004 Share Posted April 22, 2004 Hey Ok here it is I have updated the old one that had the errors, there should be no errors now Easy Options Download the file then read the readme.txt file let mw know if you need any help P.S I zipped it as a .rar file ad if you cant open it then you need to go here and download the free .rar unzip program: http://download.com.com/3000-2250-10007677.html Let me know wildbill man i have a good BUZZZZZZZZZZZZZZZZZ B) Link to comment Share on other sites More sharing options...
Guest Posted April 26, 2004 Share Posted April 26, 2004 B) Hiu wildbill, I guess I did exactly what you wrote on the readme: 1. Make the changes on edit_product.php 2. Uploaded the 3 php files to the admin dir 3. Then uploaded the images When i try to edit any product the "Add Options" appears but then nothing happend... Did anything wrong? Tkx! P.S.: I'm very interested in thismod at it would make thing a looooot easier to me... Link to comment Share on other sites More sharing options...
Guest Posted April 30, 2004 Share Posted April 30, 2004 Does anyone else got this problem? It's supposed to open a new popup window, right? Tkx Link to comment Share on other sites More sharing options...
Guest Posted May 1, 2004 Share Posted May 1, 2004 Hey Post your edit_product.php page here I think you mist the $url="index"; before the include_once ("header.inc.php"); wildbill Link to comment Share on other sites More sharing options...
Guest Posted May 4, 2004 Share Posted May 4, 2004 Hey wildbill, Here it is. Tkx for hlping me out with this one!! Pardon__Me session_start(); // if session is not registered go to login if (!session_is_registered("admin"))  {   header("Location: login.php");  } // if session is registered if(session_is_registered("admin")){ include ("config.php"); include ("settings.inc.php"); include ("../images/makethumb.txt"); include_once ("header.inc.php"); echo "<h2>$la_edit_prod_title</h2>"; // if submit is clicked to edit a product if($edit) { // create link back to prev page $goback="<a href=\"javascript:history.back()\">$la_try_again</a>"; // make sure relevant fields were filled if ((empty($title)) or (empty($price)))  {  echo "<p align=\"center\">$la_account_form_must<br><br>$goback</p>";  exit;  } //begin product number error trapping if($prodnum!=$product) { $dupquery="select * from ".$prefix."store_inventory where product='$prodnum'"; $dupresult = mysql_query($dupquery); // if product number field is blank, create a product number if ((empty($prodnum)))  {  $addfrontchar = substr($title,0,3);  $addfrontchar = strtoupper($addfrontchar);  $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",   "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",   "4","5","6","7","8","9","0");  $max_chars = count($chars) - 1;  srand((double)microtime()*1000000);  for($i = 0; $i < 5; $i++)  {  $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)];  }  $addcatid = $cat_id;  $createprodnum = $addfrontchar . $randnum . $addcatid;  $prodnum = $createprodnum;  } // make sure product number doesn't already exist if (mysql_num_rows($dupresult)!=0 )  {  echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>";  exit;  } } // end product number error trapping if (empty($cat_id)) { echo "<p align=\"center\">$la_cat_must_selected<br><br>$goback</p>"; exit; } // make sure formatted properly if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) { echo "<p align=\"center\">$la_must_whole_no</p><p>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } $description = addslashes($description); $title = addslashes($title); // update db if(empty($sale_price))  {$sale_price="0.00";} $quantity=1; $sql_update = "update ".$prefix."store_inventory set title='$title', product='$prodnum', description='$description', quantity='$quantity', sale_price='$sale_price', price='$price', cat_id='$cat_id' where product='$product'"; $result = mysql_query ($sql_update); if ($image_function=="del"){   if ($dbimage !== "nophoto.jpg"){  // make sure image is not in use twice+   $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'");   $image_total = mysql_num_rows($image_dupe);   if($image_total==1){  if (file_exists("$site_dir/images/$dbimage")){  unlink("$site_dir/images/$dbimage");  if (file_exists("$site_dir/images/thumb_$dbimage")){  unlink("$site_dir/images/thumb_$dbimage");}  }// end if image total !==1  }  $product=$prodnum;  $dbimage = "nophoto.jpg";  $sql_update = "update ".$prefix."store_inventory set image='$dbimage' where product='$product'";  $result = mysql_query ($sql_update);} }  // Upload  if ($image_function=="up"){  $path = "$site_dir/images/";  $max_size = 200000;  if ($dbimage!=="nophoto.jpg")  {  $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'");  $image_total = mysql_num_rows($image_dupe);  if($image_total==1){  if (file_exists("$site_dir/images/$dbimage")){  unlink("$site_dir/images/$dbimage");  if (file_exists("$site_dir/images/thumb_$dbimage")){  unlink("$site_dir/images/thumb_$dbimage");}  }  }// end if image total !==1  }    if (is_uploaded_file($userfile)) {  if ($userfile_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; }  if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) {  if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; }  if($escape!=1){  $res = move_uploaded_file($userfile, $path . $userfile_name);  // create thumbnail  if (file_exists("$site_dir/images/"."thumb_$userfile_name"))  {    unlink("$site_dir/images/thumb_$userfile_name");   $thumb=new thumbnail("$site_dir/images/$userfile_name");   $thumb->size_auto(75);   $thumb->jpeg_quality(75);   $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);  } else {    $thumb=new thumbnail("$site_dir/images/$userfile_name");   $thumb->size_auto(75);   $thumb->jpeg_quality(75);   $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);  }  }   if($escape=1){$res="continue";}  // Resultant output  if (!$res) {  echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }  } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; }  if (empty($userfile_name))  {  $userfile_name="nophoto.jpg";  }  $product=$prodnum;  $sql_update = "update ".$prefix."store_inventory set image='$userfile_name' where product='$product'";  $result = mysql_query ($sql_update);  }  } $sql_select = "select * from ".$prefix."store_inventory where product ='$prodnum'"; $result = mysql_query($sql_select);  while ($row = mysql_fetch_array($result))  {  $userfile_name = $row["image"];  } if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";} if($sale_price!=="0.00"){$sale_result="$currency$sale_price";}  $description = stripslashes($description); $title = stripslashes($title); $title = stripslashes($title); $description = nl2br($description); $product=$prodnum; echo "<blockquote><p>$la_product_nm $product $la_it_upd_succ</p></blockquote> <FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">       <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_title</b></td>   <td width=\"400\" valign=\"top\">$title</td>  </tr>  <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">$product</td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_description</b></td>   <td width=\"400\" valign=\"top\">$description</td>  </tr>";  //<tr bgcolor=\"$colour_3\">  //  <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td>  //  <td width=\"400\" valign=\"top\">$quantity</td>  //</tr>  echo"<tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_norm_pri ($currency):</b></td>   <td width=\"400\" valign=\"top\">$currency$price</td>  </tr> <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_sale_pri ($currency):</b></td>   <td width=\"400\" valign=\"top\">$sale_result</td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>   <td width=\"400\" valign=\"top\">  <img src=\"../images/$userfile_name\"></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td>   <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"> </td>   <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"again\" VALUE=\"$la_edit_prod_again\"></td>  </tr> </table> </td></tr></table> </FORM>"; } if (!$edit) { $sql_select = "select * from ".$prefix."store_inventory where product ='$product'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result))    {      $title = $row["title"];      $product = $row["product"];   $description = $row["description"];      $quantity = $row["quantity"];      $price = $row["price"];   $sale_price = $row["sale_price"];   $dbimage = $row["image"];   $oldcat_id = $row["cat_id"];   } $title = stripslashes($title); $description = stripslashes($description); echo"<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"edit_product.php\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">       <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_title</b></td>   <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"title\" value=\"$title\"><font color=\"990000\"><b>*</b></font></td>  </tr>  <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"prodnum\" value=\"$product\"><font color=\"990000\"></font></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_description</b><br>$la_html_tip</td>   <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\">$description</textarea></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_category</b></td>   <td width=\"400\" valign=\"top\">"; // Drop down menu of full_cat_name!   print "<select  name=\"cat_id\">"; $select = mysql_query("select * from ".$prefix."store_category"); while ($row = mysql_fetch_array($select))    {      $cat_id_dd = $row["cat_id"];   $category = $row["category"];   $catfatherid_1 = $row["cat_father_id"]; echo"<option value=\"$cat_id_dd\" ";if($oldcat_id==$cat_id_dd){echo "selected";}echo">";      $t1 = $category;     if ($catfatherid_1 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_2 = $row1["cat_father_id"];       $catname_2 = $row1["category"];       $t2 = $catname_2;       $catid2 = $catid_2;     }     if ($catfatherid_2 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_3 = $row1["cat_father_id"];       $catname_3 = $row1["category"];       $t3 = $catname_3;       $catid3 = $catid_3;     }     if ($catfatherid_3 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_4 = $row1["cat_father_id"];       $catname_4 = $row1["category"];       $t4 = $catname_4;       $catid4 = $catid_4;     }     if ($catfatherid_4 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_5 = $row1["cat_father_id"];       $catname_5 = $row1["category"];       $t5 = $catname_5;       $catid5 = $catid_5;     }     if ($catfatherid_5 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_6 = $row1["cat_father_id"];       $catname_6 = $row1["category"];       $t6 = $catname_6;       $catid6 = $catid_6;     }     if ($catfatherid_6 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_7 = $row1["cat_father_id"];       $catname_7 = $row1["category"];       $t7 = $catname_7;       $catid7 = $catid_7;     }   if ($catfatherid_7 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_8 = $row1["cat_father_id"];       $catname_8 = $row1["category"];       $t8 = $catname_8;       $catid8 = $catid_8;     }  if ($catfatherid_8 <> 0)     {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_9 = $row1["cat_father_id"];       $catname_9 = $row1["category"];       $t9 = $catname_9;       } if ($t9) print "$t9/"; if ($t8) print "$t8/"; if ($t7) print "$t7/"; if ($t6) print "$t6/"; if ($t5) print "$t5/"; if ($t4) print "$t4/"; if ($t3) print "$t3/"; if ($t2) print "$t2/"; if ($t1) print "$t1/"; unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9); echo"</option>";}   echo"</select><font color=\"990000\"><b>*</b></font></td>  </tr>";  //<tr bgcolor=\"$colour_3\">  //  <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td>  //  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td>  //</tr>  echo"<tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_norm_pri</b></td>   <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td>   <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>Opções Produto:</b></td>   <td width=\"400\" valign=\"top\" align=\"center\">   <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', ','toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> </tr><tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td>   <td width=\"400\" valign=\"top\"> <img src=\"../images/$dbimage\"></td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_del_image_q</b></td>   <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q</b></td>   <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_keep_image_q</b></td>   <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td>  </tr>  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"><b>$la_up_new_img</b></td>   <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\"  TYPE=\"file\">$la_prod_types</td>  </tr bgcolor=\"$colour_3\">  <input type=\"hidden\" name=\"product\" value=\"$product\">  <input type=\"hidden\" name=\"dbimage\" value=\"$dbimage\">  <tr bgcolor=\"$colour_3\">   <td width=\"200\" valign=\"top\"> </td>   <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"edit\" VALUE=\"$la_edit_prod_title\"></td>  </tr> </table> </td></tr></table> </FORM>"; } include("footer.inc.php"); } // end if session is registered ?> Link to comment Share on other sites More sharing options...
Guest Posted May 4, 2004 Share Posted May 4, 2004 Hey Heres The Fix <? session_start(); // if session is not registered go to login if (!session_is_registered("admin")) {  header("Location: login.php"); } // if session is registered if(session_is_registered("admin")){ include ("config.php"); include ("settings.inc.php"); include ("../images/makethumb.txt"); include_once ("header.inc.php"); echo "<h2>$la_edit_prod_title</h2>"; // if submit is clicked to edit a product if($edit) { // create link back to prev page $goback="<a href=\"javascript:history.back()\">$la_try_again</a>"; // make sure relevant fields were filled if ((empty($title)) or (empty($price))) { echo "<p align=\"center\">$la_account_form_must<br><br>$goback</p>"; exit; } //begin product number error trapping if($prodnum!=$product) { $dupquery="select * from ".$prefix."store_inventory where product='$prodnum'"; $dupresult = mysql_query($dupquery); // if product number field is blank, create a product number if ((empty($prodnum))) { $addfrontchar = substr($title,0,3); $addfrontchar = strtoupper($addfrontchar); $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N",  "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3",  "4","5","6","7","8","9","0"); $max_chars = count($chars) - 1; srand((double)microtime()*1000000); for($i = 0; $i < 5; $i++) { $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; } $addcatid = $cat_id; $createprodnum = $addfrontchar . $randnum . $addcatid; $prodnum = $createprodnum; } // make sure product number doesn't already exist if (mysql_num_rows($dupresult)!=0 ) { echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>"; exit; } } // end product number error trapping if (empty($cat_id)) { echo "<p align=\"center\">$la_cat_must_selected<br><br>$goback</p>"; exit; } // make sure formatted properly if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) { echo "<p align=\"center\">$la_must_whole_no</p><p>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } $description = addslashes($description); $title = addslashes($title); // update db if(empty($sale_price)) {$sale_price="0.00";} $quantity=1; $sql_update = "update ".$prefix."store_inventory set title='$title', product='$prodnum', description='$description', quantity='$quantity', sale_price='$sale_price', price='$price', cat_id='$cat_id' where product='$product'"; $result = mysql_query ($sql_update); if ($image_function=="del"){ if ($dbimage !== "nophoto.jpg"){ // make sure image is not in use twice+  $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'");  $image_total = mysql_num_rows($image_dupe);  if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} }// end if image total !==1 } $product=$prodnum; $dbimage = "nophoto.jpg"; $sql_update = "update ".$prefix."store_inventory set image='$dbimage' where product='$product'"; $result = mysql_query ($sql_update);} } // Upload if ($image_function=="up"){ $path = "$site_dir/images/"; $max_size = 200000; if ($dbimage!=="nophoto.jpg")  {  $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'");  $image_total = mysql_num_rows($image_dupe);  if($image_total==1){  if (file_exists("$site_dir/images/$dbimage")){  unlink("$site_dir/images/$dbimage");  if (file_exists("$site_dir/images/thumb_$dbimage")){  unlink("$site_dir/images/thumb_$dbimage");}  }  }// end if image total !==1 } if (is_uploaded_file($userfile)) { if ($userfile_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; } if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) { if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; } if($escape!=1){ $res = move_uploaded_file($userfile, $path . $userfile_name); // create thumbnail if (file_exists("$site_dir/images/"."thumb_$userfile_name"))  {  unlink("$site_dir/images/thumb_$userfile_name");  $thumb=new thumbnail("$site_dir/images/$userfile_name");  $thumb->size_auto(75);  $thumb->jpeg_quality(75);  $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);  } else {  $thumb=new thumbnail("$site_dir/images/$userfile_name");  $thumb->size_auto(75);  $thumb->jpeg_quality(75);  $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version);  } }   if($escape=1){$res="continue";} // Resultant output if (!$res) { echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; } } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; } if (empty($userfile_name))  {  $userfile_name="nophoto.jpg";  } $product=$prodnum; $sql_update = "update ".$prefix."store_inventory set image='$userfile_name' where product='$product'"; $result = mysql_query ($sql_update); } } $sql_select = "select * from ".$prefix."store_inventory where product ='$prodnum'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result))  {  $userfile_name = $row["image"];  } if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";} if($sale_price!=="0.00"){$sale_result="$currency$sale_price";}  $description = stripslashes($description); $title = stripslashes($title); $title = stripslashes($title); $description = nl2br($description); $product=$prodnum; echo "<blockquote><p>$la_product_nm $product $la_it_upd_succ</p></blockquote> <FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">      <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_title</b></td>  <td width=\"400\" valign=\"top\">$title</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">$product</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_description</b></td>  <td width=\"400\" valign=\"top\">$description</td> </tr>"; //<tr bgcolor=\"$colour_3\"> //  <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> //  <td width=\"400\" valign=\"top\">$quantity</td> //</tr> echo"<tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_norm_pri ($currency):</b></td>  <td width=\"400\" valign=\"top\">$currency$price</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_sale_pri ($currency):</b></td>  <td width=\"400\" valign=\"top\">$sale_result</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td>  <td width=\"400\" valign=\"top\">  <img src=\"../images/$userfile_name\"></td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td>  <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td> </tr>  <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"> </td>  <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"again\" VALUE=\"$la_edit_prod_again\"></td> </tr> </table> </td></tr></table> </FORM>"; } if (!$edit) { $sql_select = "select * from ".$prefix."store_inventory where product ='$product'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result))   {     $title = $row["title"];     $product = $row["product"];  $description = $row["description"];     $quantity = $row["quantity"];     $price = $row["price"];  $sale_price = $row["sale_price"];  $dbimage = $row["image"];  $oldcat_id = $row["cat_id"];  } $title = stripslashes($title); $description = stripslashes($description); echo"<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"edit_product.php\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">      <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_title</b></td>  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"title\" value=\"$title\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"prodnum\" value=\"$product\"><font color=\"990000\"></font></td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_description</b><br>$la_html_tip</td>  <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\">$description</textarea></td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_category</b></td>  <td width=\"400\" valign=\"top\">"; // Drop down menu of full_cat_name!  print "<select  name=\"cat_id\">"; $select = mysql_query("select * from ".$prefix."store_category"); while ($row = mysql_fetch_array($select))   {     $cat_id_dd = $row["cat_id"];  $category = $row["category"];  $catfatherid_1 = $row["cat_father_id"]; echo"<option value=\"$cat_id_dd\" ";if($oldcat_id==$cat_id_dd){echo "selected";}echo">";    $t1 = $category;    if ($catfatherid_1 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_2 = $row1["cat_father_id"];       $catname_2 = $row1["category"];       $t2 = $catname_2;       $catid2 = $catid_2;    }    if ($catfatherid_2 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_3 = $row1["cat_father_id"];       $catname_3 = $row1["category"];       $t3 = $catname_3;       $catid3 = $catid_3;    }    if ($catfatherid_3 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_4 = $row1["cat_father_id"];       $catname_4 = $row1["category"];       $t4 = $catname_4;       $catid4 = $catid_4;    }    if ($catfatherid_4 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_5 = $row1["cat_father_id"];       $catname_5 = $row1["category"];       $t5 = $catname_5;       $catid5 = $catid_5;    }    if ($catfatherid_5 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_6 = $row1["cat_father_id"];       $catname_6 = $row1["category"];       $t6 = $catname_6;       $catid6 = $catid_6;    }    if ($catfatherid_6 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_7 = $row1["cat_father_id"];       $catname_7 = $row1["category"];       $t7 = $catname_7;       $catid7 = $catid_7;    } if ($catfatherid_7 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_8 = $row1["cat_father_id"];       $catname_8 = $row1["category"];       $t8 = $catname_8;       $catid8 = $catid_8;    } if ($catfatherid_8 <> 0)    {       $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8";       $result1 = mysql_query ($sql_lowercat);       $row1 = mysql_fetch_array($result1);       $catfatherid_9 = $row1["cat_father_id"];       $catname_9 = $row1["category"];       $t9 = $catname_9;     } if ($t9) print "$t9/"; if ($t8) print "$t8/"; if ($t7) print "$t7/"; if ($t6) print "$t6/"; if ($t5) print "$t5/"; if ($t4) print "$t4/"; if ($t3) print "$t3/"; if ($t2) print "$t2/"; if ($t1) print "$t1/"; unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9); echo"</option>";}  echo"</select><font color=\"990000\"><b>*</b></font></td> </tr>"; //<tr bgcolor=\"$colour_3\"> //  <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> //  <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\"  name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td> //</tr> echo"<tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_norm_pri</b></td>  <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td>  <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\"  name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>Opções Produto:</b></td>  <td width=\"400\" valign=\"top\" align=\"center\">  <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> </tr><tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td>  <td width=\"400\" valign=\"top\"> <img src=\"../images/$dbimage\"></td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_del_image_q</b></td>  <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q</b></td>  <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_keep_image_q</b></td>  <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td> </tr> <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"><b>$la_up_new_img</b></td>  <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\"  TYPE=\"file\">$la_prod_types</td> </tr bgcolor=\"$colour_3\">  <input type=\"hidden\" name=\"product\" value=\"$product\">  <input type=\"hidden\" name=\"dbimage\" value=\"$dbimage\">  <tr bgcolor=\"$colour_3\">  <td width=\"200\" valign=\"top\"> </td>  <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"edit\" VALUE=\"$la_edit_prod_title\"></td> </tr> </table> </td></tr></table> </FORM>"; } include("footer.inc.php"); } // end if session is registered ?> I had an extra , in the code Opps Anyways just copy the code over your edit_product.php page and let me know wildbill Link to comment Share on other sites More sharing options...
Guest Kolomee Posted May 5, 2004 Share Posted May 5, 2004 Hi wildbill, Can you please highlight the changes here. I have similar prob. Thanks! Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2004 Share Posted May 5, 2004 Hey Ok here is the acctual fix The part that was added to edit_product.php, there is a line of code that looks like this  <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', ','toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> Replace it with this  <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> and all should work If you notice in the first code there is a ',' before toolbar=no. I just removed ', Let me know if this worked wildbill Link to comment Share on other sites More sharing options...
Guest Kolomee Posted May 5, 2004 Share Posted May 5, 2004 Thanks, wildbill! It's working fine now Cheers! Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2004 Share Posted May 5, 2004 Tkx wilbbill working perfectly and it's really a lot easyer! Cya! Pardon__Me Link to comment Share on other sites More sharing options...
Guest twisted Posted June 1, 2004 Share Posted June 1, 2004 Wildbill, Just wanted to say THANKS for a great little mod. Installing it took all of 3 minutes, and it works a TREAT!!!! Gonna save a lot of work adding options! Just one little thing... product_op.php, line 57, reads: Â Â Â <td width=\"22%\" height=\"35\"><a href=\"http://faerynicethings.com/view_product.php?product=$product\" faerynicethings needs to be changed to either $site_url (or whatever it is), or remind people in the readme to change the site url to their own site. Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2004 Share Posted June 25, 2004 Well this is my first post.... I liked the software that much I went and purchased a licence straight away coz I feel that people like this should be supported.... I want to say thank you for this mod.... it is truely superb!!! Thanks wildbill MiniMe Link to comment Share on other sites More sharing options...
Guest Posted June 28, 2004 Share Posted June 28, 2004 Thanks for this mod it's really a great one. I have one question though why is it when I click on view product in the pop up window does it take me to. http://faerynicethings.com/view_product.ph...uct=%20INGR31O3 Link to comment Share on other sites More sharing options...
Guest Posted June 29, 2004 Share Posted June 29, 2004 Wildbill, Just wanted to say THANKS for a great little mod. Installing it took all of 3 minutes, and it works a TREAT!!!! Gonna save a lot of work adding options! Just one little thing... product_op.php, line 57, reads:    <td width=\"22%\" height=\"35\"><a href=\"http://faerynicethings.com/view_product.php?product=$product\" faerynicethings needs to be changed to either $site_url (or whatever it is), or remind people in the readme to change the site url to their own site. This is why: Link to comment Share on other sites More sharing options...
Guest Posted June 30, 2004 Share Posted June 30, 2004 Thanks for that, would you happen to know I do so it displays the product being edited. Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2004 Share Posted July 21, 2004 Wild Bill you are a star!! It worked - I just couldn't see it as I was looking at the bottom of the screen for it!! My adult shop means I need to add batteries or clothing sizes to the majority of the stock and this is going to make it so much simpler. Many thanks. Only thing I have noticed is that it wont let me edit the product number if I have made a mistake. Is this some code that I missed? It appears to be amending my product number when I edit the item. One went from 3198 to gibberish! Helen Helshop & House of Lust Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2004 Share Posted July 23, 2004 Hey copy paste your edit_product.php page here Then i will see whats going on wildbill Link to comment Share on other sites More sharing options...
Guest Posted July 23, 2004 Share Posted July 23, 2004 Hi Wildbill. Thanks for looking at this. I think it duplicated the product and gave it a random code when I pressed the edit button mistakenly after adding options. Have steered clear of edit button since but there will be a point when I need to use it. Have to say that this mod is fantastic - is so simple to use. Half the stock for House of Lust site either has batteries or size or colour options so you have saved me so many hours of work. <?php /*************************************************************************** * File Info: admin/edit_product.php * Purpose: Edit Product * Updated: 31/07/2003 **************************************************************************** * Developer: Alistar Brookbanks (Brooky.com) * Copyright: ©2003 http://www.brooky.com * Copyright: ©2003 http://www.cubecart.com * This program is not "free" software and restrictions apply! * Further Info: http://www.cubecart.com/license.php * Contact [email protected] if any conditions are not clear. * * Licensees holding valid "CubeCart Licence Number" may edit * the (powered by CubeCart) from browser title and "Powered by CubeCart" * and "© Brooky.com" from the web page footer. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. This and all others in the download package can only be * redistributed with written permission from Alistair Brookbanks! * * The "CubeCart License" is available to purchase at * https://secure.cubecart.com/ * For pricing please contact us via e-mail at [email protected] ***************************************************************************/ /*************************************************************************** * Modified by BrJones33 for custom/automated Product ID No - Thank you sir! ****************************************************************************/ session_start(); // if session is not registered go to login if (!session_is_registered("admin")) { header("Location: login.php"); } // if session is registered if(session_is_registered("admin")){ include ("config.php"); include ("settings.inc.php"); include ("../images/makethumb.txt"); include_once ("header.inc.php"); echo "<h2>$la_edit_prod_title</h2>"; // if submit is clicked to edit a product if($edit) { // create link back to prev page $goback="<a href=\"java script:history.back()\">$la_try_again</a>"; // make sure relevant fields were filled if ((empty($title)) or (empty($price))) { echo "<p align=\"center\">$la_account_form_must<br><br>$goback</p>"; exit; } //begin product number error trapping if($prodnum!=$product) { $dupquery="select * from ".$prefix."store_inventory where product='$prodnum'"; $dupresult = mysql_query($dupquery); // if product number field is blank, create a product number if ((empty($prodnum))) { $addfrontchar = substr($title,0,3); $addfrontchar = strtoupper($addfrontchar); $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", "4","5","6","7","8","9","0"); $max_chars = count($chars) - 1; srand((double)microtime()*1000000); for($i = 0; $i < 5; $i++) { $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; } $addcatid = $cat_id; $createprodnum = $addfrontchar . $randnum . $addcatid; $prodnum = $createprodnum; } // make sure product number doesn't already exist if (mysql_num_rows($dupresult)!=0 ) { echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>"; exit; } } // end product number error trapping if (empty($cat_id)) { echo "<p align=\"center\">$la_cat_must_selected<br><br>$goback</p>"; exit; } // make sure formatted properly if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) { echo "<p align=\"center\">$la_must_whole_no</p><p>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } $description = addslashes($description); $title = addslashes($title); // update db if(empty($sale_price)) {$sale_price="0.00";} $quantity=1; $sql_update = "update ".$prefix."store_inventory set title='$title', product='$prodnum', description='$description', quantity='$quantity', sale_price='$sale_price', price='$price', cat_id='$cat_id' where product='$product'"; $result = mysql_query ($sql_update); if ($image_function=="del"){ if ($dbimage !== "nophoto.jpg"){ // make sure image is not in use twice+ $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} }// end if image total !==1 } $product=$prodnum; $dbimage = "nophoto.jpg"; $sql_update = "update ".$prefix."store_inventory set image='$dbimage' where product='$product'"; $result = mysql_query ($sql_update);} } // Upload if ($image_function=="up"){ $path = "$site_dir/images/"; $max_size = 200000; if ($dbimage!=="nophoto.jpg") { $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} } }// end if image total !==1 } if (is_uploaded_file($userfile)) { if ($userfile_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; } if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) { if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; } if($escape!=1){ $res = move_uploaded_file($userfile, $path . $userfile_name); // create thumbnail if (file_exists("$site_dir/images/"."thumb_$userfile_name")) { unlink("$site_dir/images/thumb_$userfile_name"); $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } else { $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } } if($escape=1){$res="continue";} // Resultant output if (!$res) { echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } if (empty($userfile_name)) { $userfile_name="nophoto.jpg"; } $product=$prodnum; $sql_update = "update ".$prefix."store_inventory set image='$userfile_name' where product='$product'"; $result = mysql_query ($sql_update); } } $sql_select = "select * from ".$prefix."store_inventory where product ='$prodnum'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $userfile_name = $row["image"]; } if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";} if($sale_price!=="0.00"){$sale_result="$currency$sale_price";} $description = stripslashes($description); $title = stripslashes($title); $title = stripslashes($title); $description = nl2br($description); $product=$prodnum; echo "<blockquote><p>$la_product_nm $product $la_it_upd_succ</p></blockquote> <FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\">$title</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">$product</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b></td> <td width=\"400\" valign=\"top\">$description</td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\">$quantity</td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri ($currency):</b></td> <td width=\"400\" valign=\"top\">$currency$price</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>Product Options</b></td> <td width=\"400\" valign=\"top\" align=\"left\"> <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> </tr> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$userfile_name\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td> <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"again\" VALUE=\"$la_edit_prod_again\"></td> </tr> </table> </td></tr></table> </FORM>"; } if (!$edit) { $sql_select = "select * from ".$prefix."store_inventory where product ='$product'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $title = $row["title"]; $product = $row["product"]; $description = $row["description"]; $quantity = $row["quantity"]; $price = $row["price"]; $sale_price = $row["sale_price"]; $dbimage = $row["image"]; $oldcat_id = $row["cat_id"]; } $title = stripslashes($title); $description = stripslashes($description); echo"<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"edit_product.php\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"title\" value=\"$title\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>Product Options</b></td> <td width=\"400\" valign=\"top\" align=\"left\"> <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Edit/View/Add Options</a></td> </tr> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b><br>$la_html_tip</td> <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\">$description</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_category</b></td> <td width=\"400\" valign=\"top\">"; // Drop down menu of full_cat_name! print "<select name=\"cat_id\">"; $select = mysql_query("select * from ".$prefix."store_category"); while ($row = mysql_fetch_array($select)) { $cat_id_dd = $row["cat_id"]; $category = $row["category"]; $catfatherid_1 = $row["cat_father_id"]; echo"<option value=\"$cat_id_dd\" ";if($oldcat_id==$cat_id_dd){echo "selected";}echo">"; $t1 = $category; if ($catfatherid_1 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_2 = $row1["cat_father_id"]; $catname_2 = $row1["category"]; $t2 = $catname_2; $catid2 = $catid_2; } if ($catfatherid_2 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_3 = $row1["cat_father_id"]; $catname_3 = $row1["category"]; $t3 = $catname_3; $catid3 = $catid_3; } if ($catfatherid_3 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_4 = $row1["cat_father_id"]; $catname_4 = $row1["category"]; $t4 = $catname_4; $catid4 = $catid_4; } if ($catfatherid_4 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_5 = $row1["cat_father_id"]; $catname_5 = $row1["category"]; $t5 = $catname_5; $catid5 = $catid_5; } if ($catfatherid_5 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_6 = $row1["cat_father_id"]; $catname_6 = $row1["category"]; $t6 = $catname_6; $catid6 = $catid_6; } if ($catfatherid_6 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_7 = $row1["cat_father_id"]; $catname_7 = $row1["category"]; $t7 = $catname_7; $catid7 = $catid_7; } if ($catfatherid_7 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_8 = $row1["cat_father_id"]; $catname_8 = $row1["category"]; $t8 = $catname_8; $catid8 = $catid_8; } if ($catfatherid_8 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_9 = $row1["cat_father_id"]; $catname_9 = $row1["category"]; $t9 = $catname_9; } if ($t9) print "$t9/"; if ($t8) print "$t8/"; if ($t7) print "$t7/"; if ($t6) print "$t6/"; if ($t5) print "$t5/"; if ($t4) print "$t4/"; if ($t3) print "$t3/"; if ($t2) print "$t2/"; if ($t1) print "$t1/"; unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9); echo"</option>";} echo"</select><font color=\"990000\"><b>*</b></font></td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$dbimage\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_del_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_keep_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img</b></td> <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\" TYPE=\"file\">$la_prod_types</td> </tr bgcolor=\"$colour_3\"> <input type=\"hidden\" name=\"product\" value=\"$product\"> <input type=\"hidden\" name=\"dbimage\" value=\"$dbimage\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"edit\" VALUE=\"$la_edit_prod_title\"></td> </tr> </table> </td></tr></table> </FORM>"; } include("footer.inc.php"); } // end if session is registered ?> Many Thanks Helen Helshop and House of Lust Link to comment Share on other sites More sharing options...
Guest Posted July 24, 2004 Share Posted July 24, 2004 Hello HEHE Ok This was an easy fix What you did was when you added the option mod you took out the text box for the product number. The script will create a random number if the Product Number is empty. Being that it wasnt there it thought it was empty So thus creating a new product code lol i have added the box back and also gave you something that will make editing products a snap. i put a quick product search at the top of the edit_product.php page if you know the products number then all you have to do is type it in and click go Anyways you will see Here the fix: <?php /*************************************************************************** * File Info: admin/edit_product.php * Purpose: Edit Product * Updated: 31/07/2003 **************************************************************************** * Developer: Alistar Brookbanks (Brooky.com) * Copyright: ©2003 http://www.brooky.com * Copyright: ©2003 http://www.cubecart.com * This program is not "free" software and restrictions apply! * Further Info: http://www.cubecart.com/license.php * Contact [email protected] if any conditions are not clear. * * Licensees holding valid "CubeCart Licence Number" may edit * the (powered by CubeCart) from browser title and "Powered by CubeCart" * and "© Brooky.com" from the web page footer. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. This and all others in the download package can only be * redistributed with written permission from Alistair Brookbanks! * * The "CubeCart License" is available to purchase at * https://secure.cubecart.com/ * For pricing please contact us via e-mail at [email protected] ***************************************************************************/ /*************************************************************************** * Modified by BrJones33 for custom/automated Product ID No - Thank you sir! ****************************************************************************/ session_start(); // if session is not registered go to login if (!session_is_registered("admin")) { header("Location: login.php"); } // if session is registered if(session_is_registered("admin")){ include ("config.php"); include ("settings.inc.php"); include ("../images/makethumb.txt"); include_once ("header.inc.php"); echo "<h2>$la_edit_prod_title</h2>"; $goback="<a href=\"javascript:history.back()\">$la_try_again</a>"; echo"<FORM ACTION=\"edit_product.php\" METHOD=\"POST\">";?>  <center>  <table border="0" cellpadding="0" cellspacing="0" height="1" width="100%">   <tr>    <td width="100%" height="1" align="center">  <?    echo"Product Search:  <input type=\"text\" name=\"product\" class=\"textbox\" size=\"20\">  <input type=\"submit\" class=\"submit\" value=\"Go\" name=\"go\">       </td>   </tr>  </table></form>  </center>";  if ($go){  $query = "SELECT * FROM ".$prefix."store_inventory where product='$product'"; $result = mysql_query($query) or die("Error: " . mysql_error()); $count_result = mysql_num_rows($result);  if (empty($product)){  echo"<center><font color='cc0000'>You Must Enter A Product Number!</font></center>";  exit;} if(mysql_num_rows($result) == 0){ echo"<p align=\"center\"><font color='cc0000'>Sorry, The Product $product Does Not Appear To Be In The Database<br>Please Try Again!</font></p><br>"; exit;}} // if submit is clicked to edit a product if($edit) { // create link back to prev page $goback="<a href=\"javascript:history.back()\">$la_try_again</a>"; // make sure relevant fields were filled if ((empty($title)) or (empty($price))) { echo "<p align=\"center\">$la_account_form_must<br><br>$goback</p>"; exit; } //begin product number error trapping if($prodnum!=$product) { $dupquery="select * from ".$prefix."store_inventory where product='$prodnum'"; $dupresult = mysql_query($dupquery); // if product number field is blank, create a product number if ((empty($prodnum))) { $addfrontchar = substr($title,0,3); $addfrontchar = strtoupper($addfrontchar); $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", "4","5","6","7","8","9","0"); $max_chars = count($chars) - 1; srand((double)microtime()*1000000); for($i = 0; $i < 5; $i++) { $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; } $addcatid = $cat_id; $createprodnum = $addfrontchar . $randnum . $addcatid; $prodnum = $createprodnum; } // make sure product number doesn't already exist if (mysql_num_rows($dupresult)!=0 ) { echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>"; exit; } } // end product number error trapping if (empty($cat_id)) { echo "<p align=\"center\">$la_cat_must_selected<br><br>$goback</p>"; exit; } // make sure formatted properly if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) { echo "<p align=\"center\">$la_must_whole_no</p><p>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } $description = addslashes($description); $title = addslashes($title); // update db if(empty($sale_price)) {$sale_price="0.00";} $quantity=1; $sql_update = "update ".$prefix."store_inventory set title='$title', product='$prodnum', description='$description', quantity='$quantity', sale_price='$sale_price', price='$price', cat_id='$cat_id' where product='$product'"; $result = mysql_query ($sql_update); if ($image_function=="del"){ if ($dbimage !== "nophoto.jpg"){ // make sure image is not in use twice+ $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} }// end if image total !==1 } $product=$prodnum; $dbimage = "nophoto.jpg"; $sql_update = "update ".$prefix."store_inventory set image='$dbimage' where product='$product'"; $result = mysql_query ($sql_update);} } // Upload if ($image_function=="up"){ $path = "$site_dir/images/"; $max_size = 200000; if ($dbimage!=="nophoto.jpg") { $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} } }// end if image total !==1 } if (is_uploaded_file($userfile)) { if ($userfile_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; } if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) { if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; } if($escape!=1){ $res = move_uploaded_file($userfile, $path . $userfile_name); // create thumbnail if (file_exists("$site_dir/images/"."thumb_$userfile_name")) { unlink("$site_dir/images/thumb_$userfile_name"); $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } else { $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } } if($escape=1){$res="continue";} // Resultant output if (!$res) { echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; } } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"javascript:history.back()\">$la_try_again</a></p>\n"; exit; } if (empty($userfile_name)) { $userfile_name="nophoto.jpg"; } $product=$prodnum; $sql_update = "update ".$prefix."store_inventory set image='$userfile_name' where product='$product'"; $result = mysql_query ($sql_update); } } $sql_select = "select * from ".$prefix."store_inventory where product ='$prodnum'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $userfile_name = $row["image"]; } if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";} if($sale_price!=="0.00"){$sale_result="$currency$sale_price";} $description = stripslashes($description); $title = stripslashes($title); $title = stripslashes($title); $description = nl2br($description); $product=$prodnum; echo "<blockquote><p>$la_product_nm $product $la_it_upd_succ</p></blockquote> <FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\">$title</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">$product</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b></td> <td width=\"400\" valign=\"top\">$description</td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\">$quantity</td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri ($currency):</b></td> <td width=\"400\" valign=\"top\">$currency$price</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>Product Options</b></td> <td width=\"400\" valign=\"top\" align=\"left\"> <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Add Options</a></td> </tr> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$userfile_name\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td> <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"again\" VALUE=\"$la_edit_prod_again\"></td> </tr> </table> </td></tr></table> </FORM>"; } if (!$edit) { $sql_select = "select * from ".$prefix."store_inventory where product ='$product'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $title = $row["title"]; $product = $row["product"]; $description = $row["description"]; $quantity = $row["quantity"]; $price = $row["price"]; $sale_price = $row["sale_price"]; $dbimage = $row["image"]; $oldcat_id = $row["cat_id"]; } $title = stripslashes($title); $description = stripslashes($description); echo"<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"edit_product.php\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"title\" value=\"$title\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr>  <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">   <input class=\"textbox\" type=\"textbox\"  name=\"prodnum\" value=\"$product\" size=\"20\"><font color=\"990000\"></font></td>  </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>Product Options</b></td> <td width=\"400\" valign=\"top\" align=\"left\"> <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Edit/View/Add Options</a></td> </tr> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b><br>$la_html_tip</td> <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\">$description</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_category</b></td> <td width=\"400\" valign=\"top\">"; // Drop down menu of full_cat_name! print "<select name=\"cat_id\">"; $select = mysql_query("select * from ".$prefix."store_category"); while ($row = mysql_fetch_array($select)) { $cat_id_dd = $row["cat_id"]; $category = $row["category"]; $catfatherid_1 = $row["cat_father_id"]; echo"<option value=\"$cat_id_dd\" ";if($oldcat_id==$cat_id_dd){echo "selected";}echo">"; $t1 = $category; if ($catfatherid_1 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_2 = $row1["cat_father_id"]; $catname_2 = $row1["category"]; $t2 = $catname_2; $catid2 = $catid_2; } if ($catfatherid_2 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_3 = $row1["cat_father_id"]; $catname_3 = $row1["category"]; $t3 = $catname_3; $catid3 = $catid_3; } if ($catfatherid_3 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_4 = $row1["cat_father_id"]; $catname_4 = $row1["category"]; $t4 = $catname_4; $catid4 = $catid_4; } if ($catfatherid_4 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_5 = $row1["cat_father_id"]; $catname_5 = $row1["category"]; $t5 = $catname_5; $catid5 = $catid_5; } if ($catfatherid_5 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_6 = $row1["cat_father_id"]; $catname_6 = $row1["category"]; $t6 = $catname_6; $catid6 = $catid_6; } if ($catfatherid_6 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_7 = $row1["cat_father_id"]; $catname_7 = $row1["category"]; $t7 = $catname_7; $catid7 = $catid_7; } if ($catfatherid_7 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_8 = $row1["cat_father_id"]; $catname_8 = $row1["category"]; $t8 = $catname_8; $catid8 = $catid_8; } if ($catfatherid_8 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_9 = $row1["cat_father_id"]; $catname_9 = $row1["category"]; $t9 = $catname_9; } if ($t9) print "$t9/"; if ($t8) print "$t8/"; if ($t7) print "$t7/"; if ($t6) print "$t6/"; if ($t5) print "$t5/"; if ($t4) print "$t4/"; if ($t3) print "$t3/"; if ($t2) print "$t2/"; if ($t1) print "$t1/"; unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9); echo"</option>";} echo"</select><font color=\"990000\"><b>*</b></font></td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$dbimage\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_del_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_keep_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img</b></td> <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\" TYPE=\"file\">$la_prod_types</td> </tr bgcolor=\"$colour_3\"> <input type=\"hidden\" name=\"product\" value=\"$product\"> <input type=\"hidden\" name=\"dbimage\" value=\"$dbimage\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"edit\" VALUE=\"$la_edit_prod_title\"></td> </tr> </table> </td></tr></table> </FORM>"; } include("footer.inc.php"); } // end if session is registered ?> Let me know if all works P.S I accept donations for my work you may make donations here The Mod Store Look For The "Make A Donation" Button wildbill Link to comment Share on other sites More sharing options...
Guest Posted July 24, 2004 Share Posted July 24, 2004 Hi Wildbill, Many thanks for that. Will give it a go. Have to say this was one of the simplest mods to add and has such a major improvement. I have said before it would be a godo idea to score the mods in terms of difficulty in adding them or skill level needed. You could score this one as easy (even helen can do this one!!) It worked!!!!!! I am off to make a donation now. You are a star - not only do you provide the mods you help us when we screw them up as well!! Many Thanks Helen Helshop & House of Lust Link to comment Share on other sites More sharing options...
Guest Posted July 27, 2004 Share Posted July 27, 2004 Hi Bill, have amended my edit product page to add the two images mod. Then added your mod back in but it has lost the search box you made me and I really liked that. Which bit do I need to add in to get that back. Thanks Helen Helshop & House of Lust /*************************************************************************** * File Info: admin/edit_product.php * Purpose: Edit Product * Updated: 31/07/2003 **************************************************************************** * Developer: Alistar Brookbanks (Brooky.com) * Copyright: ©2003 http://www.brooky.com * Copyright: ©2003 http://www.cubecart.com * This program is not "free" software and restrictions apply! * Further Info: http://www.cubecart.com/license.php * Contact [email protected] if any conditions are not clear. * * Licensees holding valid "CubeCart Licence Number" may edit * the (powered by CubeCart) from browser title and "Powered by CubeCart" * and "© Brooky.com" from the web page footer. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE. This and all others in the download package can only be * redistributed with written permission from Alistair Brookbanks! * * The "CubeCart License" is available to purchase at * https://secure.cubecart.com/ * For pricing please contact us via e-mail at [email protected] ***************************************************************************/ /*************************************************************************** * Modified by BrJones33 for custom/automated Product ID No - Thank you sir! ****************************************************************************/ session_start(); // if session is not registered go to login if (!session_is_registered("admin")) { header("Location: login.php"); } // if session is registered if(session_is_registered("admin")){ include ("config.php"); include ("settings.inc.php"); include ("../images/makethumb.txt"); include_once ("header.inc.php"); echo "<h2>$la_edit_prod_title</h2>"; // if submit is clicked to edit a product if($edit) { // create link back to prev page $goback="<a class=MainLink href=\"java script:history.back()\">$la_try_again</a>"; // make sure relevant fields were filled if ((empty($title)) or (empty($price))) { echo "<p align=\"center\">$la_account_form_must<br><br>$goback</p>"; exit; } //begin product number error trapping if($prodnum!=$product) { $dupquery="select * from ".$prefix."store_inventory where product='$prodnum'"; $dupresult = mysql_query($dupquery); // if product number field is blank, create a product number if ((empty($prodnum))) { $addfrontchar = substr($title,0,3); $addfrontchar = strtoupper($addfrontchar); $chars = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N", "O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3", "4","5","6","7","8","9","0"); $max_chars = count($chars) - 1; srand((double)microtime()*1000000); for($i = 0; $i < 5; $i++) { $randnum = ($i == 0) ? $chars[rand(0, $max_chars)] : $randnum . $chars[rand(0, $max_chars)]; } $addcatid = $cat_id; $createprodnum = $addfrontchar . $randnum . $addcatid; $prodnum = $createprodnum; } // make sure product number doesn't already exist if (mysql_num_rows($dupresult)!=0 ) { echo "<p align=\"center\"><b>$la_prod_exists</b><br><br>$goback</p>"; exit; } } // end product number error trapping if (empty($cat_id)) { echo "<p align=\"center\">$la_cat_must_selected<br><br>$goback</p>"; exit; } // make sure formatted properly if (eregi("[a-z\.\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $quantity)) { echo "<p align=\"center\">$la_must_whole_no</p><p>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } if (eregi("[a-z\!\"\£\$\%\^\&\*\(\)\-\+\{\}\:\;\'\@\~\#\\\|\<\>\?\/]", $sale_price)) { echo "<p align=\"center\">$la_price_no_val<br><br>$goback</p>"; exit; } $description = addslashes($description); $title = addslashes($title); // update db if(empty($sale_price)) {$sale_price="0.00";} $quantity=1; $sql_update = "update ".$prefix."store_inventory set title='$title', product='$prodnum', description='$description', quantity='$quantity', sale_price='$sale_price', price='$price', cat_id='$cat_id' where product='$product'"; $result = mysql_query ($sql_update); if ($image_function=="del"){ if ($dbimage !== "nophoto.jpg"){ // make sure image is not in use twice+ $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image2 = '$dbimage'"); $image_total += mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} }// end if image total !==1 } $product=$prodnum; $dbimage = "nophoto.jpg"; $sql_update = "update ".$prefix."store_inventory set image='$dbimage' where product='$product'"; $result = mysql_query ($sql_update);} } if ($image_function2=="del"){ if ($dbimage2 !== "nophoto.jpg"){ // make sure image is not in use twice+ $image_dupe2 = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage2'"); $image_total2 = mysql_num_rows($image_dupe2); $image_dupe2 = mysql_query("select * from ".$prefix."store_inventory where image2 = '$dbimage2'"); $image_total2 += mysql_num_rows($image_dupe2); if($image_total2==1){ if (file_exists("$site_dir/images/$dbimage2")){ unlink("$site_dir/images/$dbimage2"); if (file_exists("$site_dir/images/thumb_$dbimage2")){ unlink("$site_dir/images/thumb_$dbimage2");} }// end if image total !==1 } $product=$prodnum; $dbimage2 = "nophoto.jpg"; $sql_update = "update ".$prefix."store_inventory set image2='$dbimage2' where product='$product'"; $result = mysql_query ($sql_update);} } // Upload if ($image_function=="up"){ $path = "$site_dir/images/"; $max_size = 200000; if ($dbimage!=="nophoto.jpg") { $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage'"); $image_total = mysql_num_rows($image_dupe); $image_dupe = mysql_query("select * from ".$prefix."store_inventory where image2 = '$dbimage'"); $image_total += mysql_num_rows($image_dupe); if($image_total==1){ if (file_exists("$site_dir/images/$dbimage")){ unlink("$site_dir/images/$dbimage"); if (file_exists("$site_dir/images/thumb_$dbimage")){ unlink("$site_dir/images/thumb_$dbimage");} } }// end if image total !==1 } if (is_uploaded_file($userfile)) { if ($userfile_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; } if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) { if (file_exists($path . $userfile_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape=1; } if($escape!=1){ $res = move_uploaded_file($userfile, $path . $userfile_name); // create thumbnail if (file_exists("$site_dir/images/"."thumb_$userfile_name")) { unlink("$site_dir/images/thumb_$userfile_name"); $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } else { $thumb=new thumbnail("$site_dir/images/$userfile_name"); $thumb->size_auto(75); $thumb->jpeg_quality(75); $thumb->save("$site_dir/images/thumb_$userfile_name", $gd_version); } } if($escape=1){$res="continue";} // Resultant output if (!$res) { echo "<p align=\"center\">$la_upload_failed<br><br><a class=MainLink href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } } else { echo "<p align=\"center\">$la_wrong_type<br><br><a class=MainLink href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } if (empty($userfile_name)) { $userfile_name="nophoto.jpg"; } $product=$prodnum; $sql_update = "update ".$prefix."store_inventory set image='$userfile_name' where product='$product'"; $result = mysql_query ($sql_update); } } // Upload 2 if ($image_function2=="up"){ $path2 = "$site_dir/images/"; $max_size2 = 200000; if ($dbimage2!=="nophoto.jpg") { $image_dupe2 = mysql_query("select * from ".$prefix."store_inventory where image = '$dbimage2'"); $image_total2 = mysql_num_rows($image_dupe2); $image_dupe2 = mysql_query("select * from ".$prefix."store_inventory where image2 = '$dbimage2'"); $image_total2 += mysql_num_rows($image_dupe2); if($image_total2==1){ if (file_exists("$site_dir/images/$dbimage2")){ unlink("$site_dir/images/$dbimage2"); if (file_exists("$site_dir/images/thumb_$dbimage2")){ unlink("$site_dir/images/thumb_$dbimage2");} } }// end if image total !==1 } if (is_uploaded_file($userfile2)) { if ($userfile2_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; } if (($userfile2_type=="image/x-png") || ($userfile2_type=="image/pjpeg") || ($userfile2_type=="image/jpeg")) { if (file_exists($path . $userfile2_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n";$escape2=1; } if($escape2!=1){ $res2 = move_uploaded_file($userfile2, $path . $userfile2_name);} if($escape2=1){$res2="continue";} // Resultant output if (!$res2) { echo "<p align=\"center\">$la_upload_failed<br><br><a href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } } else { echo "<p align=\"center\">$la_wrong_type<br><br><a href=\"java script:history.back()\">$la_try_again</a></p>\n"; exit; } if (empty($userfile2_name)) { $userfile2_name="nophoto.jpg"; } $product=$prodnum; $sql_update2 = "update ".$prefix."store_inventory set image2='$userfile2_name' where product='$product'"; $result2 = mysql_query ($sql_update2); } } $sql_select = "select * from ".$prefix."store_inventory where product ='$prodnum'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $userfile_name = $row["image"]; $userfile2_name = $row["image2"]; } if($sale_price=="0.00"){$sale_result="$la_it_nt_sale";} if($sale_price!=="0.00"){$sale_result="$currency$sale_price";} $description = stripslashes($description); $title = stripslashes($title); $title = stripslashes($title); $description = nl2br($description); $product=$prodnum; echo "<blockquote><p>$la_product_nm $product $la_it_upd_succ</p></blockquote> <FORM ACTION=\"edit_product.php?product=$product\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\">$title</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\">$product</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b></td> <td width=\"400\" valign=\"top\">$description</td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\">$quantity</td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri ($currency):</b></td> <td width=\"400\" valign=\"top\">$currency$price</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>Product Options</b></td> <td width=\"400\" valign=\"top\" align=\"left\"> <a href=\"#\" onClick=\"window.open('product_op.php?product=$product&title=$title', 'myWin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=700, height=300'); return false\">Edit/View/Add Options</a></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$userfile_name\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$userfile_name\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image2</b></td> <td width=\"400\" valign=\"top\"><img src=\"../images/$userfile2_name\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_url</b> [ <a class=MainLink href=\"$site_url/view_product.php?product=$product\" target=\"_blank\" >$la_cust_view</a> ]</td> <td width=\"400\" valign=\"top\"><textarea name='code' cols='55' rows='3'>$site_url/view_product.php?product=$product</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"again\" VALUE=\"$la_edit_prod_again\"></td> </tr> </table> </td></tr></table> </FORM>"; } if (!$edit) { $sql_select = "select * from ".$prefix."store_inventory where product ='$product'"; $result = mysql_query($sql_select); while ($row = mysql_fetch_array($result)) { $title = $row["title"]; $product = $row["product"]; $description = $row["description"]; $quantity = $row["quantity"]; $price = $row["price"]; $sale_price = $row["sale_price"]; $dbimage = $row["image"]; $dbimage2 = $row["image2"]; $oldcat_id = $row["cat_id"]; } $title = stripslashes($title); $description = stripslashes($description); echo"<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"edit_product.php\" METHOD=\"POST\"> <table align=center width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr><td bgcolor=\"$colour_2\"> <table width=\"100%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_title</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"title\" value=\"$title\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_stock</b></td> <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"prodnum\" value=\"$product\"><font color=\"990000\"></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_description</b><br>$la_html_tip</td> <td width=\"400\" valign=\"top\"><textarea name=\"description\" cols=\"40\" rows=\"8\">$description</textarea></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_category</b></td> <td width=\"400\" valign=\"top\">"; // Drop down menu of full_cat_name! print "<select name=\"cat_id\">"; $select = mysql_query("select * from ".$prefix."store_category"); while ($row = mysql_fetch_array($select)) { $cat_id_dd = $row["cat_id"]; $category = $row["category"]; $catfatherid_1 = $row["cat_father_id"]; echo"<option value=\"$cat_id_dd\" ";if($oldcat_id==$cat_id_dd){echo "selected";}echo">"; $t1 = $category; if ($catfatherid_1 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_1"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_2 = $row1["cat_father_id"]; $catname_2 = $row1["category"]; $t2 = $catname_2; $catid2 = $catid_2; } if ($catfatherid_2 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_2"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_3 = $row1["cat_father_id"]; $catname_3 = $row1["category"]; $t3 = $catname_3; $catid3 = $catid_3; } if ($catfatherid_3 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_3"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_4 = $row1["cat_father_id"]; $catname_4 = $row1["category"]; $t4 = $catname_4; $catid4 = $catid_4; } if ($catfatherid_4 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_4"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_5 = $row1["cat_father_id"]; $catname_5 = $row1["category"]; $t5 = $catname_5; $catid5 = $catid_5; } if ($catfatherid_5 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_5"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_6 = $row1["cat_father_id"]; $catname_6 = $row1["category"]; $t6 = $catname_6; $catid6 = $catid_6; } if ($catfatherid_6 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_6"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_7 = $row1["cat_father_id"]; $catname_7 = $row1["category"]; $t7 = $catname_7; $catid7 = $catid_7; } if ($catfatherid_7 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_7"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_8 = $row1["cat_father_id"]; $catname_8 = $row1["category"]; $t8 = $catname_8; $catid8 = $catid_8; } if ($catfatherid_8 <> 0) { $sql_lowercat = "select * from ".$prefix."store_category where cat_id = $catfatherid_8"; $result1 = mysql_query ($sql_lowercat); $row1 = mysql_fetch_array($result1); $catfatherid_9 = $row1["cat_father_id"]; $catname_9 = $row1["category"]; $t9 = $catname_9; } if ($t9) print "$t9/"; if ($t8) print "$t8/"; if ($t7) print "$t7/"; if ($t6) print "$t6/"; if ($t5) print "$t5/"; if ($t4) print "$t4/"; if ($t3) print "$t3/"; if ($t2) print "$t2/"; if ($t1) print "$t1/"; unset($t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$catfatherid_1,$catfatherid_2,$catfatherid_3,$catfatherid_4,$catfatherid_5,$catfatherid_6,$catfatherid_7,$catfatherid_8,$catfatherid_9,$catname_1,$catname_2,$catname_3,$catname_4,$catname_5,$catname_6,$catname_7,$catname_8,$catname_9); echo"</option>";} echo"</select><font color=\"990000\"><b>*</b></font></td> </tr>"; //<tr bgcolor=\"$colour_3\"> // <td width=\"200\" valign=\"top\"><b>$la_quantity</b></td> // <td width=\"400\" valign=\"top\"><input class=\"textbox\" type=\"textbox\" name=\"quantity\" value=\"$quantity\"><font color=\"990000\"><b>*</b></font></td> //</tr> echo"<tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_norm_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"price\" value=\"$price\"><font color=\"990000\"><b>*</b></font></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_sale_pri</b></td> <td width=\"400\" valign=\"top\">$currency<input class=\"textbox\" type=\"textbox\" name=\"sale_price\" value=\"$sale_price\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image</b><br><img src=\"../images/thumb_$dbimage\"></td> <td width=\"400\" valign=\"top\"> <img src=\"../images/$dbimage\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_del_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_keep_image_q</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img</b></td> <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile\" TYPE=\"file\">$la_prod_types</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_prod_image2</b></td> <td width=\"400\" valign=\"top\"><img src=\"../images/$dbimage2\"></td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_del_image_q2</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function2\" type=\"radio\" value=\"del\">$la_must_to_del_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img_q2</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function2\" type=\"radio\" value=\"up\">$la_must_to_up_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_keep_image_q2</b></td> <td width=\"400\" valign=\"top\"><input name=\"image_function2\" type=\"radio\" value=\"\" checked>$la_must_to_keep_cur</td> </tr> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"><b>$la_up_new_img2</b></td> <td width=\"400\" valign=\"top\"><INPUT class=\"file\" NAME=\"userfile2\" TYPE=\"file\">$la_prod_types</td> </tr bgcolor=\"$colour_3\"> <input type=\"hidden\" name=\"product\" value=\"$product\"> <input type=\"hidden\" name=\"dbimage\" value=\"$dbimage\"> <input type=\"hidden\" name=\"dbimage2\" value=\"$dbimage2\"> <tr bgcolor=\"$colour_3\"> <td width=\"200\" valign=\"top\"> </td> <td width=\"400\" valign=\"top\"><INPUT class=\"submit\" TYPE=\"submit\" name=\"edit\" VALUE=\"$la_edit_prod_title\"></td> </tr> </table> </td></tr></table> </FORM>"; } include("footer.inc.php"); } // end if session is registered ?> Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2004 Share Posted July 28, 2004 ;) Great Mod. Help appreciated. Thanks. Mohan Link to comment Share on other sites More sharing options...
Recommended Posts