Dennis_gull Posted March 26, 2007 Posted March 26, 2007 Hello, I got a top ten list of viewed products. In the main page it acts alright but in a category it will show wrong product at the wrong place. I just wrote the code and I cant see what could be wrong with it... check it out: $most_popular_query = tep_db_query("select p.products_id, p.products_image, p.products_model, sum(pd.products_viewed) as quantitysum, p.products_model, p.products_tax_class_id, p.products_price, s.specials_new_products_price, r.* from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s on p.products_id = s.products_id right join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id join rating r on p.products_id = r.id, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' group by p.products_id order by quantitysum DESC, p.products_id limit " . MAX_DISPLAY_MOST_POPULAR); } PS: the R.* is from ajax vote system.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.