PDA

View Full Version : Featured Products



michael_s
08-29-2007, 03:26 AM
The 10 aUG 2007 modification belowf or enable/disable categories doesn't allow one to list products in disabled categories as featured items.
This neglects business workflow,
Most people use disable categories to prepare products for future use (e.g a holiday collection), hence they should be able to get everything ready, including listing some products as featured before those categories are active.

I modified the query in featured_products.php so only products in active categories are shown.
Around line 59, find
$featured_products_array = array();
$featured_products_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by p.products_date_added DESC, pd.products_name";

REPLACE WITH:
// ################## Added Enable Disable Categorie Featured products mod by Bruin_03#################
$featured_products_array = array();
$featured_products_query_raw = "SELECT p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, c.categories_status, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from ". TABLE_PRODUCTS ." p
LEFT JOIN " . TABLE_MANUFACTURERS . " m ON p.manufacturers_id = m.manufacturers_id
LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "') LEFT JOIN " . TABLE_SPECIALS . " s on p.products_id = s.products_id
LEFT JOIN " . TABLE_FEATURED . " f ON (p.products_id = f.products_id)
LEFT JOIN ". TABLE_PRODUCTS_TO_CATEGORIES . " p2c ON (p.products_id = p2c.products_id)
LEFT JOIN ". TABLE_CATEGORIES." c ON (p2c.categories_id = c.categories_id)
WHERE c.categories_status='1' AND p.products_status = '1' AND f.status = '1'
ORDER BY p.products_date_added
DESC, pd.products_name";

// ################## OEF Added Enable Disable Categorie Featured products mod by Bruin_03#################




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