Files
le-matelot/client/plugins/prodprixmult/prodprixmult_admin.php
2020-01-27 08:56:08 +01:00

281 lines
10 KiB
PHP

<?php
include_once(realpath(dirname(__FILE__)) . "/../../../fonctions/authplugins.php");
autorisation("prodprixmult");
include_once(realpath(dirname(__FILE__)) . "/Prodprixmult.class.php");
//include_once("tinymce.php");
?>
<script language="javascript" type="text/javascript" src="../client/plugins/tinymce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
language : "en",
mode : "exact",
elements : "description",
theme : "advanced",
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,|,image,link,unlink,code,undo,redo",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
file_browser_callback : "fileBrowserCallBack",
content_css : "/template/style_editeur.css",
theme_advanced_resizing : true,
entity_encoding : "raw",
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
force_p_newlines : false,
forced_root_block : ''
});
</script>
<?php
if($_REQUEST['action'] == "ajoutmult"){
$caracdisp = new Caracdisp();
$query_caract = "select * from $caracdisp->table where caracteristique='" . $_REQUEST['caracteristique'] . "'";
$resul_caract = mysql_query($query_caract, $caracdisp->link);
$principal = new Variable();
$principal->charger("principal");
$refsimple = new Variable();
$refsimple->charger("refsimple");
$i = 0;
while($row = mysql_fetch_object($resul_caract)){
$produit = new Produit();
$produit->ref = $_REQUEST['ref'] . $row->id;
$produit->prix = $_REQUEST['prix'];
$produit->prix2 = $_REQUEST['prix2'];
$produit->tva = $_REQUEST['tva'];
$produit->ecotaxe = $_REQUEST['ecotaxe'];
$produit->garantie = $_REQUEST['garantie'];
if($_REQUEST['promo'] == "on") $produit->promo = 1; else $produit->promo = 0;
if($_REQUEST['reappro'] == "on") $produit->reappro = 1; else $produit->reappro = 0;
if($_REQUEST['nouveaute'] == "on") $produit->nouveaute = 1; else $produit->nouveaute = 0;
if($_REQUEST['ligne'] == "on") $produit->ligne = 1; else $produit->ligne = 0;
$produit->rubrique = $_REQUEST['rubrique'];
$produit->poids = $_REQUEST['poids'];
$produit->stock = $_REQUEST['stock'];
$lastid = $produit->add();
$produitdesc = new Produitdesc();
$produitdesc->produit = $lastid;
$produitdesc->lang = "1";
$produitdesc->titre = $_REQUEST['titre'];
$produitdesc->chapo = $_REQUEST['chapo'];
$produitdesc->description = $_REQUEST['description'];
$produitdesc->add();
$query_test = "select * from caracdisp where caracteristique='" . $principal->valeur . "' order by id";
$resul_test = mysql_query($query_test, $principal->link);
$valoui = mysql_result($resul_test, 0, "id");
$valnon = mysql_result($resul_test, 1, "id");
$caracval = new Caracval();
$caracval->produit = $lastid;
$caracval->caracteristique = $principal->valeur;
if(! $i)
$caracval->caracdisp = $valoui;
else
$caracval->caracdisp = $valnon;
$caracval->add();
$caracval = new Caracval();
$caracval->produit = $lastid;
$caracval->caracteristique = $refsimple->valeur;
$caracval->valeur = $_REQUEST['ref'];
$caracval->add();
$caracval = new Caracval();
$caracval->produit = $lastid;
$caracval->caracteristique = $caracteristique;
$caracval->caracdisp = $row->id;
$caracval->add();
$i++;
}
?>
<script type="text/javascript">
alert("Produits ajoutes");
location="parcourir.php?parent=<?php echo $_REQUEST['rubrique']; ?>";
</script>
<?php
}
?>
<div id="contenu_int">
<p class="titre_rubrique">Création de produits multiples déclinés</p>
<p align="right" class="geneva11Reg_3B4B5B">
<a href="accueil.php" class="lien04">Accueil </a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Création de produits multiples déclinés</a>
</p>
<table width="710" border="0" cellpadding="5" cellspacing="0">
<tr>
<td width="600" height="30" class="titre_cellule_tres_sombre">Fiche produit</td>
</tr>
</table>
<form action="module.php" id="formulaire" method="post">
<input type="hidden" name="nom" value="prodprixmult" />
<input type="hidden" name="action" value="ajoutmult" />
<table width="710" border="0" cellpadding="5" cellspacing="0">
<tr>
<td height="30" class="titre_cellule">Caractéristique à décliner:</td>
<td class="cellule_sombre">
<select name="caracteristique">
<?php
$principal = new Variable();
$principal->charger("principal");
$refsimple = new Variable();
$refsimple->charger("refsimple");
$caracteristique = new Caracteristique();
$query_caract = "select * from $caracteristique->table where id not in(" . $principal->valeur . "," . $refsimple->valeur . ")";
$resul_caract = mysql_query($query_caract, $caracteristique->link);
while($row = mysql_fetch_object($resul_caract)){
$caracteristiquedesc = new Caracteristiquedesc();
$caracteristiquedesc->charger($row->id);
?>
<option value="<?php echo $caracteristiquedesc->caracteristique; ?>"><?php echo $caracteristiquedesc->titre; ?></option>
<?php
}
?>
<?php ?>
</select>
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">REFERENCE DE BASE:</td>
<td class="cellule_sombre">
<input type="text" name="ref" id="ref_c" class="form" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">TITRE DU PRODUIT </td>
<td class="cellule_claire"><input name="titre" type="text" class="form" value="" /> </td>
</tr>
<tr>
<td height="30" class="titre_cellule">CHAPO (resumé de la description)</td>
<td class="cellule_sombre">
<textarea name="chapo" cols="40" rows="2" class="form"></textarea>
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">DESCRIPTION DU PRODUIT</td>
<td class="cellule_claire">
<textarea name="description" rows="18" cols="50" style="width: 100%"></textarea>
</td>
</tr>
</table>
<table width="710" border="0" cellpadding="5" cellspacing="0">
<tr>
<td height="30" colspan="2" class="titre_cellule_tres_sombre">Caractéristiques du produit </td>
</tr>
<tr>
</table>
<table width="710" border="0" cellpadding="5" cellspacing="0">
<td width="250" height="30" class="titre_cellule">PRIX</td>
<td width="440" class="cellule_sombre">
<input name="prix" type="text" class="form" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">PRIX PROMOTIONNE </td>
<td class="cellule_claire">
<input name="prix2" type="text" class="form" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">TVA </td>
<td class="cellule_claire">
<input name="tva" type="text" class="form" value="19.6" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">Eco-taxe </td>
<td class="cellule_claire">
<input name="ecotaxe" type="text" class="form" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">NOUVEAUTE</td>
<td class="cellule_sombre">
<input name="nouveaute" type="checkbox" class="form" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">GARANTIE</td>
<td class="cellule_claire">
<input name="garantie" type="text" class="form" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">EN PROMO </td>
<td class="cellule_sombre">
<input name="promo" type="checkbox" class="form" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">EN REAPROVISIONNEMENT </td>
<td class="cellule_claire">
<input name="reappro" type="checkbox" class="form" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">EN LIGNE </td>
<td class="cellule_sombre">
<input name="ligne" type="checkbox" class="form" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">APPARTENANCE (rubrique p&egrave;re) </td>
<td class="cellule_sombre">
<select name="rubrique" class="form">
<option value="">&nbsp;</option>
<?php
echo arbreOption(0, 1, 0);
?>
</select>
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">POIDS</td>
<td class="cellule_sombre">
<input type="text" name="poids" value="" />
</td>
</tr>
<tr>
<td height="30" class="titre_cellule">STOCK </td>
<td class="cellule_sombre">
<input type="text" name="stock" value="" />
</td>
</tr>
</table>
<table width="710" border="0" cellpadding="5" cellspacing="0">
<tr><input type="submit" id="boutoncache" style="display: none"/>
<td height="30" class="cellule_sombre2"><span class="sous_titre_rubrique"><span class="geneva11Reg_3B4B5B"><a href="#" onClick="document.getElementById('formulaire').submit();" class="txt_vert_11">Valider les modifications </a></span> <a href="#" onClick="document.getElementById('formulaire').submit();"><img src="gfx/suivant.gif" width="12" height="9" border="0" /></a></span></td>
</tr>
</table>
</form>
</div>