Make a NEW featured product box
Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive - and you get a link from my homepage to your site. Cheers!
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;
-
$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);
to this:
-
$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);
Step 1b: Change code in the same file from this:
to this:
-
TABLE_HEADING_FEATURED_PRODUCTS
Step 1c: Add this code into /includes/languages/english/index.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 if (tep_count_featured_products()> 0) { ?>
-
<tr>
-
</tr>
-
<tr>
-
<td><?php include(DIR_WS_MODULES . 'featured_products.php'); ?></td>
-
</tr>
-
<?php } ?>
Step 4: In /includes/functions/general.php add this extra code;
-
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'];
-
}
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..
Comment by repare — July 16, 2010 @ 7:28 am
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.
Comment by Gary — July 17, 2010 @ 12:37 pm
Hi,
thanks..
but what is the sql code to put in sql, where find it ?
thanks for your answer..
Comment by repare — July 17, 2010 @ 3:05 pm
Hi,
are you there ?
what sql code I add please ?
thanks..
Comment by repare — July 29, 2010 @ 2:40 pm
You need to download the zip file from the oscommerce site and make the necessary changes.
Comment by Gary — July 29, 2010 @ 3:13 pm
Hi,
thanks..
you meen from this link :
http://addons.oscommerce.com/info/651
Comment by repare — July 30, 2010 @ 1:32 pm