/**
  * 
  * todo : utiliser cette methode pour la gestion des contenus associés aux produit // actuellement uniquement pour rubrique
  */
 public function add($contentToAddId, $type, $object)
 {
     if ($type == 1) {
         $objectInstance = new Produit();
         $objectInstance->charger($object);
     } else {
         $objectInstance = new Rubrique();
         $objectInstance->charger($object);
     }
     $contentToAdd = new Contenu();
     $this->id = '';
     if (!$this->existe($object, $type, $contentToAddId) && $contentToAdd->charger($contentToAddId)) {
         $classement = $this->getMaxRanking($objectInstance->id, $type) + 1;
         $this->objet = $objectInstance->id;
         $this->type = $type;
         $this->contenu = $contentToAdd->id;
         $this->classement = $classement;
         parent::add();
         if ($this->type == 1) {
             ActionsModules::instance()->appel_module("modprod", $objectInstance);
         } else {
             ActionsModules::instance()->appel_module("modrub", $objectInstance);
         }
     }
 }
예제 #2
0
function ancien_rewrite_prod($ref, $lang = 1)
{
    $prod = new Produit();
    $prod->charger($ref);
    $proddesc = new Produitdesc();
    if (!$proddesc->charger($prod->id, $lang)) {
        return "";
    }
    $rubfinal = $prod->rubrique;
    if (function_exists('chemin_rub')) {
        $chem = chemin_rub($rubfinal);
    } else {
        $chem = chemin($rubfinal);
    }
    // 1.4.2.1 et avant
    if (!empty($chem)) {
        $rubriquedesc = new Rubriquedesc();
        $listrub = "";
        $rubriquedesc->charger($chem[count($chem) - 1]->rubrique, $lang);
        $listrub .= $rubriquedesc->titre . "_";
        $rubriquedesc->charger($chem[0]->rubrique, $lang);
        $listrub .= $rubriquedesc->rubrique . "_";
        for ($i = count($chem) - 2; $i >= 0; $i--) {
            $rubriquedesc->charger($chem[$i]->rubrique, $lang);
            $listrub .= $rubriquedesc->titre . "_";
        }
        $listrub .= $proddesc->titre . "__" . $prod->ref . ".html";
        return eregurl($listrub);
    } else {
        return "";
    }
}
예제 #3
0
function substitproduits($texte)
{
    global $ref, $reforig, $motcle, $id_produit, $classement, $prixmin, $prixmax, $nouveaute, $promo, $stockmini;
    $tproduit = new Produit();
    $tproduitdesc = new Produitdesc();
    $url = "";
    if ($ref) {
        $tproduit->charger($ref);
    } else {
        if ($id_produit) {
            $tproduit->charger_id($id_produit);
        }
    }
    if ($ref || $id_produit) {
        $tproduitdesc->charger($tproduit->id);
        $url = $tproduitdesc->getUrl();
    }
    $texte = str_replace("#PRODUIT_URL", $url, $texte);
    $texte = str_replace("#PRODUIT_ID", $tproduit->id, $texte);
    $texte = str_replace("#PRODUIT_NOM", $tproduitdesc->titre, $texte);
    $texte = str_replace("#PRODUIT_CHAPO", $tproduitdesc->chapo, $texte);
    $texte = str_replace("#PRODUIT_DESCRIPTION", $tproduitdesc->description, $texte);
    $texte = str_replace("#PRODUIT_POSTSCRIPTUM", $tproduitdesc->postscriptum, $texte);
    $texte = str_replace("#PRODUIT_RUBRIQUE", $tproduit->rubrique, $texte);
    $texte = str_replace("#PRODUIT_CLASSEMENT", "{$classement}", $texte);
    $texte = str_replace("#PRODUIT_STOCKMINI", "{$stockmini}", $texte);
    $texte = str_replace("#PRODUIT_PRIXMIN", "{$prixmin}", $texte);
    $texte = str_replace("#PRODUIT_PRIXMAX", "{$prixmax}", $texte);
    $texte = str_replace("#PRODUIT_NOUVEAUTE", "{$nouveaute}", $texte);
    $texte = str_replace("#PRODUIT_PROMO", "{$promo}", $texte);
    $texte = str_replace("#PRODUIT_MOTCLE", $motcle, $texte);
    $texte = str_replace("#PRODUIT_REFORIG", "{$reforig}", $texte);
    $texte = str_replace("#PRODUIT_REF", $tproduit->ref, $texte);
    return $texte;
}
예제 #4
0
function contenuassoc_ajouter($request)
{
    if ($request->query->get('type') == 1) {
        $objet = new Produit();
        $objet->charger($request->query->get('objet'));
    } else {
        $objet = new Rubrique();
        $objet->charger($request->query->get('objet'));
    }
    $contenuassoc = new Contenuassoc();
    $query = "select max(classement) as maxClassement from {$contenuassoc->table} where objet=\"" . $objet->id . "\" and type=\"" . $request->query->get('type') . "\"";
    $resul = $contenuassoc->query($query);
    $classement = $contenuassoc->get_result($resul, 0, "maxClassement") + 1;
    $contenuassoc = new Contenuassoc();
    $contenuassoc->objet = $objet->id;
    $contenuassoc->type = $request->query->get('type');
    $contenuassoc->contenu = $request->query->get('id');
    $contenuassoc->classement = $classement;
    $contenuassoc->add();
    lister_contenuassoc($request->query->get('type'), $request->query->get('objet'));
    if ($contenuassoc->type == 1) {
        ActionsModules::instance()->appel_module("modprod", $objet);
    } else {
        ActionsModules::instance()->appel_module("modrub", $objet);
    }
}
예제 #5
0
function accessoire_supprimer()
{
    $accessoire = new Accessoire();
    $accessoire->charger($_GET['id']);
    $produit = new Produit();
    $produit->charger($accessoire->produit);
    $accessoire->delete();
    lister_accessoires($_GET['ref']);
    ActionsModules::instance()->appel_module("modprod", $produit);
}
예제 #6
0
function accessoire_ajouter()
{
    $produit = new Produit();
    $produit->charger($_GET['ref']);
    $accessoire = new Accessoire();
    $accessoire = new Accessoire();
    $accessoire->produit = $produit->id;
    $accessoire->accessoire = $_GET['id'];
    $accessoire->add();
    lister_accessoires($_GET['ref']);
}
예제 #7
0
function lister_contenuassoc($type, $objet)
{
    if ($type == 1) {
        $obj = new Produit();
        $obj->charger($objet);
    } else {
        $obj = new Rubrique();
        $obj->charger($objet);
    }
    $contenuassoc = new Contenuassoc();
    $contenua = new Contenu();
    $contenuadesc = new Contenudesc();
    $query = "select * from {$contenuassoc->table} where type='{$type}' and objet='{$obj->id}' order by classement";
    $resul = $contenuassoc->query($query);
    $i = 0;
    while ($resul && ($row = $contenuassoc->fetch_object($resul))) {
        $fond = $i++ % 2 ? "fonce" : "claire";
        $contenua->charger($row->contenu);
        $contenuadesc->charger($contenua->id);
        $dossierdesc = new Dossierdesc();
        $dossierdesc->charger($contenua->dossier);
        ?>
		<li class="<?php 
        echo $fond;
        ?>
">
				<div class="cellule" style="width:260px;"><?php 
        echo $dossierdesc->titre;
        ?>
</div>
				<div class="cellule" style="width:260px;"><?php 
        echo $contenuadesc->titre;
        ?>
</div>
				<div class="cellule_supp"><a href="javascript:contenuassoc_supprimer(<?php 
        echo $row->id;
        ?>
, <?php 
        echo $type;
        ?>
,'<?php 
        echo $objet;
        ?>
')"><img src="gfx/supprimer.gif" /></a></div>
		</li>
<?php 
    }
}
예제 #8
0
function ajouter($ref, $quantite = 1, $append = 0, $nouveau = 0, $parent = -1)
{
    $testprod = new Produit();
    if (!$testprod->charger($ref)) {
        return 0;
    }
    if (intval($quantite <= 0)) {
        $quantite = 1;
    }
    $perso = array();
    // vérification si un produit avec la même déclinaison est déjà  présent
    foreach ($_REQUEST as $key => $valeur) {
        if (strstr($key, "declinaison")) {
            $ps = new Perso();
            $ps->declinaison = substr($key, 11);
            $ps->valeur = stripslashes($valeur);
            $perso[] = $ps;
        }
    }
    $indicePanier = $_SESSION['navig']->panier->ajouter($ref, $quantite, $perso, $append, $nouveau, $parent);
}
예제 #9
0
function lister_accessoires($refproduit)
{
    $produit = new Produit();
    $produit->charger($_GET['ref']);
    $accessoire = new Accessoire();
    $produita = new Produit();
    $produitdesca = new Produitdesc();
    $query = "select * from {$accessoire->table} where produit='{$produit->id}' order by classement";
    $resul = $accessoire->query($query);
    $i = 0;
    while ($resul && ($row = $accessoire->fetch_object($resul))) {
        $produita->charger_id($row->accessoire);
        $produitdesca->charger($produita->id);
        $rubadesc = new Rubriquedesc();
        $rubadesc->charger($produita->rubrique);
        $fond = $i++ % 2 ? "fonce" : "claire";
        ?>

			        	 <li class="<?php 
        echo $fond;
        ?>
">
							<div class="cellule" style="width:260px;"><?php 
        echo $rubadesc->titre;
        ?>
</div>
							<div class="cellule" style="width:260px;"><?php 
        echo $produitdesca->titre;
        ?>
</div>
							<div class="cellule_supp"><a href="javascript:accessoire_supprimer(<?php 
        echo $row->id;
        ?>
)"><img src="gfx/supprimer.gif" /></a></div>
						</li>

		<?php 
    }
}
예제 #10
0
function contenuassoc_ajouter()
{
    if ($_GET['type'] == 1) {
        $objet = new Produit();
        $objet->charger($_GET['objet']);
    } else {
        $objet = new Rubrique();
        $objet->charger($_GET['objet']);
    }
    $contenuassoc = new Contenuassoc();
    $contenuassoc = new Contenuassoc();
    $contenuassoc->objet = $objet->id;
    $contenuassoc->type = $_GET['type'];
    $contenuassoc->contenu = $_GET['id'];
    $contenuassoc->add();
    lister_contenuassoc($_GET['type'], $_GET['objet']);
    if ($contenuassoc->type == 1) {
        ActionsModules::instance()->appel_module("modprod", $objet);
    } else {
        ActionsModules::instance()->appel_module("modrub", $objet);
    }
}
예제 #11
0
 function verfistock($refproduit, $quantite, $perso)
 {
     $stockok = true;
     if (Variable::lire("verifstock", 0) == 1) {
         $prod = new Produit();
         if ($prod->charger($refproduit)) {
             if ($prod->stock >= $quantite) {
                 foreach ($perso as $decli) {
                     $stock = new Stock();
                     if ($stock->charger($decli->valeur, $prod->id) && $stock->valeur < $quantite) {
                         $stockok = false;
                         break;
                     }
                 }
             } else {
                 $stockok = false;
             }
         } else {
             $stockok = false;
         }
     }
     $parametres = array("refproduit" => $refproduit, "quantite" => $quantite, "perso" => $perso);
     ActionsModules::instance()->appel_module("apresverifstock", $stockok, $parametres);
     return $stockok;
 }
