Make a NEW featured product box
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


