373 lines
9.9 KiB
PHP
Executable File
373 lines
9.9 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
$idprod=$HTTP_GET_VARS["idprod"];
|
|
if (!$idprod) $idprod=$HTTP_POST_VARS["idprod"];
|
|
$idfamille=$HTTP_GET_VARS["idfamille"];
|
|
$idcateg=$HTTP_GET_VARS["idcateg"];
|
|
if (!$idfamille) $idfamille=$HTTP_POST_VARS["idfamille"];
|
|
if (!$idcateg) $idcateg=$HTTP_POST_VARS["idcateg"];
|
|
$qtecmde=$HTTP_POST_VARS["qtecmde"];
|
|
$produit=$HTTP_POST_VARS["produit"];
|
|
$_SESSION["edu"]=$HTTP_POST_VARS["edu"];
|
|
echo "edu:".$_SESSION["edu"]."<BR>";
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<title>
|
|
Produit
|
|
</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
|
|
<!--
|
|
a:link {
|
|
color: #FFFFFF;
|
|
text-decoration: none;
|
|
}
|
|
a:visited {
|
|
color: #FFFFFF;
|
|
text-decoration: none;
|
|
}
|
|
a:hover {
|
|
color: #FFFFFF;
|
|
text-decoration: underline;
|
|
}
|
|
a:active {
|
|
color: #FFFFFF;
|
|
text-decoration: none;
|
|
}
|
|
.style1 {
|
|
font-size: small;
|
|
font-style: italic;
|
|
font-color: white;
|
|
}
|
|
.style2 {
|
|
font-size: xx-small
|
|
font-color: white;
|
|
}
|
|
.style3 {
|
|
font-size: small
|
|
font-color: white;
|
|
}
|
|
.style4 {
|
|
font-size: large;
|
|
font-weight: bold;
|
|
font-color: white;
|
|
}
|
|
.style6 {font-size: xx-small; font-style: italic; font-color: white; }
|
|
-->
|
|
</style>
|
|
<script language="JavaScript" type="text/JavaScript">
|
|
<!--
|
|
function MM_openBrWindow(theURL,winName,features) { //v2.0
|
|
window.open(theURL,winName,features);
|
|
}
|
|
//-->
|
|
</script>
|
|
<link href="../style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body class="bgcolor" text="white">
|
|
<?php
|
|
|
|
//si ajout de produit dans le panier -> création variable qtecmde
|
|
if($qtecmde)
|
|
{
|
|
if (!isset($_SESSION["compt"]))
|
|
{
|
|
|
|
// Si pas deja article creation
|
|
|
|
$compt=0;
|
|
$_SESSION["compt"];
|
|
session_register("compt");
|
|
$prod[$compt]=$idprod;
|
|
$qtecmd[$compt]=$qtecmde;
|
|
session_register('prod');
|
|
session_register('qtecmd');
|
|
}
|
|
else
|
|
{
|
|
|
|
// ajout article
|
|
|
|
$compt++;
|
|
print "is set<br>";
|
|
print "compt = $compt<br>";
|
|
$j=0;
|
|
while ($j<$compt)
|
|
{
|
|
echo "boucle<BR>";
|
|
if ($idprod==$prod[$j])
|
|
{
|
|
$qtecmd[$j]+=$qtecmde;
|
|
$compt--;
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
$prod[$compt]=$idprod;
|
|
$qtecmd[$compt]=$qtecmde;
|
|
}
|
|
$j++;
|
|
}
|
|
}
|
|
}
|
|
|
|
// if (isset($_SESSION["compt"])) print "<br>$compt<br>";
|
|
|
|
require ("../connexion.php");
|
|
$conn = mysql_connect($host, $user, $password);
|
|
mysql_select_db($bdd) or die("Impossible d'ouvrir la base de donnee $bdd");
|
|
?>
|
|
<?php
|
|
$requete = "select idprod,denomination,description,location,delailivraison,prixht1,pathpdfdocument,pathphotobassedef,qteprod1,poidsprod1,qteprod2,prixht2,poidsprod2,qteprod3,prixht3,poidsprod3,coef,idfamille,refconst from produit where idprod='$idprod'";
|
|
$result=mysql_query($requete) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
while ($ligne=mysql_fetch_row($result))
|
|
{
|
|
$nom=$ligne[1];
|
|
$desc=$ligne[2];
|
|
$loc=$ligne[3];
|
|
$delai=$ligne[4];
|
|
$pathpdf=$ligne[6];
|
|
$photo=$ligne[7];
|
|
$coef=$ligne[16];
|
|
$idfamille=$ligne[17];
|
|
$refconst=$ligne[18];
|
|
}
|
|
|
|
$requete1 = "select nomfamille,idfamille,idcateg from famille where idfamille='$idfamille'";
|
|
$result1=mysql_query($requete1) or die ("Erreur SQL :$requete1<br>".mysql_error()."...");
|
|
|
|
while ($ligne1=mysql_fetch_row($result1))
|
|
{
|
|
$famille=$ligne1[0];
|
|
$idfamille=$ligne1[1];
|
|
$idcateg=$ligne1[2];
|
|
}
|
|
|
|
$requete2 = "select nomcateg from categorie where idcateg='$idcateg'";
|
|
$result2=mysql_query($requete2) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
|
|
|
|
while ($ligne2=mysql_fetch_row($result2))
|
|
{
|
|
$categ=$ligne2[0];
|
|
}
|
|
?>
|
|
<p><a href="index.php">
|
|
Accueil produits
|
|
</a>
|
|
|
|
<br>
|
|
        <a href="famille.php?idcateg=<?php print $idcateg?>">
