Jump to content
xt:Commerce Community Forum

Bestseller aktualisieren


syncrosoni

Recommended Posts

Hallo,

ich möchte realisieren, dass die Bestseller Box immer die meisverkauften Artikel der letzten 30 Tage anzeigt.

Nur leider funktioniert das noch nicht so wie es soll - hab irgendwo nen Denkfehler.

Ich hoffe, es kann mir hier jemand helfen, der etwas mehr Ahnung von Mysql hat als ich.

       select blabla
p.products_fsk18,
p.products_id,
p.products_model,
p.products_price,
p.products_tax_class_id,
p.products_image,
pd.products_short_description,
pd.products_name,
o.date_purchased,
o.orders_id,
sum(op.products_quantity) as best_orders from " .
TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " .
TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_ORDERS . " o, " .
TABLE_ORDERS_PRODUCTS . " op, " .
TABLE_CATEGORIES . " c
where (date_sub(now(), interval 30 day) > o.date_purchased)
and o.orders_id = op.orders_id
and op.products_id = pd.products_id
and p.products_status = '1'
and c.categories_status = '1'
and p.products_ordered > 0
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id ".$fsk_lock."
".$group_check."
".$fsk_lock."
and p2c.categories_id = c.categories_id and '" . $current_category_id . "'
in (c.categories_id, c.parent_id)
group by pd.products_name
order by best_orders desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS;[/php]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...