Sign in to follow this  
Followers 0

Top des Ventes

3 posts in this topic

Posted · Report post

Bonjour à tous,

Voilà, j'aimerais que ma page "meilleures ventes" affiche les 10 meilleures ventes automatiquement.

J'ai trouvé ce bout de code:

$sql = "SELECT

Count(*) AS count

, p.id

, p.nom

, p.prix

FROM peel_commandes_articles oi, peel_produits p

WHERE oi.produit_id = p.id

GROUP BY oi.produit_id, p.id

ORDER BY count

DESC LIMIT 10";

Et je voudrais qu'il soit en lien avec celui-là:

affiche_produit($cond="p.on_top='1'", $titre = TOP, $form = "top", $nb_par_page = $_SESSION['ecom']['nb_produit_page']);

function affiche_produit($cond, $titre, $form, $nb_par_page) {

global $wwwroot, $repertoire_modele, $repertoire_images, $repertoire_upload ;

echo "<h2>".$titre."</h2>";

$Links = new MultiPage();

$Links-> ResultPerPage = $nb_par_page;

$Links-> LinkPerPage = 15;

$Links-> Template = "tpl1.htm";

$tables = "peel_produits p";

$inner_table = "";

$inner_site = "INNER JOIN peel_sites_pivots ps ON (ps.produit_id = p.id)";

$champs = "p.id, p.nom_".$_SESSION['langue']." as nom, p.promotion, p.descriptif_".$_SESSION['langue']." as descriptif, p.id_marque, p.image1, p.image2, p.prix, p.prix_revendeur, p.prix_flash, p.points, p.on_stock, p.affiche_stock, p.precommande, p.delai_stock, p.on_rupture, p.on_check, p.on_flash, p.flash_start, p.flash_end";

$contrainte = "AND ".$cond." AND ps.site_id = '".intval($_SESSION['ecom']['id'])."'";

$tri = "ORDER BY RAND()";

$Links-> SqlRequest = "SELECT ".$champs." FROM ".$tables." ".$inner_table." ".$inner_site." WHERE p.etat = '1' AND 1 ".$contrainte." ".$tri;

$Links-> Initialize();

$qid = mysql_query($Links-> LimitSQL) or die('Une erreur de connexion &agrave; la base s est produite ' . __LINE__ . '.<p>' . mysql_error());

if (mysql_num_rows($qid) > 0) {

$nb_cellules = mysql_num_rows($qid);

$nb_colonnes = 2;

echo "\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" summary=\"\">";

$j = 0;

while ($prod = mysql_fetch_array($qid))

{

if ( $j % $nb_colonnes == 0 ) { echo "\t\n<tr>"; }

if($j % $nb_colonnes !=0 OR $j % $nb_colonnes == 0 ) {

// on affiche une cellule

echo ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) ? "\t\t\n<td>" : "\t\t\n<td>";

//ca envoyait a template_index_produit et j'ai rajoute en_ligne

template_index_produit(

intval($prod['id']),

html_entity_decode($prod['nom']),

$prod['promotion'],

html_entity_decode($prod['descriptif']),

intval($prod['id_marque']),

$prod['image1'],

$prod['image2'],

$prod['prix'],

$prod['prix_revendeur'],

$prod['prix_flash'],

intval($prod['points']),

$prod['on_stock'],

$prod['affiche_stock'],

$prod['delai_stock'],

$prod['precommande'],

$prod['on_rupture'],

$prod['on_check'],

$prod['on_flash'],

$prod['flash_start'],

$prod['flash_end'],

$form);

}

echo "\t\t\n</td>";

$j++;

if ( $j % $nb_colonnes == 0 OR $j == $nb_cellules ) {

echo "\t\n</tr>";

}

}

echo "\t\n<tr>\t\t\n<td colspan=\"".$nb_colonnes."\">";

$Links-> pMultipage();

echo "\t\t\n</td>\t\n</tr>";

echo "\n</table>";

}

}

Mais comme je suis nulle en SQL, quelqu'un pourrait m'aider?

Merci d'avance.

:mellow:

Natty.

Share this post


: post
Share on other sites

Posted · Report post

Bonjour à tous,

Voilà, j'aimerais que ma page "meilleures ventes" affiche les 10 meilleures ventes automatiquement.

J'ai trouvé ce bout de code:

Et je voudrais qu'il soit en lien avec celui-là:

Mais comme je suis nulle en SQL, quelqu'un pourrait m'aider?

Merci d'avance.

:mellow:

Natty.

Est ce les vraies 10 meilleures ventes ou ceux dont la case à cocher Meilleure Vente est cochée qui doivent s'afficher

Share this post


: post
Share on other sites

Posted · Report post

Bonjour Patrice,

C'est les vraies 10 meilleures ventes.

Share this post


: post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

Twitter Advisto ecommerce

Facebook PEEL Shopping