Qual: Les pages de gestion des critiques du module OSCommerces 1 sont mises dans le rep du module
This commit is contained in:
parent
0717cdb2be
commit
25f7df7fd4
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,6 +41,7 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -40,6 +40,7 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
|
||||
92
htdocs/boutique/critiques/bestproduct.php
Normal file
92
htdocs/boutique/critiques/bestproduct.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/critiques/bestproduct.php
|
||||
\ingroup boutique
|
||||
\brief Page affichage meilleures critiques OS Commerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="rat";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
|
||||
print_barre_liste("Liste des produits classés pas critiques", $page, "bestproduct.php");
|
||||
|
||||
$sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".reviews as r,".OSC_DB_NAME.".products as p ";
|
||||
$sql .= " WHERE r.products_id = p.products_id";
|
||||
$sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status";
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\"><td>".$langs->trans("Ref");
|
||||
print '</td><TD align="center">Indice critiques</TD>';
|
||||
print '</td><td align="center">Quantité';
|
||||
print '</td><td align="center">Status</TD>';
|
||||
print "</TR>\n";
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print '<TD><a href="'.DOL_URL_ROOT.'/boutique/livre/fiche.php?oscid='.$objp->products_id.'">'.$objp->products_model.'</a></TD>';
|
||||
print '<TD align="center">'.$objp->rat."</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
|
||||
print '<TD align="center">'.$objp->products_status."</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
84
htdocs/boutique/critiques/critique.class.php
Normal file
84
htdocs/boutique/critiques/critique.class.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/*
|
||||
\file htdocs/boutique/critiques/critique.class.php
|
||||
\ingroup prelevement
|
||||
\brief Fichier de la classe des critiques OSCommerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class Critique
|
||||
\brief Classe permettant la gestion des critiques OSCommerce
|
||||
*/
|
||||
|
||||
class Critique {
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $nom;
|
||||
|
||||
function Critique($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch ($id) {
|
||||
|
||||
|
||||
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name";
|
||||
|
||||
$sql .= " FROM ".OSC_DB_NAME.".reviews as r, ".OSC_DB_NAME.".reviews_description as d";
|
||||
$sql .= " ,".OSC_DB_NAME.".products_description as p";
|
||||
|
||||
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
|
||||
$sql .= " AND p.language_id = ".OSC_LANGUAGE_ID. " AND d.languages_id=".OSC_LANGUAGE_ID;
|
||||
$sql .= " AND r.reviews_id=$id";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array();
|
||||
|
||||
$this->id = $result["reviews_id"];
|
||||
$this->product_name = stripslashes($result["products_name"]);
|
||||
$this->text = stripslashes($result["reviews_text"]);
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print "<p>$sql";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
84
htdocs/boutique/critiques/fiche.php
Normal file
84
htdocs/boutique/critiques/fiche.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/critiques/fiche.php
|
||||
\ingroup boutique
|
||||
\brief Page fiche critique OS Commerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$id=$_GET["id"];
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
|
||||
$critique = new Critique($db);
|
||||
$result = $critique->fetch($id);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
|
||||
print '<div class="titre">Fiche Critique</div><br>';
|
||||
|
||||
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print "<tr>";
|
||||
print '<td width="20%">Produit</td><td width="80%">'.$critique->product_name.'</td></tr>';
|
||||
|
||||
print '<tr><td width="20%">Texte</td><td width="80%">'.nl2br($critique->text).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Fetch failed";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
90
htdocs/boutique/critiques/index.php
Normal file
90
htdocs/boutique/critiques/index.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/critiques/fiche.php
|
||||
\ingroup boutique
|
||||
\brief Page gestion critiques OS Commerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="date_added";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Critiques", $page, "index.php");
|
||||
|
||||
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name FROM ".OSC_DB_NAME.".reviews as r, ".OSC_DB_NAME.".reviews_description as d, ".OSC_DB_NAME.".products_description as p";
|
||||
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
|
||||
$sql .= " AND p.language_id = ".OSC_LANGUAGE_ID. " AND d.languages_id=".OSC_LANGUAGE_ID;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print "<td>Produit</td>";
|
||||
print "<td>Critique</td>";
|
||||
print "<td align=\"center\">Note</td>";
|
||||
print "<TD align=\"right\"></TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD>".substr($objp->products_name, 0, 30)."</TD>\n";
|
||||
print '<TD><a href="fiche.php?id='.$objp->reviews_id.'">'.substr($objp->reviews_text, 0, 40)." ...</a></td>\n";
|
||||
print "<td align=\"center\">$objp->reviews_rating</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
52
htdocs/boutique/critiques/pre.inc.php
Normal file
52
htdocs/boutique/critiques/pre.inc.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/critiques/pre.inc.php
|
||||
\ingroup boutique
|
||||
\brief Fichier gestionnaire du menu gauche des critiques OSCommerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/boutique/critiques/critique.class.php");
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/bestproduct.php", "Meilleurs produits",2);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/promotion/index.php", $langs->trans("Promotion"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -42,6 +43,9 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/bestproduct.php", "Meilleurs produits",2);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/promotion/index.php", $langs->trans("Promotion"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,9 +18,15 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/produits/osc-liste.php
|
||||
\ingroup boutique
|
||||
\brief Page gestion produits du module OsCommerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
@ -59,15 +66,17 @@ print "<td>Titre</td>";
|
||||
print "<td>Groupe</td>";
|
||||
print '<td align="center">Stock</td>';
|
||||
print '<TD align="center">Status</TD>';
|
||||
print "</TR>\n";
|
||||
print "</TR>\n";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD>$objp->products_id</TD>\n";
|
||||
@ -81,11 +90,15 @@ if ( $db->query($sql) ) {
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
print "</TABLE>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -39,6 +39,9 @@ function llxHeader($head = "", $urlp = "")
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/bestproduct.php", "Meilleurs produits",2);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/promotion/index.php", $langs->trans("Promotion"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
|
||||
117
htdocs/boutique/promotion/index.php
Normal file
117
htdocs/boutique/promotion/index.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($action == "inactive")
|
||||
{
|
||||
$promotion = new Promotion($db);
|
||||
$promotion->set_inactive($id);
|
||||
}
|
||||
if ($action == "active")
|
||||
{
|
||||
$promotion = new Promotion($db);
|
||||
$promotion->set_active($id);
|
||||
}
|
||||
|
||||
if ($sortfield == "")
|
||||
{
|
||||
$sortfield="pd.products_name";
|
||||
}
|
||||
if ($sortorder == "")
|
||||
{
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des promotions", $page, "index.php", "",$sortfield, $sortorder);
|
||||
|
||||
$urladd = "&sortorder=$sortorder&sortfield=$sortfield";
|
||||
|
||||
$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price, p.products_model, s.status, p.products_id";
|
||||
$sql .= ",".$db->pdate("expires_date")." as fin";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".specials as s,".OSC_DB_NAME.".products_description as pd,".OSC_DB_NAME.".products as p";
|
||||
$sql .= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".OSC_LANGUAGE_ID;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print '<table class=\"noborder width="100%">';
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model");
|
||||
print_liste_field_titre("Titre","index.php", "pd.products_name");
|
||||
print "<td> </td><td> </td><td>Fin</td>";
|
||||
print '<td align="right">Prix initial</td>';
|
||||
print '<td align="right">Prix remisé</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$objp->products_model."</td>";
|
||||
print '<td>'.$objp->products_name."</td>";
|
||||
|
||||
if ($objp->status == 1)
|
||||
{
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_green.png" border="0" alt="actif"></td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=inactive&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_red_light.png" border="0"></a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<a href="index.php?action=active&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/icon_status_green_light.png" border="0"></a></td>';
|
||||
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_red.png" border="0" alt="inactif"></td>';
|
||||
}
|
||||
print "<td>".strftime("%d/%m/%Y", $objp->fin)."</td>";
|
||||
print '<td align="right">'.price($objp->products_price)."</td>";
|
||||
print '<td align="right">'.price($objp->specials_new_products_price)."</td>";
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
|
||||
?>
|
||||
51
htdocs/boutique/promotion/pre.inc.php
Normal file
51
htdocs/boutique/promotion/pre.inc.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/promotion/pre.inc.php
|
||||
\ingroup boutique
|
||||
\brief Fichier gestionnaire du menu gauche des promotions OSCommerce
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
require("./promotion.class.php");
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/boutique/index.php", $langs->trans("OSCommerceShop"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/produits/osc-liste.php", $langs->trans("Products"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/index.php", $langs->trans("Critiques"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/critiques/bestproduct.php", "Meilleurs produits",2);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/promotion/index.php", $langs->trans("Promotion"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/client/", $langs->trans("Customers"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/boutique/commande/", $langs->trans("Orders"));
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
?>
|
||||
178
htdocs/boutique/promotion/promotion.class.php
Normal file
178
htdocs/boutique/promotion/promotion.class.php
Normal file
@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class Promotion {
|
||||
var $db ;
|
||||
|
||||
var $id ;
|
||||
var $parent_id ;
|
||||
var $oscid ;
|
||||
var $ref;
|
||||
var $titre;
|
||||
var $description;
|
||||
var $price ;
|
||||
var $status ;
|
||||
|
||||
function Promotion($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function create($user, $pid, $percent) {
|
||||
|
||||
$sql = "SELECT products_price ";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".products as p";
|
||||
$sql .= " WHERE p.products_id = $pid";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array();
|
||||
$this->price_init = $result["products_price"];
|
||||
}
|
||||
|
||||
$newprice = 0.95 * $this->price_init;
|
||||
|
||||
$date_exp = "2003-05-01";
|
||||
|
||||
$sql = "INSERT INTO ".OSC_DB_NAME.".specials ";
|
||||
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
|
||||
$sql .= " VALUES ($pid, $newprice, now(),NULL,'$date_exp',NULL,1)";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
$id = $this->db->last_insert_id(OSC_DB_NAME.".specials");
|
||||
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function update($id, $user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."album ";
|
||||
$sql .= " SET title = '" . trim($this->titre) ."'";
|
||||
$sql .= ",description = '" . trim($this->description) ."'";
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function set_active($id)
|
||||
{
|
||||
$sql = "UPDATE ".OSC_DB_NAME.".specials";
|
||||
$sql .= " SET status = 1";
|
||||
|
||||
$sql .= " WHERE products_id = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function set_inactive($id)
|
||||
{
|
||||
$sql = "UPDATE ".OSC_DB_NAME.".specials";
|
||||
$sql .= " SET status = 0";
|
||||
|
||||
$sql .= " WHERE products_id = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch ($id) {
|
||||
|
||||
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
|
||||
$sql .= " FROM ".OSC_DB_NAME.".categories as c,".OSC_DB_NAME.".categories_description as cd";
|
||||
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".OSC_LANGUAGE_ID;
|
||||
$sql .= " AND c.categories_id = $id";
|
||||
$result = $this->db->query($sql) ;
|
||||
|
||||
if ( $result ) {
|
||||
$result = $this->db->fetch_array();
|
||||
|
||||
$this->id = $result["categories_id"];
|
||||
$this->parent_id = $result["parent_id"];
|
||||
$this->name = $result["categories_name"];
|
||||
$this->titre = $result["title"];
|
||||
$this->description = $result["description"];
|
||||
$this->oscid = $result["osc_id"];
|
||||
}
|
||||
$this->db->free();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function delete($user) {
|
||||
|
||||
$sql = "DELETE FROM ".OSC_DB_NAME.".products WHERE products_id = $idosc ";
|
||||
|
||||
$sql = "DELETE FROM ".OSC_DB_NAME.".products_to_categories WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".OSC_DB_NAME.".products_description WHERE products_id = $idosc";
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."album WHERE rowid = $id";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user