emiliano Posted February 3, 2003 Share Posted February 3, 2003 Cieto Featured Products v2 by Emiliano Casta?o <[email protected]> for osCommerce V2.2 CVS (http://www.oscommerce.com) CHANGELOG 03/02/2002 V2.0 Cleaner files. Posibility to set up as many columns as you want. Shows only products from the category you are in (i hope). --- Download at: http://www.oscommerce.com/community/contributions,505 --- Thanks to everyone Emiliano Casta?o [email protected] Quote patagonia, argentina Link to comment Share on other sites More sharing options...
dreamscape Posted February 3, 2003 Share Posted February 3, 2003 Shows only products from the category you are in (i hope). hey emiliano. good to see you back... I don't see in this new version where it pulls products from the category you are in... also in modules/featured_products.php for the if statement to work, in featured.php, you need to pull the products description. Quote The only thing necessary for evil to flourish is for good men to do nothing - Edmund Burke Link to comment Share on other sites More sharing options...
dreamscape Posted February 3, 2003 Share Posted February 3, 2003 Emiliano, I am pretty sure this new version won't pull from categories. I just tried it and it does not. I still run v1.5 b/c I have modified it to pull from categories... here is my includes/modules/featured.php file: <?php /* osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Featured Products Listing */ require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED); if(FEATURED_PRODUCTS_DISPLAY == true) { ?> <!-- body //--> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading">Featured Products</td> </tr> <tr> <td> <?php $featured_products_category_id = $new_products_category_id; if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { // We are not in category depth; we are on the main page $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_description, pd.products_shortdescription, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1' } else { // We are in category depth; pull the featured from the category by random $featured_products_query_raw = "select distinct p.products_id, pd.products_name, p.products_image, p.products_tax_class_id, pd.products_description, pd.products_shortdescription, s.status as specstat, s.specials_new_products_price, p.products_price 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_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1' } $featured_products_query = tep_db_query($featured_products_query_raw); while ($featured_products = tep_db_fetch_array($featured_products_query)) { // $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']); // $featured_products['products_description'] = tep_get_products_description($featured_products['products_id']); $featured_products_array[] = array('id' => $featured_products['products_id'], 'name' => $featured_products['products_name'], 'description' => $featured_products['products_description'], 'shortdescription' => $featured_products['products_shortdescription'], 'image' => $featured_products['products_image'], 'price' => $featured_products['products_price'], 'specials_price' => $featured_products['specials_new_products_price'], 'tax_class_id' => $featured_products['products_tax_class_id'], 'manufacturer' => $featured_products['manufacturers_name']); } require(DIR_WS_MODULES . FILENAME_FEATURED_PRODUCTS); ?> </td> </tr> </table> <?php } else // If it's disabled, then include the original New Products box { include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } ?> if you are in category depth, it pulls a random product from that category, whether it is selected as featured or not (that can be changed to pull featured from that category by placing "and f.status = '1'" back into the statement for category depth)... if you are on the main page, it pulls random products from those selected as featured in admin from any category. Quote The only thing necessary for evil to flourish is for good men to do nothing - Edmund Burke Link to comment Share on other sites More sharing options...
emiliano Posted February 4, 2003 Author Share Posted February 4, 2003 arrrrrrrgh wait for version 2.1 emiliano Quote patagonia, argentina Link to comment Share on other sites More sharing options...
emiliano Posted February 4, 2003 Author Share Posted February 4, 2003 dear dream... how the hell did you make your featured.php file work?!?!!? it's not working in my computer.. i don't know why... emiliano Quote patagonia, argentina Link to comment Share on other sites More sharing options...
dreamscape Posted February 4, 2003 Share Posted February 4, 2003 emiliano... in default.php, the 1st instance of FILENAME_FEATURED should look like: <?php $new_products_category_id = $current_category_id; include(DIR_WS_MODULES . FILENAME_FEATURED); ?> I dunno... I didn't change anything other than modules/featured.php form the 1.3 version. that is the only thing I can thing of that would keep it from working. Quote The only thing necessary for evil to flourish is for good men to do nothing - Edmund Burke Link to comment Share on other sites More sharing options...
emiliano Posted February 4, 2003 Author Share Posted February 4, 2003 i have that on default.php... why the hell this it's not working.. somebody else out there??? emiliano Quote patagonia, argentina Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2003 Share Posted February 11, 2003 I do believe I got this puppy to work in the category depth as well as the main page. Take a look at http://www.cleopas.org/catalog. Here is the includes/modules/featured.php file as it stands now. If there is an easier way to code this please let me know. <?php /* osCommerce, Open Source E-Commerce Solutions [url=http://www.oscommerce.com]http://www.oscommerce.com[/url] Copyright (c) 2002 osCommerce Released under the GNU General Public License Featured Products Listing */ require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED); ?> <!-- body //--> <?php if(FEATURED_PRODUCTS_DISPLAY == true) { $featured_products_category_id = $current_category_id; if ((!isset($featured_products_category_id)) || ($featured_products_category_id == '0')) // We are not in category depth; we are on main page { $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_shortdescription, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, products_date_added, 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 rand() limit " . MAX_DISPLAY_FEATURED_PRODUCTS; } else { // We are in category depth; pull the featured from the category by random $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_shortdescription, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, products_date_added, 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_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where c.parent_id = '" . $current_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() limit " . MAX_DISPLAY_FEATURED_PRODUCTS; } $g = 0; $featured_products_query = tep_db_query($featured_products_query_raw); while ($featured_products = tep_db_fetch_array($featured_products_query)) { $featured_products_array[] = array('id' => $featured_products['products_id'], 'name' => $featured_products['products_name'], 'shortdescription' => $featured_products['products_shortdescription'], 'image' => $featured_products['products_image'], 'price' => $featured_products['products_price'], 'specials_price' => $featured_products['specials_new_products_price'], 'tax_class_id' => $featured_products['products_tax_class_id'], 'manufacturer' => $featured_products['manufacturers_name']); $g ++; } if ($g >= 1) { //BOF Added for new InfoBox Look $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => TABLE_HEADING_FEATURED_PRODUCTS); new infoBoxHeading($info_box_contents, true, true); //EOF Added for new InfoBox Look echo "<table class='infoBox' width='100%' border='0' cellspacing='0' cellpadding='1'>"; echo "<tr><td>"; echo "<table class='infoBoxContents' width='100%' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><td>"; require(DIR_WS_MODULES . FILENAME_FEATURED_PRODUCTS); echo "</td></tr></table>"; echo "</td></tr></table>"; } else // If it's disabled, then include the original New Products box { include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } } else // If it's disabled, then include the original New Products box { include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2003 Share Posted February 11, 2003 OK... how about this link to view the above working demo http://www.cleopas.com/catalog/ Quote Link to comment Share on other sites More sharing options...
Guest Posted February 11, 2003 Share Posted February 11, 2003 I made a slight change to the includes/modules/featured.php file... this seems to be faster. http://www.cleopas.org/catalog/ <?php /* osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License Featured Products Listing */ require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED); ?> <!-- body //--> <?php if(FEATURED_PRODUCTS_DISPLAY == true) { $featured_products_category_id = $current_category_id; if ((!isset($featured_products_category_id)) || ($featured_products_category_id == '0')) // We are not in category depth; we are on main page { $featured_products_query_raw = "select distinct p.products_id, pd.products_name, pd.products_shortdescription, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, products_date_added, 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 rand() limit " . MAX_DISPLAY_FEATURED_PRODUCTS; } else { // We are in category depth; pull the featured from the category by random $featured_products_query_raw = "select distinct p.products_id, pd.products_name, pd.products_shortdescription, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, products_date_added, 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_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where c.parent_id = '" . $current_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() limit " . MAX_DISPLAY_FEATURED_PRODUCTS; } $featured_products_query = tep_db_query($featured_products_query_raw); while ($featured_products = tep_db_fetch_array($featured_products_query)) { $featured_products_array[] = array('id' => $featured_products['products_id'], 'name' => $featured_products['products_name'], 'shortdescription' => $featured_products['products_shortdescription'], 'image' => $featured_products['products_image'], 'price' => $featured_products['products_price'], 'specials_price' => $featured_products['specials_new_products_price'], 'tax_class_id' => $featured_products['products_tax_class_id'], 'manufacturer' => $featured_products['manufacturers_name']); } $fsize = sizeof($featured_products_array); if ($fsize >= '1') { $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => TABLE_HEADING_FEATURED_PRODUCTS); new infoBoxHeading($info_box_contents, true, true); echo "<table class='infoBox' width='100%' border='0' cellspacing='0' cellpadding='1'>"; echo "<tr><td>"; echo "<table class='infoBoxContents' width='100%' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><td>"; require(DIR_WS_MODULES . FILENAME_FEATURED_PRODUCTS); echo "</td></tr></table>"; echo "</td></tr></table>"; } else // If it's disabled, then include the original New Products box { include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } } else // If it's disabled, then include the original New Products box { include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); } ?> Quote Link to comment Share on other sites More sharing options...
HaggisBoy Posted March 5, 2003 Share Posted March 5, 2003 I installed this but the FEATURED PRODUCTS box won't show up. It keeps showing the WHAT'S NEW box. Do I need to change anything in the column_left.php file????? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 5, 2003 Share Posted March 5, 2003 There are 2 instances of FILENAME_NEW_PRODUCTS in /catalog/default.php which have to be changed to FILENAME_FEATURED. Quote Link to comment Share on other sites More sharing options...
HaggisBoy Posted March 5, 2003 Share Posted March 5, 2003 Cheers Mark. I have changed them and the problem is still there (I had them changed already). Booo hoo hoo :cry: Quote Link to comment Share on other sites More sharing options...
HaggisBoy Posted March 5, 2003 Share Posted March 5, 2003 Ummmmmmmmm, OK. It's working. Holy crap do I feel like a dunce... I was under the impression that the FEATURED PRODUCTS was actually going to replace the small infobox on column_left.php and NOT the New Products box on default.php below the welcome message....... Is this right?!?! Quote Link to comment Share on other sites More sharing options...
Guest Posted March 5, 2003 Share Posted March 5, 2003 This is right... however when there are no featured products the new products box will show. I don't have the time for it now but there should be no reason why you could not change the new products box to a featured products box or at least copy it... in theory. If havn't done it yourself... I'll look into it tonight. Quote Link to comment Share on other sites More sharing options...
HaggisBoy Posted March 5, 2003 Share Posted March 5, 2003 Bloody hell, I'm like a mean, lean posting machine. Ignore the above. I thought that this would be a problem until I decided to have BOTH a featured products box AND a <Month> Arrivals box. This way I can have new products AND special, older products displayed. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 5, 2003 Share Posted March 5, 2003 Just make sure you realize that, with the way that you may have it set up now ( can always be changed ), if you don't have any featured products you would get 2 new products boxes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.