diff --git a/htdocs/product/critiques/bestproduct.php b/htdocs/product/critiques/bestproduct.php new file mode 100644 index 00000000000..19792298e79 --- /dev/null +++ b/htdocs/product/critiques/bestproduct.php @@ -0,0 +1,84 @@ + + * + * 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(); + +$db = new Db(); + +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, $PHP_SELF); + +$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 ".DB_NAME_OSC.".reviews as r,".DB_NAME_OSC.".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 "

"; + print "'; + print ''; + print "\n"; + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print "\n"; + $i++; + } + $db->free(); +} + +print "
Réf"; + print 'Indice critiquesQuantité'; + print 'Status
$objp->products_model'.$objp->rat."'.$objp->products_quantity."'.$objp->products_status."
"; + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/critiques/index.php b/htdocs/product/critiques/index.php new file mode 100644 index 00000000000..87c094d3eaa --- /dev/null +++ b/htdocs/product/critiques/index.php @@ -0,0 +1,78 @@ + + * + * 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(); + +$db = new Db(); + +if ($sortfield == "") { + $sortfield="lower(p.label),p.price"; +} +if ($sortorder == "") { + $sortorder="ASC"; +} + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + + +print_barre_liste("Liste des produits oscommerce", $page, $PHP_SELF); + +$sql = "SELECT r.reviews_rating FROM ".DB_NAME_OSC.".reviews as r"; + +//$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit( $limit ,$offset); + +print "

"; +print ''; +print ""; +print ""; +print "\n"; + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + + print "\n"; + $i++; + } + $db->free(); +} + +print "
Prix de vente
$objp->reviews_rating
"; + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/product/critiques/pre.inc.php b/htdocs/product/critiques/pre.inc.php new file mode 100644 index 00000000000..da2c959b135 --- /dev/null +++ b/htdocs/product/critiques/pre.inc.php @@ -0,0 +1,46 @@ + + * + * 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("../../main.inc.php3"); + +function llxHeader($head = "", $urlp = "") { + global $user, $conf; + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("index.php", "Critiques"); + + $menu->add_submenu("bestproduct.php", "Meilleurs produits"); + + left_menu($menu->liste); + /* + * + * + */ + +} +?>