PDA

View Full Version : Enhanced BestSeller box with admin



michael_s
03-06-2007, 06:12 PM
fixed the problem with multilanguage shops:
demo: www.artesanias.de

search in boxes/besteller2.php

in line 31-36:
$bestseller_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price from (" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p) left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) left join " . TABLE_BESTSELLER . " b on (p.products_id = b.products_id) and p.products_id = pd.products_id where p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);
}
else {
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_BESTSELLER_PRODUCTS_CATEGORY , $cat_name));
$bestseller_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price from (" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p) left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) left join " . TABLE_BESTSELLER . " b on (p.products_id = b.products_id) and p.products_id = pd.products_id where p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);
}

replace with:

$bestseller_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price from (" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p) left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) left join " . TABLE_BESTSELLER . " b on (p.products_id = b.products_id) and p.products_id = pd.products_id where language_id = '" . (int)$languages_id . "' and p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);
}
else {
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_BESTSELLER_PRODUCTS_CATEGORY , $cat_name));
$bestseller_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_price, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price from (" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p) left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) left join " . TABLE_BESTSELLER . " b on (p.products_id = b.products_id) and p.products_id = pd.products_id where language_id = '" . (int)$languages_id . "' and p.products_status = '1' and b.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_BESTSELLER_PRODUCTS);
}

More... (http://www.oscommerce.com/community/contributions,1944)