示例#1
0
function accessoire_produit()
{
    $produit = new Produit();
    $produit->charger($_GET['ref']);
    $query = "select p.* from {$produit->table} p LEFT JOIN " . Produitdesc::TABLE . " pd ON p.id=pd.produit AND pd.lang='" . $_SESSION['util']->lang . "' where p.rubrique=\"" . $_GET['id_rubrique'] . "\" ORDER BY pd.titre";
    $resul = $produit->query($query);
    while ($resul && ($row = $produit->fetch_object($resul))) {
        $test = new Accessoire();
        if ($test->charger_uni($produit->id, $row->id)) {
            continue;
        }
        $produitdesc = new Produitdesc();
        $produitdesc->charger($row->id);
        ?>
			<option value="<?php 
        echo $row->id;
        ?>
"><?php 
        echo $produitdesc->titre;
        ?>
</option>
<?php 
    }
}
示例#2
0
function accessoire_produit()
{
    $produit = new Produit();
    $produit->charger($_GET['ref']);
    $query = "select * from {$produit->table} where rubrique=\"" . $_GET['id_rubrique'] . "\"";
    $resul = $produit->query($query);
    while ($resul && ($row = $produit->fetch_object($resul))) {
        $test = new Accessoire();
        if ($test->charger_uni($produit->id, $row->id)) {
            continue;
        }
        $produitdesc = new Produitdesc();
        $produitdesc->charger($row->id);
        ?>
			<option value="<?php 
        echo $row->id;
        ?>
"><?php 
        echo $produitdesc->titre;
        ?>
</option>
<?php 
    }
}
示例#3
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 
    }
}
 public function match($ref, $max_accepted = 5)
 {
     if (strlen($ref) == 0) {
         return 'KO';
     }
     $product = new Produit();
     $q = "SELECT p.id, p.ref, pd.titre, p.prix, p.prix2, p.promo, p.tva, p.rubrique\n                FROM {$product->table} p\n                    LEFT JOIN " . Produitdesc::TABLE . " pd\n                        ON p.id=pd.produit AND pd.lang='" . ActionsLang::instance()->get_id_langue_courante() . "'\n                WHERE\n                    p.ref LIKE '{$ref}%'\n                ";
     $r = $product->query($q);
     if ($product->num_rows($r) == 0) {
         return 'KO';
     }
     if ($product->num_rows($r) > $max_accepted) {
         return 'TOO_MUCH:' . $product->num_rows($r);
     }
     $retour = array();
     while ($r && ($a = $product->fetch_object($r))) {
         $retour[] = array("ref" => $a->ref, "titre" => $a->titre, "prix" => $a->prix, "prix2" => $a->prix2, "promo" => $a->promo, "tva" => $a->tva, "rubrique" => $a->rubrique, "stock" => $this->getVariants($a->id));
     }
     return json_encode($retour);
 }