diff --git a/htdocs/product/promotion/index.php b/htdocs/product/promotion/index.php index 6e4fe4cb7d8..1ca99cd3df6 100644 --- a/htdocs/product/promotion/index.php +++ b/htdocs/product/promotion/index.php @@ -26,11 +26,40 @@ llxHeader(); $db = new Db(); -print_barre_liste("Liste des promotions", $page, $PHP_SELF); +if ($action == "inactive") +{ + $promotion = new Promotion($db); + $promotion->set_inactive($id); +} +if ($action == "active") +{ + $promotion = new Promotion($db); + $promotion->set_active($id); +} -$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price"; +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, $PHP_SELF, "",$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 ".DB_NAME_OSC.".specials as s,".DB_NAME_OSC.".products_description as pd,".DB_NAME_OSC.".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) ) { @@ -38,8 +67,11 @@ if ( $db->query($sql) ) $i = 0; print '
| "; - print_liste_field_titre("Titre",$PHP_SELF, "a.title"); + print_liste_field_titre("Réf",$PHP_SELF, "p.products_model"); + print " | "; + print_liste_field_titre("Titre",$PHP_SELF, "pd.products_name"); print " | "; + print "Fin | "; print 'Prix initial | '; print 'Prix remisé | '; print "|||||
| '.$objp->products_model." | "; print ''.$objp->products_name." | "; - print ''.price($objp->products_price)." | "; + + if ($objp->status == 1) + { + print '';
+ print '';
+ print ' | ';
+ }
+ else
+ {
+ print '';
+ print '';
+ print ' | ';
+ print '".strftime("%d/%m/%Y", $objp->fin)." | "; + print ''.price($objp->products_price)." | "; print ''.price($objp->specials_new_products_price)." | "; print "