Mark asks;
how would i go about re-coding [your featured product contribution] to keep the “new products for…” feature [and have the featured products in their own box]?
Step 1: Rename the module (new_products.php) in the zip to “featured_products.php”
Step 1a: Change the line of code in module “featured_products.php” from this;
[php]$new_products_query = tep_db_query(“select p.products_featured, p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from ” . TABLE_PRODUCTS . ” p left join ” . TABLE_SPECIALS . ” s on p.products_id = s.products_id, ” . TABLE_PRODUCTS_DESCRIPTION . ” pd where p.products_status = ‘1’ and p.products_id = pd.products_id and pd.language_id = ‘” . (int)$languages_id . “‘ order by p.products_featured DESC, p.products_date_added desc limit ” . MAX_DISPLAY_NEW_PRODUCTS);[/php]
to this:
[php]$new_products_query = tep_db_query(“select p.products_featured, p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from ” . TABLE_PRODUCTS . ” p left join ” . TABLE_SPECIALS . ” s on p.products_id = s.products_id, ” . TABLE_PRODUCTS_DESCRIPTION . ” pd where p.products_featured = ‘1’ AND p.products_status = ‘1’ and p.products_id = pd.products_id and pd.language_id = ‘” . (int)$languages_id . “‘ order by p.products_featured DESC, p.products_date_added desc limit ” . MAX_DISPLAY_NEW_PRODUCTS);[/php]
Step 1b: Change code in the same file from this:
[php]TABLE_HEADING_NEW_PRODUCTS, strftime(‘%B’)[/php]
to this:
[php]TABLE_HEADING_FEATURED_PRODUCTS[/php]
Step 1c: Add this code into /includes/languages/english/index.php
[php]define(‘TABLE_HEADING_FEATURED_PRODUCTS’, ‘Featured Products’);[/php]
Step 2: Install the contribution which you have amended in Step 1, 1a, 1b and 1c!
Step 3: In index.php, add this code;
[php] 0) { ?>
[/php]
Step 4: In /includes/functions/general.php add this extra code;
[php]function tep_count_featured_products() {
$featured_query = tep_db_query(“select count(*) as total from ” . TABLE_PRODUCTS . ” where products_featured = ‘1’”);
$featured = tep_db_fetch_array($featured_query);
return $featured[‘total’];
}[/php]
Step 5: If you get it working following the instructions above, Buy Me A Beer, I like beer 😉 !
If you cannot get it working, I offer an install service – please email me on oscshops@gmail.com
Gary
Hi,
excuse my english..
i have tryed jour code but adding to new products..
but have error :
1054 – Champ ‘products_featured’ inconnu dans where clause
select count(*) as total from products where products_featured = ‘1’
can you help me please..
i want to use featured product to slide show theme by select theme in admin..
thanks..
Hi – make sure to load the SQL as well as that error is looking for the change in the Database and is not finding it.
Hi,
thanks..
but what is the sql code to put in sql, where find it ?
thanks for your answer..
Hi,
are you there ?
what sql code I add please ?
thanks..
You need to download the zip file from the oscommerce site and make the necessary changes.
Hi,
thanks..
you meen from this link :
http://addons.oscommerce.com/info/651
http://addons.oscommerce.com/info/5848