Location: PHPKode > projects > Multi-lingual E-Commerce System > admin/inc/admin_Product.inc
<?php
require_once($include_path.'/classes/Product.class');
require_once($include_path.'/classes/Language.class');
require_once($include_path.'/classes/Category.class');
require_once($include_path.'/classes/Currency.class');

if (!isset($_GET['Product']))
{
	$array = array() ;
	$obj = new Product();
	$array = $obj->retrieveAll();
	foreach ($array as $member) {
		$obj = new Product();
		$obj->Product_ID = $member;
		$obj->retrieve();
		list ($name,$desc) = $obj->getDescription('EN');
		echo "<p>$name";
		echo "<a href=\"product.php?Product=$member\"> edit</a> <a href=\"product_image.php?Product=$member\"> upload image</a></p>";
	}
	$obj = new Product();
}

else
{
	$obj = new Product();
	$obj->Product_ID = $_GET['Product'];
	$obj->retrieve();
}
?>
<form method="post" action="index.php">
<input type="hidden" name="Product" value="<? echo $_GET['Product'] ?>"><br>
<table>
<tr><td colspan="2"><b>Description</b></td></tr>
<?
	$language = new Language();
	$languages = array();
	$languages = $language->retrieveAll();

	foreach ($languages as $language_code) {
	if ($obj->Product_ID != '') {
		list ($name,$desc) = $obj->getDescription($language_code);
	}
	else {
		$name = ''; 
		$desc = '';
	}
	echo "<tr><td colspan='2' align='left'>".$language_code ."</td></tr>\n";
?>
<tr><td>Name</td><td><input size="22" type="text" name="Name_<? echo $language_code ?>" value="<? echo $name ?>"></td></tr>	
<tr><td>Description</td><td><textarea rows="8" cols="22" name="Desc_<? echo $language_code ?>"><? echo $desc ?></textarea></td></tr>	
<?
	} # end foreach
?>
<tr><td></td><td></td></tr>
<tr><td colspan="2"><b>Details</b></td></tr>

<tr><td>Product Icon</td><td><input type="text" name="Product_Icon" value="<? echo $obj->Product_Icon; ?>"></td></tr>
<tr><td>Product Image</td><td><input type="text" name="Product_Image" value="<? echo $obj->Product_Image; ?>"></td></tr>
<tr><td>Product Weight</td><td><input type="text" name="Product_Weight" value="<? echo $obj->Product_Weight; ?>"></td></tr>
<tr><td>Product Code</td><td><input type="text" name="Product_Code" value="<? echo $obj->Product_Code; ?>"></td></tr>
<tr><td>Tick to delete</td><td><input type="checkbox" name="delete"></td></tr>

<tr><td></td><td></td></tr>
<tr><td colspan="2"><b>Categories</b></td></tr>
<?
$category = new Category;
$array = $category->retrieveAll();
 foreach ($array as $member) {
                $category = new Category();
                $category->Category_ID = $member;
                $category->retrieve();
                $name = $category->getDescription('EN');
                echo "<tr><td>$name</td>";
                echo "<td><input type=\"checkbox\" name=\"Cate_";
		echo $member."\" ";
		if ($obj->Product_ID != '' && $obj->checkProductCategory($category->Category_ID)==1) { echo 'checked';}
		echo "></td></tr>\n";
        }


?>
<tr><td></td><td></td></tr>
<tr><td colspan="2"><b>Price</b></td></tr>
<?
$currency = new Currency;
$array = $currency->retrieveAll();
foreach ($array as $member) {
                $currency = new Currency();
                $currency->Currency_Code = $member;
		if ($obj->Product_ID != '') {
			$price = $obj->getPrice($member);
                	list ($name,$code) = $currency->getDescription('EN');
		}
		else {
			$price = ''; 
			$name = ''; 
			$code = '';
		}
                echo "<tr><td>$member $code</td>";
                echo "<td><input type=\"text\" size=\"6\" name=\"Pric_";
		echo $member."\" ";
		echo "value=\"$price\"";
		echo "></td></tr>\n";
        }
?>

</table>


<input type="submit" value="update">
</form>
Return current item: Multi-lingual E-Commerce System