예제 #12
0
 $adr->tel = $client->telfixe . "  " . $client->telport;
 $adr->pays = $client->pays;
 $adrcli = $adr->add();
 $commande->adrfact = $adrcli;
 $commande->adrlivr = $adrcli;
 $commande->facture = 0;
 $commande->lang = ActionsLang::instance()->get_id_langue_courante();
 $devise = ActionsDevises::instance()->get_devise_courante();
 $commande->devise = $devise->id;
 $commande->taux = $devise->taux;
 $idcmd = $commande->add();
 $commande->charger($idcmd);
 for ($i = 0; $i < $nbart; $i++) {
     $produit = new Produit();
     $venteprod = new Venteprod();
     if ($produit->charger($sessionventeprod[$i]->ref)) {
         $produit->stock -= $sessionventeprod[$i]->quantite;
         $poids += $produit->poids;
         $produit->maj();
     }
     $venteprod->ref = $sessionventeprod[$i]->ref;
     $venteprod->titre = $sessionventeprod[$i]->titre;
     $venteprod->quantite = $sessionventeprod[$i]->quantite;
     $venteprod->tva = $sessionventeprod[$i]->tva;
     $venteprod->prixu = $sessionventeprod[$i]->prixu;
     $venteprod->commande = $idcmd;
     $venteprod->add();
     $total += $venteprod->prixu * $venteprod->quantite;
 }
 $commande->remise = 0;
 if ($client->pourcentage > 0) {
예제 #13
0
function boucleQuantite($texte, $args)
{
    // récupération des arguments
    $res = "";
    $article = lireTag($args, "article", "int");
    $ref = lireTag($args, "ref", "string");
    $max = lireTag($args, "max", "int");
    $min = lireTag($args, "min", "int");
    $force = lireTag($args, "force", "int");
    $valeur = lireTag($args, "valeur", "int");
    $prodtemp = new Produit();
    if ($article != "") {
        $stockprod = 0;
        $prodtemp->charger($_SESSION['navig']->panier->tabarticle[$article]->produit->ref);
        $stockprod = $prodtemp->stock;
        for ($i = 0; $i < count($_SESSION['navig']->panier->tabarticle[$article]->perso); $i++) {
            $stock = new Stock();
            $stock->charger($_SESSION['navig']->panier->tabarticle[$article]->perso[$i]->valeur, $_SESSION['navig']->panier->tabarticle[$article]->produit->id);
            if ($stock->valeur < $stockprod) {
                $stockprod = $stock->valeur;
            }
        }
        if ($max != "" && $max > $stockprod) {
            $max = $stockprod;
        }
    } else {
        if ($ref != "") {
            $prodtemp->charger($ref);
        }
    }
    if ($min == "") {
        $min = 1;
    }
    if ($max == "") {
        $max = $stockprod;
    }
    if ($max == "" && $force == "") {
        return;
    }
    if ($stockprod != "" && $min > $stockprod && $force == "") {
        return;
    }
    $j = 0;
    if ($force != "" && $valeur != "") {
        $min = 1;
        $max = $valeur;
    }
    for ($i = $min; $i <= $max; $i++) {
        if ($i == $_SESSION['navig']->panier->tabarticle[$article]->quantite) {
            $selected = "selected=\"selected\"";
        } else {
            $selected = "";
        }
        $temp = str_replace("#NUM", "{$i}", $texte);
        $temp = str_replace("#SELECTED", $selected, $temp);
        $temp = str_replace("#REF", $ref, $temp);
        $res .= "{$temp}";
    }
    return $res;
}
예제 #14
0
/*      This program is distributed in the hope that it will be useful,              */
/*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
/*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
/*      GNU General Public License for more details.                                 */
/*                                                                                   */
/*      You should have received a copy of the GNU General Public License            */
/*      along with this program.  If not, see <http://www.gnu.org/licenses/>.        */
/*                                                                                   */
/*************************************************************************************/
require_once "pre.php";
require_once "auth.php";
if (!est_autorise("acces_commandes")) {
    exit;
}
$produit = new Produit();
if ($produit->charger($ref)) {
    $produitdesc = new Produitdesc();
    $produitdesc->charger($produit->id);
    $_SESSION["commande"]->nbart++;
    $nbart = $_SESSION["commande"]->nbart;
    $_SESSION["commande"]->venteprod[$nbart - 1] = new Venteprod();
    $_SESSION["commande"]->venteprod[$nbart - 1]->ref = $produit->ref;
    $_SESSION["commande"]->venteprod[$nbart - 1]->titre = $produitdesc->titre;
    $_SESSION["commande"]->venteprod[$nbart - 1]->quantite = $_REQUEST["qtite"];
    $_SESSION["commande"]->venteprod[$nbart - 1]->tva = $tva;
    $_SESSION["commande"]->venteprod[$nbart - 1]->prixu = $prixu;
} else {
    $_SESSION["commande"]->nbart++;
    $nbart = $_SESSION["commande"]->nbart;
    $_SESSION["commande"]->venteprod[$nbart - 1] = new Venteprod();
    $_SESSION["commande"]->venteprod[$nbart - 1]->ref = $ref;
예제 #15
0
function liste_parent($parent, $niveau, $commande, $grandParent, $debutLie = 0)
{
    global $deco, $listePassee;
    $venteprod = new Venteprod();
    $query = "select * from {$venteprod->table} where commande='{$commande->id}' AND parent='{$parent}'";
    $resul = $venteprod->query($query);
    $memFin = "";
    while ($resul && ($row = $venteprod->fetch_object($resul))) {
        $venteprod->charger($row->id);
        $baseIndentation = 25;
        $paddingIndentation = 5;
        //base
        $largeurDesignation = 399;
        $indentation = "";
        if ($debutLie) {
            $indentation = "╓";
        } elseif ($grandParent != 0 && $grandParent == $venteprod->id) {
            $indentation = "╙";
        } elseif ($niveau > 0) {
            /*for($niv=0;$niv<$niveau;$niv++)
            		{
            			$indentation .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            		}*/
            $paddingIndentation += $baseIndentation * $niveau;
            $indentation .= "↳";
        }
        $largeurDesignation -= $paddingIndentation;
        $produit = new Produit();
        $produitdesc = new Produitdesc();
        $produit->charger($venteprod->ref);
        $produitdesc->charger($produit->id);
        $rubrique = new Rubrique();
        $rubrique->charger($produit->rubrique);
        $rubriquedesc = new Rubriquedesc();
        $rubriquedesc->charger($rubrique->id);
        if ($rubriquedesc->titre != "") {
            $titrerub = $rubriquedesc->titre;
        } else {
            $titrerub = "//";
        }
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $listePassee[] = $venteprod->id;
        if ($grandParent != 0 && $grandParent == $venteprod->id) {
            $memFin = "<ul class=\"__COULEUR_FOND__\">\n\t\t\t\t<li style=\"width:" . $largeurDesignation . "px;padding-left:" . $paddingIndentation . "px\">{$indentation} {$venteprod->ref} - {$titrerub} - " . str_replace("\n", "<br />", $venteprod->titre) . "</li>\n\t\t\t\t<li style=\"width:73px;\">" . round($venteprod->prixu, 2) . "</li>\n\t\t\t\t<li style=\"width:23px;\">" . $venteprod->quantite . "</li>\n\t\t\t\t<li style=\"width:20px;\">" . round($venteprod->quantite * $venteprod->prixu, 2) . "</li>\n\t\t\t\t</ul>";
        } else {
            $deco++;
            ?>
				<ul class="<?php 
            echo $fond;
            ?>
">
				<li style="width:<?php 
            echo $largeurDesignation;
            ?>
px; padding-left:<?php 
            echo $paddingIndentation;
            ?>
px;"><?php 
            echo $indentation . " " . $venteprod->ref . " - " . $titrerub;
            ?>
 - <?php 
            echo str_replace("\n", "<br />", $venteprod->titre);
            ?>
</li>
				<li style="width:73px;"><?php 
            echo round($venteprod->prixu, 2);
            ?>
</li>
				<li style="width:23px;"><?php 
            echo $venteprod->quantite;
            ?>
</li>
				<li style="width:20px;"><?php 
            echo round($venteprod->quantite * $venteprod->prixu, 2);
            ?>
</li>
				</ul>

		<?php 
        }
        if ($grandParent != $venteprod->id) {
            liste_parent($venteprod->id, $niveau + 1, $commande, $parent);
        }
    }
    if ($memFin != "") {
        if (!($deco % 2)) {
            $fond = "ligne_fonce_BlocDescription";
        } else {
            $fond = "ligne_claire_BlocDescription";
        }
        $deco++;
        echo str_replace("__COULEUR_FOND__", $fond, $memFin);
    }
}
예제 #16
0
function ajouter($lang, $ref, $prix, $ecotaxe, $promo, $prix2, $rubrique, $nouveaute, $perso, $poids, $stock, $tva, $ligne, $titre, $chapo, $description, $postscriptum)
{
    $ref = str_replace(" ", "", $ref);
    $ref = str_replace("/", "", $ref);
    $ref = str_replace("+", "", $ref);
    $ref = str_replace(".", "-", $ref);
    $ref = str_replace(",", "-", $ref);
    $ref = str_replace(";", "-", $ref);
    $ref = str_replace("'", "", $ref);
    $ref = str_replace("\n", "", $ref);
    $ref = str_replace("\"", "", $ref);
    $produit = new Produit();
    $produit->charger($ref);
    if ($produit->id) {
        redirige("produit_modifier.php?rubrique={$rubrique}&existe=1");
    }
    $produit = new Produit();
    $prix = str_replace(",", ".", $prix);
    $produit->ref = $ref;
    $produit->datemodif = date("Y-m-d H:i:s");
    $produit->prix = $prix;
    $produit->prix2 = $prix2;
    if ($produit->prix2 == "") {
        $produit->prix2 = $prix;
    }
    $produit->ecotaxe = $ecotaxe;
    $produit->rubrique = $rubrique;
    if ($promo == "on") {
        $produit->promo = 1;
    } else {
        $produit->promo = 0;
    }
    if ($nouveaute == "on") {
        $produit->nouveaute = 1;
    } else {
        $produit->nouveaute = 0;
    }
    if ($ligne == "on") {
        $produit->ligne = 1;
    } else {
        $produit->ligne = 0;
    }
    $produit->perso = $perso;
    $produit->poids = $poids;
    $produit->stock = $stock;
    $produit->tva = str_replace(",", ".", $tva);
    $lastid = $produit->add();
    $produit->id = $lastid;
    $produitdesc = new Produitdesc();
    $produitdesc->chapo = $chapo;
    $produitdesc->description = $description;
    $produitdesc->postscriptum = $postscriptum;
    $produitdesc->produit = $lastid;
    $produitdesc->lang = $lang;
    $produitdesc->titre = $titre;
    $produitdesc->chapo = str_replace("\n", "<br />", $produitdesc->chapo);
    $produitdesc->add();
    $rubcaracteristique = new Rubcaracteristique();
    $caracteristiquedesc = new Caracteristiquedesc();
    $caracval = new Caracval();
    $query = "select * from {$rubcaracteristique->table} where rubrique='" . $produit->rubrique . "'";
    $resul = mysql_query($query);
    while ($row = mysql_fetch_object($resul)) {
        $caracval = new Caracval();
        $deb = "caract";
        $deb2 = "typecaract";
        $val = $row->caracteristique;
        $var = $deb . $val;
        $var2 = $deb2 . $val;
        global ${$var};
        global ${$var2};
        $query2 = "delete from {$caracval->table} where produit='" . $produit->id . "' and caracteristique='" . $row->caracteristique . "'";
        $resul2 = mysql_query($query2);
        if (${$var} != "") {
            if (${$var2} == "c") {
                foreach (${$var} as $selectval) {
                    $caracval->produit = $lastid;
                    $caracval->caracteristique = $row->caracteristique;
                    $caracval->caracdisp = $selectval;
                    $caracval->add();
                }
            } else {
                $caracval->produit = $lastid;
                $caracval->caracteristique = $row->caracteristique;
                $caracval->valeur = ${$var};
                $caracval->add();
            }
        }
    }
    $rubdeclinaison = new Rubdeclinaison();
    $declinaisondesc = new Declinaisondesc();
    $declidisp = new Declidisp();
    $declidispdesc = new Declidispdesc();
    $query = "select * from {$rubdeclinaison->table} where rubrique='" . $rubrique . "'";
    $resul = mysql_query($query);
    while ($row = mysql_fetch_object($resul)) {
        $declinaisondesc->charger($row->declinaison);
        $query2 = "select * from {$declidisp->table} where declinaison='{$row->declinaison}'";
        $resul2 = mysql_query($query2);
        $nbres = mysql_num_rows($resul2);
        while ($row2 = mysql_fetch_object($resul2)) {
            $stock = new Stock();
            $stock->declidisp = $row2->id;
            $stock->produit = $lastid;
            $stock->valeur = 0;
            $stock->surplus = 0;
            $stock->add();
        }
    }
    $produitdesc->reecrire();
    ActionsModules::instance()->appel_module("ajoutprod", $produit);
    redirige($_SERVER['PHP_SELF'] . "?ref=" . $produit->ref . "&rubrique=" . $produit->rubrique . "&lang=" . $lang);
}
예제 #17
0
function liste_produits($rubrique, $critere, $order, $alpha)
{
    $produit = new Produit();
    $produitdesc = new Produitdesc();
    if ($alpha == "alpha") {
        $query = "select p.* from {$produit->table} p LEFT JOIN {$produitdesc->table} pd ON pd.produit = p.id and lang=" . ActionsLang::instance()->get_id_langue_courante() . " where p.rubrique=\"{$rubrique}\" order by pd.{$critere} {$order}";
    } else {
        $query = "select * from {$produit->table} where rubrique=\"{$rubrique}\" order by {$critere} {$order}";
    }
    $resul = $produit->query($query);
    $i = 0;
    while ($resul && ($row = $produit->fetch_object($resul))) {
        $produit->charger($row->ref);
        $produitdesc = new Produitdesc();
        $produitdesc->charger($row->id);
        if (!$produitdesc->affichage_back_office_permis()) {
            continue;
        }
        $fond = "ligne_" . ($i++ % 2 ? "claire" : "fonce");
        $image = new Image();
        $query_image = "select * from {$image->table} where produit=\"" . $row->id . "\" order by classement limit 0,1";
        $resul_image = $image->query($query_image);
        $row_image = $image->fetch_object($resul_image);
        ?>

<ul class="<?php 
        echo $fond;
        ?>
">
	<li><div class="vignette"><?php 
        if ($row_image) {
            ?>
 <img src="../fonctions/redimlive.php?nomorig=<?php 
            echo $row_image->fichier;
            ?>
&type=produit&width=51&height=51&exact=1" title="<?php 
            echo $produit->ref;
            ?>
" /><?php 
        }
        ?>
</div></li>
	<li style="width:61px;"><span class="texte_noedit" title="<?php 
        echo $row->ref;
        ?>
"><?php 
        echo substr($row->ref, 0, 9);
        if (strlen($row->ref) > 9) {
            echo " ...";
        }
        ?>
</span></li>
	<li style="width:225px;"><span id="titreprod_<?php 
        echo $row->id;
        ?>
" <?php 
        if ($produitdesc->est_langue_courante()) {
            echo 'class="texte_edit"';
        }
        ?>
><?php 
        echo substr($produitdesc->titre, 0, 35);
        if (strlen($produitdesc->titre) > 35) {
            echo " ...";
        }
        ?>
</span></li>
	<li style="width:39px;"><span id="stock_<?php 
        echo $row->id;
        ?>
" class="texte_edit"><?php 
        echo $row->stock;
        ?>
</span></li>
	<li style="width:30px;"><span id="prix_<?php 
        echo $row->id;
        ?>
" class="texte_edit"><?php 
        echo $row->prix;
        ?>
</span></li>
	<li style="width:68px;"><span id="prix2_<?php 
        echo $row->id;
        ?>
" class="texte_edit"><?php 
        echo $row->prix2;
        ?>
</span></li>
	<li style="width:64px;"><input id="promo_<?php 
        echo $row->id;
        ?>
" type="checkbox" name="promo[]" class="sytle_checkbox" onchange="checkvalues('promo','<?php 
        echo $row->id;
        ?>
')" <?php 
        if ($row->promo) {
            ?>
 checked="checked" <?php 
        }
        ?>
/></li>
	<li style="width:64px;"><input type="checkbox" id="nouveaute_<?php 
        echo $row->id;
        ?>
" name="nouveaute[]" class="sytle_checkbox" onchange="checkvalues('nouveaute','<?php 
        echo $row->id;
        ?>
')" <?php 
        if ($row->nouveaute) {
            ?>
 checked="checked" <?php 
        }
        ?>
/></li>
	<li style="width:53px;"><input type="checkbox" id="prod_ligne_<?php 
        echo $row->id;
        ?>
" name="ligne[]" class="sytle_checkbox" onchange="checkvalues('ligneprod','<?php 
        echo $row->id;
        ?>
')" <?php 
        if ($row->ligne) {
            ?>
 checked="checked" <?php 
        }
        ?>
/></li>
	<li style="width:41px;"><a href="produit_modifier.php?ref=<?php 
        echo $produit->ref;
        ?>
&rubrique=<?php 
        echo $produit->rubrique;
        ?>
"  class="txt_vert_11"><?php 
        echo trad('editer', 'admin');
        ?>
</a></li>

	<li style="width:78px; text-align:center;">
	<div class="bloc_classement">
  <div class="classement">
		<a href="produit_modifier.php?ref=<?php 
        echo $produit->id;
        ?>
&action=modclassement&parent=<?php 
        echo $rubrique;
        ?>
&type=M"><img src="gfx/up.gif" border="0" /></a>
	</div>
	 <div class="classement"><span id="classementprod_<?php 
        echo $produit->id;
        ?>
" class="classement_edit"><?php 
        echo $row->classement;
        ?>
</span></div>
	 <div class="classement">
		<a href="produit_modifier.php?ref=<?php 
        echo $produit->id;
        ?>
&action=modclassement&parent=<?php 
        echo $rubrique;
        ?>
&type=D"><img src="gfx/dn.gif" border="0" /></a>
	</div>
	</div>
	</li>
	<li style="width:37px; text-align:center;"><a href="javascript:supprimer_produit('<?php 
        echo $produit->ref;
        ?>
','<?php 
        echo $rubrique;
        ?>
')"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
</ul>

<?php 
    }
}