PDA

View Full Version : Better Product Display with Admin



michael_s
08-25-2008, 02:00 PM
There was an error in the code in file "new_products.php".
I made some changes and now it works perfect!


FIND
AT THE BIGGINING
-------------------------

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$sql = "select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_image !='' and p.products_status = '1' order by RAND() limit ".MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query($sql);

} else {
$sql = "select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_image !='' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query($sql);
}


AND
CHANGE WITH
=============
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$sql = "select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_image !='' and p.products_status = '1' order by RAND() limit ".MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query($sql);

} else {
$sql = "
select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_image !='' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query($sql);
}

THAT' S ALL!!!!

More... (http://addons.oscommerce.com/info/4864)