php image resize..
Posted: Thu Mar 19, 2009 11:44 pm
hii..
i provided image upload functionality in my script, in which user can upload 3 types of images (thumbnail, picture, enlargedpicture), but when user uploads "1024*768" sized as thumbnail image it is not getting resized and looking very awkward in the main page.
for the existing script i need to add image resize functionality, here with i'm pasting my original php file which deals with image uploading, can anyone please let me know how to add image resize functionality within my script.
if anyone needs more clarity regarding this, i'll let you know..
kindly do help me....
many thanks in advance,
i provided image upload functionality in my script, in which user can upload 3 types of images (thumbnail, picture, enlargedpicture), but when user uploads "1024*768" sized as thumbnail image it is not getting resized and looking very awkward in the main page.
for the existing script i need to add image resize functionality, here with i'm pasting my original php file which deals with image uploading, can anyone please let me know how to add image resize functionality within my script.
Code: Select all
<?php
//ADMIN :: products managment
include("./cfg/connect.inc.php");
include("./includes/database/".DBMS.".php");
include("./core_functions/category_functions.php");
include("./core_functions/product_functions.php");
include("./core_functions/picture_functions.php");
include("./core_functions/configurator_functions.php");
include("./core_functions/datetime_functions.php");
include("./core_functions/tax_function.php");
include("./core_functions/setting_functions.php" );
include( "./core_functions/functions.php" );
include( "./classes/class.ivalidator.php" );
//authorized access check
session_start();
@set_time_limit(0);
MagicQuotesRuntimeSetting();
//connect 2 database
db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
db_select_db(DB_NAME) or die (db_error());
settingDefineConstants();
//current language
include("./cfg/language_list.php");
if (!isset($_SESSION["current_language"]) ||
$_SESSION["current_language"] < 0 || $_SESSION["current_language"] > count($lang_list))
$_SESSION["current_language"] = 0; //set default language
//include a language file
if (isset($lang_list[$_SESSION["current_language"]]) &&
file_exists("languages/".$lang_list[$_SESSION["current_language"]]->filename))
{
//include current language file
include("languages/".$lang_list[$_SESSION["current_language"]]->filename);
}
else
{
die("<font color=red><b>ERROR: Couldn't find language file!</b></font>");
}
include("./checklogin.php");
if ( CONF_BACKEND_SAFEMODE != 1 && (!isset($_SESSION["log"]) || strcmp($_SESSION["log"],ADMIN_LOGIN))) //unauthorized
{
die (ERROR_FORBIDDEN);
}
// several function
// *****************************************************************************
// Purpose gets size
// Inputs
// Remarks
// Returns
function GetPictureSize( $filename )
{
$size_info=getimagesize("./products_pictures/".$filename);
return ((string)($size_info[0] + 40 )).", ".((string)($size_info[1] + 40 ));
}
// *****************************************************************************
// Purpose gets client JavaScript to reload opener page
// Inputs
// Remarks
// Returns
function ReLoadOpener()
{
if ( $_GET["productID"]==0 )
$categoryID=$_POST["categoryID"];
else
{
$q=db_query("select categoryID from ".PRODUCTS_TABLE.
" where productID='".$_GET["productID"]."'");
$r=db_fetch_row($q);
$categoryID=$r["categoryID"];
}
echo("<script language='JavaScript'>");
echo(" try");
echo(" {");
echo(" window.opener.location.reload();");
echo(" }");
echo(" catch(e) { }");
echo("</script>");
}
// *****************************************************************************
// Purpose gets client JavaScript to close page
// Inputs
// Remarks
// Returns
function CloseWindow()
{
echo("<script language='JavaScript'>");
echo(" window.close();\n");
echo("</script>");
}
// *****************************************************************************
// Purpose gets client JavaScript to open in new window
// option_value_configurator.php
// Inputs
// Remarks
// Returns
function OpenConfigurator($optionID, $productID)
{
$url = "option_value_configurator.php?optionID=".$optionID."&productID=".$productID;
echo("<script language='JavaScript'>\n");
echo(" w=400; \n");
echo(" h=400; \n");
echo(" link='".$url."'; \n");
echo(" var win = 'width='+w+',height='+h+',menubar=no,location=no,resizable=yes,scrollbars=yes';\n");
echo(" wishWin = window.open(link,'wishWin',win);\n");
echo("</script>\n");
}
if ( isset($_GET["delete"]) )
{
if (CONF_BACKEND_SAFEMODE) //this action is forbidden when SAFE MODE is ON
{
Redirect("products.php?safemode=yes&productID=".$_GET["productID"]);
}
DeleteProduct( $_GET["productID"] );
CloseWindow();
ReLoadOpener();
}
if (!isset($_GET["productID"])) $_GET["productID"]=0;
$_GET["productID"] = (int)$_GET["productID"];
$productID = $_GET["productID"];
if (isset($_POST) && count($_POST)>0)
{
if (CONF_BACKEND_SAFEMODE) //this action is forbidden when SAFE MODE is ON
{
Redirect("products.php?safemode=yes&productID=".$productID);
}
}
// save product
if ( isset($_POST["save_product"]) )
{
if ( $_GET["productID"] == 0 )
{
$productID = AddProduct(
$_POST["categoryID"], $_POST["name"], $_POST["price"], $_POST["description"],
$_POST["in_stock"],
$_POST["brief_description"], $_POST["list_price"],
$_POST["product_code"], $_POST["sort_order"],
$_POST["weight"], $_POST["meta_description"],
$_POST["meta_keywords"], isset($_POST["free_shipping"]),
$_POST["min_order_amount"], $_POST["shipping_freight"],
$_POST["tax_class"] );
$_GET["productID"] = $productID;
$updatedValues = ScanPostVariableWithId( array( "option_value", "option_radio_type" ) );
cfgUpdateOptionValue($productID, $updatedValues);
}
else
{
UpdateProduct( $productID,
$_POST["categoryID"], $_POST["name"], $_POST["price"], $_POST["description"],
$_POST["in_stock"], $_POST["rating"],
$_POST["brief_description"], $_POST["list_price"],
$_POST["product_code"], $_POST["sort_order"],
$_POST["weight"], $_POST["meta_description"],
$_POST["meta_keywords"], isset($_POST["free_shipping"]),
$_POST["min_order_amount"], $_POST["shipping_freight"],
$_POST["tax_class"] );
$updatedValues = ScanPostVariableWithId( array( "option_value", "option_radio_type" ) );
cfgUpdateOptionValue($productID, $updatedValues);
}
if ( CONF_UPDATE_GCV == '1' )
update_products_Count_Value_For_Categories(1);
AddNewPictures( $_GET["productID"],
"new_filename", "new_thumbnail", "new_enlarged",
$_POST["default_picture"] );
ReLoadOpener();
if ( $_POST["save_product_without_closing"]=="0" )
CloseWindow();
}
// save pictures
if ( isset( $_POST["save_pictures"] ) )
{
if ( $_GET["productID"] == 0 )
{
$productID = AddProduct(
$_POST["categoryID"], $_POST["name"], $_POST["price"], $_POST["description"],
$_POST["in_stock"],
$_POST["brief_description"], $_POST["list_price"],
$_POST["product_code"], $_POST["sort_order"],
$_POST["weight"], $_POST["meta_description"],
$_POST["meta_keywords"], isset($_POST["free_shipping"]),
$_POST["min_order_amount"], $_POST["shipping_freight"],
$_POST["tax_class"] );
$_GET["productID"] = $productID;
}
$product = GetProduct($_GET["productID"]);
if(!$product['default_picture']){
AddNewPictures( $_GET["productID"],
"new_filename", "new_thumbnail", "new_enlarged", $_POST["default_picture"] );
}
unset($product);
$updatedFileNames = ScanPostVariableWithId(
array( "filename", "thumbnail", "enlarged" ) );
UpdatePictures( $_GET["productID"], $updatedFileNames, $_POST["default_picture"] );
ReLoadOpener();
}
// delete three picture
if ( isset( $_GET["delete_pictures"] ) )
{
if (CONF_BACKEND_SAFEMODE) //this action is forbidden when SAFE MODE is ON
{
Redirect("products.php?safemode=yes&productID=".$productID);
}
DeleteThreePictures( $_GET["photoID"] );
ReLoadOpener();
}
// delete one picture
if ( isset( $_GET["delete_one_picture"] ) )
{
if (CONF_BACKEND_SAFEMODE) //this action is forbidden when SAFE MODE is ON
{
Redirect("products.php?safemode=yes&productID=".$productID);
}
if ( isset( $_GET["filename"] ) )
DeleteFilenamePicture( $_GET["filename"] );
if ( isset( $_GET["thumbnail"] ) )
DeleteThumbnailPicture( $_GET["thumbnail"] );
if ( isset( $_GET["enlarged"] ) )
DeleteEnlargedPicture( $_GET["enlarged"] );
ReLoadOpener();
}
// add new product and open configurator
// it works when user click "setting..." and new product is added
if ( isset($_POST["AddProductAndOpenConfigurator"]) )
{
$productID = AddProduct(
$_POST["categoryID"], $_POST["name"], $_POST["price"], $_POST["description"],
$_POST["in_stock"],
$_POST["brief_description"], $_POST["list_price"],
$_POST["product_code"], $_POST["sort_order"],
$_POST["weight"], $_POST["meta_description"],
$_POST["meta_keywords"], isset($_POST["free_shipping"]),
$_POST["min_order_amount"], $_POST["shipping_freight"],
$_POST["tax_class"] );
$_GET["productID"] = $productID;
$updatedValues = ScanPostVariableWithId( array( "option_value", "option_radio_type" ) );
cfgUpdateOptionValue($productID, $updatedValues);
OpenConfigurator($_POST["optionID"], $productID);
}
// show product
if ( $_GET["productID"] != 0 )
{
$product = GetProduct($_GET["productID"]);
$title = $product["name"];
}
else
{
$product = array();
$title = ADMIN_PRODUCT_NEW;
$cat = isset($_GET["categoryID"]) ? $_GET["categoryID"] : 0;
$product["categoryID"] = $cat;
$product["name"] = "";
$product["description"] = "";
$product["customers_rating"] = "";
$product["Price"] = 0;
$product["picture"] = "";
$product["in_stock" ] = 0;
$product["thumbnail" ] = "";
$product["big_picture" ] = "";
$product["brief_description"] = "";
$product["list_price"] = 0;
$product["product_code"] = "";
$product["sort_order"] = 0;
$product["date_added"] = null;
$product["date_modified"] = null;
$product["weight"] = 0;
$product["meta_description"] = "";
$product["meta_keywords"] = "";
$product["free_shipping"] = 0;
$product["min_order_amount"] = 1;
if ( CONF_DEFAULT_TAX_CLASS == '0' )
$product["classID"] = "null";
else
$product["classID"] = CONF_DEFAULT_TAX_CLASS;
$product["shipping_freight"] = 0;
}
// gets ALL product options
$options = cfgGetProductOptionValue( $_GET["productID"] );
$options = html_spchars($options);
// gets pictures
$picturies = GetPictures( $_GET["productID"] );
// hide/show tables
$showConfiguratorTable = 0;
if ( isset($_POST["ConfiguratorHideTable_hidden"]) )
if ( $_POST["ConfiguratorHideTable_hidden"] == "1" )
$showConfiguratorTable = 1;
$tax_classes = taxGetTaxClasses();
?>
<html>
<head>
<link rel=STYLESHEET href="style1.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo DEFAULT_CHARSET;?>">
<title><?php echo ADMIN_PRODUCT_TITLE;?></title>
<script>
function confirmDelete(question, where)
{
temp = window.confirm(question);
if (temp) //delete
{
window.location=where;
}
}
function open_window(link,w,h) //opens new window
{
var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
wishWin = window.open(link,'wishWin',win);
}
function position_this_window()
{
var x = (screen.availWidth - 795) / 2;
window.resizeTo(795, screen.availHeight - 50);
window.moveTo(Math.floor(x),25);
}
</script>
</head>
<body bgcolor=#FFFFE2 onLoad="position_this_window();">
<center>
<p>
<b><?php echo $title; ?></b>
<?php
if ( isset($_GET["couldntToDelete"]) )
{
?>
<br>
<font color=red>
<b><?php echo COULD_NOT_DELETE_THIS_PRODUCT?><b>
</font>
<?php
}
?>
<?php
if ( isset($_GET["safemode"]) )
{
echo "<p><font color=red><b>".ADMIN_SAFEMODE_WARNING."<b></font>";
}
?>
<form enctype="multipart/form-data" action="products.php?productID=<?php echo $_GET["productID"]?>"
method=post name="MainForm">
<table width=100% border=0 cellpadding=3 cellspacing=0>
<tr>
<td align=right><?php echo ADMIN_CATEGORY_PARENT;?></td>
<td>
<select name="categoryID" <?php
if (CONF_FULLY_EXPAND_CATEGORIES_IN_ADMIN_MODE == 0) // update list
echo "onChange=\"window.location='products.php?productID=".$_GET["productID"]."&change_category='+document.MainForm.categoryID.value;\"";
?>>
<?php
if (CONF_FULLY_EXPAND_CATEGORIES_IN_ADMIN_MODE == 1) echo "<option value=\"1\">".ADMIN_CATEGORY_ROOT."</option>";
//show categories select element
$core_category = (isset($_GET["change_category"])) ? (int)$_GET["change_category"] : $product["categoryID"] ;
if (CONF_FULLY_EXPAND_CATEGORIES_IN_ADMIN_MODE == 0)
$cats = catGetCategoryCompactCList($core_category);
else
$cats = catGetCategoryCList();
for ($i=0; $i<count($cats); $i++)
{
echo "<option value=\"".$cats[$i]["categoryID"]."\"";
if ($core_category == $cats[$i]["categoryID"]) //select category
echo " selected";
echo ">";
for ($j=0;$j<$cats[$i]["level"];$j++) echo " ";
echo $cats[$i]["name"];
echo "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_PRODUCT_NAME;?>
</td>
<td>
<input type="text" name="name" value="<?php echo str_replace("\"",""",$product["name"]); ?>">
</td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_PRODUCT_CODE;?>
</td>
<td>
<input type="text" name="product_code"
value="<?php echo str_replace("\"",""",$product["product_code"] ); ?>">
</td>
</tr>
<tr>
<td align=right><?php echo ADMIN_TAX_CLASS;?></td>
<td>
<select name='tax_class'>
<option value='null'><?php echo ADMIN_NOT_DEFINED;?></option>
<?php
foreach( $tax_classes as $tax_class )
{
?>
<option value='<?php echo $tax_class["classID"];?>'
<?php
if ( $product["classID"] == $tax_class["classID"] )
{
?>
selected
<?php
}
?>
>
<?php echo $tax_class["name"];?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<?php
if ( !is_null($product["date_added"]) )
{
?>
<tr>
<td align=right>
<?php echo ADMIN_DATE_ADDED;?>
</td>
<td>
<?php echo $product["date_added"]?>
</td>
</tr>
<?php
}
?>
<?php
if ( !is_null($product["date_modified"]) )
{
?>
<tr>
<td align=right>
<?php echo ADMIN_DATE_MODIFIED;?>
</td>
<td>
<?php echo $product["date_modified"]?>
</td>
</tr>
<?php
}
?>
<?php
if ($_GET["productID"])
{
?>
<tr>
<td align=right>
<?php echo ADMIN_PRODUCT_RATING;?>
</td>
<td>
<input type=text name="rating"
value="<?php echo str_replace("\"",""",$product["customers_rating"]); ?>">
</td>
</tr>
<?php }; ?>
<tr>
<td align=right>
<?php echo ADMIN_SORT_ORDER;?>
</td>
<td>
<input type="text" name="sort_order" value="<?php echo $product["sort_order"];?>">
</td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_PRODUCT_PRICE;?>, <?php echo STRING_UNIVERSAL_CURRENCY;?><br>(<?php echo STRING_NUMBER_ONLY;?>):
</td>
<td>
<input type="text" name="price" value=<?php echo $product["Price"]; ?>>
</td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_PRODUCT_LISTPRICE;?>, <?php echo STRING_UNIVERSAL_CURRENCY;?><br>(<?php echo STRING_NUMBER_ONLY;?>):
</td>
<td>
<input type="text" name="list_price" value=<?php echo $product["list_price"];?>>
</td>
</tr>
<?php
if ($product["in_stock"]<0) $is = 0;
else $is = $product["in_stock"];
if (CONF_CHECKSTOCK == 1) {
?>
<tr>
<td align=right><?php echo ADMIN_PRODUCT_INSTOCK;?>:</td>
<td><input type="text" name="in_stock" value="<?php echo $is;?>"></td>
</tr>
<?php } else { ?>
<input type=hidden name="in_stock" value="<?php echo $is;?>">
<?php } ?>
<tr>
<td align=right>
<?php echo ADMIN_SHIPPING_FREIGHT;?>
</td>
<td>
<input type="text" name="shipping_freight" value=<?php echo $product["shipping_freight"];?>>
</td>
</tr>
<tr>
<td align=right><?php echo ADMIN_PRODUCT_WEIGHT;?></td>
<td><input type=text name='weight'
value='<?php echo $product["weight"];?>'> <?php echo CONF_WEIGHT_UNIT;?></td>
</tr>
<tr>
<td align=right><?php echo ADMIN_FREE_SHIPPING;?></td>
<td><input type=checkbox name='free_shipping'
<?php
if ( $product["free_shipping"] )
{
?>
checked
<?php
}
?>
value='1'>
</td>
</tr>
<tr>
<td align=right><?php echo ADMIN_MIN_ORDER_AMOUNT;?></td>
<td><input type=text name='min_order_amount'
value='<?php echo $product["min_order_amount"];?>'>
</td>
</tr>
<?php
@list($picture) = $picturies;
?>
<tr>
<td valign="top" align="right"><?php echo ADMIN_PRODUCT_PICTURE;?></td>
<td>
<input type="hidden" name="save_pictures" value="<?php echo ADMIN_SAVE_PHOTOS?>" />
<input type="hidden" name="default_picture" value="<?php echo $picture["photoID"];?>" checked="checked" />
<input type="file" name="new_filename" /><br />
<?php
if ( file_exists("./products_pictures/".$picture["filename"])
&& trim($picture["filename"]) != "" ){
echo $picture["filename"]."<br />
<a class=small href='javascript:open_window(\"products_pictures/".$picture["filename"]."\",".GetPictureSize($picture["filename"]).")'>".ADMIN_PHOTO_PREVIEW."</a>
| <a class=small href=\"javascript:confirmDelete('".QUESTION_DELETE_PICTURE."', 'products.php?delete_one_picture=1&filename=".$picture["photoID"]."&productID=".$_GET["productID"]."')\">".DELETE_BUTTON."</a>
";
}else
echo ADMIN_PICTURE_NOT_UPLOADED;
?>
</td>
</tr>
<tr>
<td valign="top" align="right"><?php echo ADMIN_PRODUCT_THUMBNAIL;?></td>
<td><input type="file" name="new_thumbnail" /><br />
<?php
if ( file_exists("./products_pictures/".$picture["thumbnail"])
&& trim($picture["thumbnail"]) != "" ){
echo $picture["thumbnail"]."<br />
<a class=small href='javascript:open_window(\"products_pictures/".$picture["thumbnail"]."\",".GetPictureSize($picture["thumbnail"]).")'>".ADMIN_PHOTO_PREVIEW."</a>
| <a class=small href=\"javascript:confirmDelete('".QUESTION_DELETE_PICTURE."', 'products.php?delete_one_picture=1&thumbnail=".$picture["photoID"]."&productID=".$_GET["productID"]."')\">".DELETE_BUTTON."</a>
";
}else
echo ADMIN_PICTURE_NOT_UPLOADED;
?>
</td>
</tr>
<tr>
<td valign="top" align="right"><?php echo ADMIN_PRODUCT_BIGPICTURE;?></td>
<td><input type="file" name="new_enlarged" /><br />
<?php
if ( file_exists("./products_pictures/".$picture["enlarged"])
&& trim($picture["enlarged"]) != "" ){
echo $picture["enlarged"]."<br />
<a class=small href='javascript:open_window(\"products_pictures/".$picture["enlarged"]."\",".GetPictureSize($picture["enlarged"]).")'>".ADMIN_PHOTO_PREVIEW."</a>
| <a class=small href=\"javascript:confirmDelete('".QUESTION_DELETE_PICTURE."', 'products.php?delete_one_picture=1&enlarged=".$picture["photoID"]."&productID=".$_GET["productID"]."')\">".DELETE_BUTTON."</a>
";
}else
echo ADMIN_PICTURE_NOT_UPLOADED;
?>
</td>
</tr>
<!-- ************************ CONFIGUARTOR *********************** -->
<tr><td align=center colspan=2>
<center>
<a href="JavaScript:ConfiguratorHideTable();">
<?php echo ADMIN_CONFIGURATOR;?>
<input type=hidden name='ConfiguratorHideTable_hidden'
value='<?php echo $showConfiguratorTable;?>'>
</a>
</center>
<script language='javascript'>
function ConfiguratorHideTable()
{
if ( ConfiguratorTable.style.display == 'none' )
{
ConfiguratorTable.style.display = 'block';
document.MainForm.ConfiguratorHideTable_hidden.value='1';
}
else
{
ConfiguratorTable.style.display = 'none';
document.MainForm.ConfiguratorHideTable_hidden.value='0';
}
}
</script>
<table id='ConfiguratorTable'>
<tr><td>
<script language='JavaScript'>
function SetOptionValueTypeRadioButton( id, radioButtonState )
{
if ( radioButtonState == "UN_DEFINED" )
document.all["option_radio_type_"+id][0].click();
else if ( radioButtonState == "ANY_VALUE" )
document.all["option_radio_type_"+id][1].click();
else if ( radioButtonState == "N_VALUES" )
document.all["option_radio_type_"+id][2].click();
}
function SetEnabledStateTextValueField( id, radioButtonState )
{
if ( radioButtonState == "UN_DEFINED" ||
radioButtonState == "N_VALUES" )
{
document.all["option_value_"+id].disabled=true;
document.all["option_value_"+id].value="";
}
else
document.all["option_value_"+id].disabled=false;
}
</script>
<?php
//product extra options
foreach($options as $option)
{
$option_row = $option["option_row"];
$value_row = $option["option_value"];
$ValueCount = $option["value_count"];
?>
<table border='0' cellspacing='0' cellpadding='4' width=100%>
<tr>
<td align=left width=25%>
<b><?php echo $option_row["name"]?></b>:
</td>
<td>
<input name='option_radio_type_<?php echo $option_row["optionID"]?>'
type='radio' value="UN_DEFINED"
onclick="JavaScript:SetEnabledStateTextValueField(<?php echo $option_row['optionID']?>, 'UN_DEFINED' );"
<?php
if ( (is_null($value_row["option_value"]) || $value_row["option_value"] == '')
&& $value_row["option_type"]==0 )
echo "checked";
?>
>
</td>
<td>
<?php echo ADMIN_NOT_DEFINED;?>
</td>
</tr>
<tr>
<td> </td>
<td valign='top'>
<input name='option_radio_type_<?php echo $option_row["optionID"]?>'
type='radio' value="ANY_VALUE"
onclick="JavaScript:SetEnabledStateTextValueField(<?php echo $option_row['optionID']?>, 'ANY_VALUE' );"
<?php
if ( $value_row["option_type"]==0 && strlen($value_row["option_value"]) > 0 )
echo"checked";
?>
>
</td>
<td>
<?php echo ADMIN_ANY_VALUE;?>:
<input type=text name='option_value_<?php echo $option_row["optionID"]?>'
value='<?php echo str_replace("\"",""",$value_row["option_value"])?>' >
</td>
</tr>
<tr>
<td colspan=3>
<hr width="100%" color=black></hr>
</td>
</tr>
</table>
<?php
}
?>
</td></tr>
</table>
<script language='JavaScript'>
<?php
if ( $showConfiguratorTable == 0 )
{
?>
ConfiguratorTable.style.display = 'none';
<?php
}
?>
</script>
<input type="submit" name="AddProductAndOpenConfigurator"
value="" width=5>
<input type="hidden" name="optionID" value="">
<script language='JavaScript'>
document.MainForm.AddProductAndOpenConfigurator.style.display = 'none';
function AddProductAndOpen_option_value_configurator(optionID)
{
document.MainForm.optionID.value = optionID;
document.MainForm.AddProductAndOpenConfigurator.click();
}
</script>
</td>
</tr>
<tr align=right><td> </td></tr>
<tr>
<td colspan=2 align=center>
</td>
</tr>
<?php
// }
?>
<?php
?>
<tr>
<td align=right><?php echo ADMIN_PRODUCT_DESC;?><br>(HTML):</td>
<td><textarea name="description" rows=15 cols=40><?php echo str_replace("<","<",$product["description"]); ?></textarea></td>
</tr>
<tr>
<td align=right><?php echo ADMIN_PRODUCT_BRIEF_DESC;?><br>(HTML):</td>
<td><textarea name="brief_description" rows=7 cols=40><?php echo str_replace("<","<",$product["brief_description"]); ?></textarea></td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_META_DESCRIPTION;?>
</td>
<td>
<textarea name='meta_description'
rows=4 cols=15><?php echo $product["meta_description"];?></textarea>
</td>
</tr>
<tr>
<td align=right>
<?php echo ADMIN_META_KEYWORDS;?>
</td>
<td>
<textarea name='meta_keywords'
rows=4 cols=15><?php echo $product["meta_keywords"];?></textarea>
</td>
</tr>
</table>
<?php if ($_GET["productID"]) { ?>
<hr size=1 width=90%>
<center>
<font><b><?php echo STRING_RELATED_ITEMS;?></b></font>
<?php
$q = db_query("SELECT count(*) FROM ".RELATED_PRODUCTS_TABLE." WHERE Owner='".$_GET["productID"]."'") or die (db_error());
$cnt = db_fetch_row($q);
if ($cnt[0] == 0) echo "<p><font>< ".STRING_EMPTY_CATEGORY." ></font></p>";
else {
$q = db_query("SELECT productID FROM ".RELATED_PRODUCTS_TABLE." WHERE Owner='".$_GET["productID"]."'") or die (db_error());
echo "<table>";
while ($r = db_fetch_row($q))
{
$p = db_query("SELECT productID, name FROM ".PRODUCTS_TABLE." WHERE productID=$r[0]") or die (db_error());
if ($r1 = db_fetch_row($p))
{
echo "<tr>";
echo "<td width=100%>$r1[1]</td>";
echo "</tr>";
}
}
echo "</table>";
}
?>
[ <a href="javascript:open_window('wishlist.php?owner=<?php echo $_GET["productID"]; ?>',400,600);"><?php echo EDIT_BUTTON; ?></a> ]
</center>
<hr size=1 width=90%>
<?php } ?>
<p><center>
<input type="submit" name="save_product" value="<?php echo SAVE_BUTTON;?>" width=5>
<input type="button" value="<?php echo CANCEL_BUTTON;?>" onClick="window.close();">
<?php if ($_GET["productID"]) echo "<input type=button value=\"".DELETE_BUTTON."\" onClick=\"confirmDelete('".QUESTION_DELETE_CONFIRMATION."','products.php?productID=".$_GET["productID"]."&delete=1');\">"; ?>
</center></p>
<input type=hidden name='save_product_without_closing' value='0'>
</form>
</center>
</body>
</html>kindly do help me....
many thanks in advance,