|
|
<?php print $categ?>
|
|
</a>
|
|
<br>
|
|
       
|
|
        <a href="produit.php?idfamille=<?php print $idfamille?>&idcateg=<?php print $idcateg?>">
|
|
<?php print $famille?>
|
|
</a>
|
|
<br>
|
|
</p>
|
|
<p><br>
|
|
<br>
|
|
<?php
|
|
// Modification du prix en fct du client prix = prix x (1 - coef du prod x(valeur de points / 100))
|
|
|
|
$req = "select vp from client where idcli='$idcli'";
|
|
$res = mysql_query($req) or die ("Erreur sql:$req<br>".mysql_error()."...");
|
|
|
|
while ($ligneres=mysql_fetch_row($res))
|
|
{
|
|
$vp=$ligneres[0];
|
|
}
|
|
|
|
|
|
|
|
if (isset($_SESSION["$compt"]))
|
|
{
|
|
$k=0;
|
|
do
|
|
{
|
|
//print "prod[$k]:$prod[$k]<br>";
|
|
//print "qtecmd[$k]:$qtecmd[$k]<br>";
|
|
session_register('prod');
|
|
session_register('qtecmd');
|
|
$k++;
|
|
}
|
|
while ($k <= $compt);
|
|
}
|
|
|
|
|
|
// requete de récupéaration des prix du produit + incrémentation d'un compteur pour savoir le nombre de prix
|
|
$requete2 = "select idprix,prix,marge,qteprod from prix where idprod='$idprod'";
|
|
$result2=mysql_query($requete2) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
|
|
//nb prix du produit
|
|
$i=0;
|
|
|
|
while ($ligne1 = mysql_fetch_row($result2))
|
|
{
|
|
$idprix[$i]=$ligne1[0];
|
|
$testprix[$i]=$ligne1[1];
|
|
$marge[$i]=$ligne1[2];
|
|
$qteprod[$i]=$ligne1[3];
|
|
|
|
|
|
//ici on teste marge : si le champs est renseigné alors le prix est une URL
|
|
if ($marge[$i])
|
|
{
|
|
$testprix[$i]="http://crossover.codeweavers.com/vendor_price_query.php?user=tallagrand@airtria.fr;sku=".$testprix[$i];
|
|
//$testprix[$i]="http://crossover.codeweavers.com/vendor_price_query.php?user=lorette.pedano@sanofi-synthelabo.com;sku=".$testprix[$i];
|
|
//$testprix[$i]="http://crossover.codeweavers.com/vendor_price_query.php?user=e.bettler@ibcp.fr;sku=".$testprix[$i];
|
|
//$testprix[$i]="http://crossover.codeweavers.com/vendor_price_query.php?user=gb@isis.u-strasbg.fr;sku=".$testprix[$i];
|
|
// $testprix[$i]="http://crossover.codeweavers.com/vendor_price_query.php?user=duclert@infobiogen.fr;sku=".$testprix[$i];
|
|
$hwnd=fopen($testprix[$i],"r");
|
|
$prix[$i] = fread($hwnd, 100);
|
|
fclose($hwnd);
|
|
$prix[$i] = ($prix[$i] + ($prix[$i] * $marge[$i] / 100));
|
|
$prix[$i]= $prix[$i] * (1 - $coef * ($vp / 100));
|
|
} else {
|
|
$prix[$i] = $testprix[$i];
|
|
$prix[$i]= $prix[$i] * (1 - $coef * ($vp / 100));
|
|
}
|
|
$i++;
|
|
}
|
|
$i--;
|
|
$nbprix=$i;
|
|
?>
|
|
<?php
|
|
if (isset($_SESSION["compt"])||!$qtecmde==NULL)
|
|
{
|
|
?>
|
|
<p align="center"><a href="panier.php?page=detailprod.php&idfamille=<?php print $idfamille?>&idcateg=<?php print $idcateg?>"><br>
|
|
Votre Panier<br>
|
|
</a> <br>
|
|
<?php
|
|
}
|
|
?>
|
|
</p>
|
|
<table border="0" align="center">
|
|
<tr>
|
|
<td><a href="#" onClick="MM_openBrWindow('zoomprod.php?idprod=<?php print $idprod?>&idcateg=<?php print $idcateg?>&idfamille=<?php print $idfamille?>','Zoom','width=270,height=350')"><img src="../images/<?php print $photo?>" alt="zoom" width=75 height=75 border="0"/></a></td>
|
|
<td><span class="style4"><?php print $nom?><br>
|
|
</span></td>
|
|
<td><?php print $refconst?></td>
|
|
<td><?php
|
|
if ($pathpdf)
|
|
{
|
|
?>
|
|
<a href="<?php print $pathpdf?>"><img src="../images/pdf.gif" border=0/></a>
|
|
<?php
|
|
}
|
|
?>
|
|
<br></td>
|
|
</tr>
|
|
<tr>
|
|
<td> </td>
|
|
<td><p class="style1"> </p>
|
|
<p class="style1"><?php print $desc?></p>
|
|
<p class="style1"> </p></td>
|
|
<td> </td>
|
|
<td><span class="style6">
|
|
<?php
|
|
if ($loc)
|
|
{
|
|
if($loc!=no)
|
|
{
|
|
?>
|
|
<a href="louerprod.php?idprod=<?php print $idprod?>&idcateg=<?php print $idcateg?>&idfamille=<?php print $idfamille?>"><br>
|
|
<br>
|
|
</a><a href="#" onClick="MM_openBrWindow('louerprod.php?idprod=<?php print $idprod?>&idcateg=<?php print $idcateg?>&idfamille=<?php print $idfamille?>','','width=450,height=200')">Produit disponible<br>
|
|
a la location</a>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<br>
|
|
</span></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="4"><table border=0 align="center">
|
|
<tr align="center" >
|
|
<td colspan=3 align="left"> <span class="style2"><b>
|
|
<?php
|
|
// Affichage des prix
|
|
for ($j=0;$j<=$nbprix;$j++)
|
|
{
|
|
?>
|
|
Prix pour <?php print $qteprod[$j]?> produit : <?php print round($prix[$j],2);?> € ht<br>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
</table></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="4"><table align="left">
|
|
<form name="f1<?php print $i?>" action="detailprod.php" method="post">
|
|
<tr align=center>
|
|
<td><p align="center"> </p></td>
|
|
</tr>
|
|
<tr align=center>
|
|
<td>
|
|
<div align="center"><span class="style3"><b> Ajouter au panier</b></span> <br>
|
|
</div></td>
|
|
</tr>
|
|
<tr align=center>
|
|
<td>
|
|
<div align="center">
|
|
<input type="hidden" name="idprod" value="<?php print "$idprod";?>"/>
|
|
<input type="hidden" name="idfamille" value="<?php print $idfamille?>"/>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg?>"/>
|
|
Qte :
|
|
<input type="text" name="qtecmde" size="3"/>
|
|
<input type="submit" name="submit" value="Go"/>
|
|
    </div>
|
|
<h6 align="center"> </h6>
|
|
<div align="center">    </div></td>
|
|
<td>
|
|
education:<input type="checkbox" name="edu" />
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
|
|
</form>
|
|
</table></td>
|
|
</tr>
|
|
</table>
|
|
<div align=center>
|
|
|
|
<?php
|
|
if (isset($_SESSION["compt"])||!$qtecmde==NULL)
|
|
{
|
|
?>
|
|
<p align="center"><a href="panier.php?page=detailprod.php&idfamille=<?php print $idfamille?>&idcateg=<?php print $idcateg?>"><br>
|
|
Votre Panier<br>
|
|
</a> <br>
|
|
<?php
|
|
}
|
|
?>
|
|
<br>
|
|
<?php
|
|
if ($marq!=""||$rech!="")
|
|
{
|
|
?>
|
|
<a href="recherche.php?marq=<?php print $marq?>&rech=<?php print $rech?>">Retour a la liste</a>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<a href="produit.php?idfamille=<?php print $idfamille?>&idcateg=<?php print $idcateg?>">Retour</a>
|
|
<?php
|
|
}
|
|
?>
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|