aliharis2004 Posted January 28, 2004 Share Posted January 28, 2004 Can someone tell me is it possible to put one product of my chice on the first page of the catalog .... and what are the codes I have to play with ... thanks in advance Link to comment Share on other sites More sharing options...
Noobish-n-stuff Posted January 28, 2004 Share Posted January 28, 2004 i assume you are talking about something like a featured product... i've been thinking about puting something like that together but never sat down and figured it out. if anybody knows please post it, otherwise that is what i'm working on. Link to comment Share on other sites More sharing options...
aliharis2004 Posted January 28, 2004 Author Share Posted January 28, 2004 Absolutely some thing like that ... Link to comment Share on other sites More sharing options...
Noobish-n-stuff Posted January 28, 2004 Share Posted January 28, 2004 ok, i have yet to try this, but here it goes. 1: add new file called featured_product.php to catalog/includes/boxes <?php /* $Id: featured_product.php,v 1.0 2004/01/28 13:06:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- feature_product //--> <tr> <td class="main" width="250" align="center"> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); $feature_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_image, p.products_tax_class_id as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id where p.products_id = '21'" ); // the number at the end of this query is the product id number, change that to change the feature product $info_box_contents = array(); while ($feature = tep_db_fetch_array($feature_products_query)) { $feature['products_name'] = tep_get_products_name($feature['products_id']); $info_box_contents[] = array('align' => 'center', 'params' => 'class="smallText" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $feature['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $feature['products_image'], $feature['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $feature['products_id']) . '">' . $feature['products_name'] . '</a><br>' . $currencies->display_price($feature['products_price'], tep_get_tax_rate($feature['products_tax_class_id']))); } new contentBox($info_box_contents); ?> <!-- featured_product_eof //--> </td> </tr> 2: add code to catalog/includes/languages/english/index.php define('TABLE_HEADING_FEATURED_PRODUCT', ' Featured For %s'); 3: add to catalog/index.php (in a table of your choice in the place of your choice.) <?php require (DIR_WS_BOXES . 'featured_product.php'); ?> like i said, i haven't even had a chance to try this yet, but i wanted to post this so anybody else working on this could see what i'm doing. designed for MS2 Link to comment Share on other sites More sharing options...
aliharis2004 Posted January 29, 2004 Author Share Posted January 29, 2004 Hi, I tried the code and I am getting the following error : and I made sure that there is a Product with an ID 40. Did I miss some thing out ..... U can see the error on this page : http://mosaicartkeepsakes.com/catalog/inde...0e8a704ea77b21a ----- Error----- 1064 - You have an error in your SQL syntax near 'where p.products_id = '40'' at line 1 select p.products_id, pd.products_name, p.products_image, p.products_tax_class_id as products_price from products p, products_description pd, categories c, products_to_categories p2c left join specials s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id where p.products_id = '40' Link to comment Share on other sites More sharing options...
Noobish-n-stuff Posted January 29, 2004 Share Posted January 29, 2004 sorry about that, i thought i had posted the updated chunk of code. file: featured_product.php <?php /* $Id: featured_product.php,v 1.0 2004/01/28 13:06:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- feature_product //--> <tr> <td width="250" align="right"> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => '<b>' . sprintf(TABLE_HEADING_FEATURED_PRODUCT, strftime('%B')) . '</b>'); new searchBox($info_box_contents); $feature_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_image, p.products_tax_class_id as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p.products_id = 33 "); // the number at the end of this query is the product id number, change that to change the feature product $rows = 0; $info_box_contents = array(); while ($feature = tep_db_fetch_array($feature_products_query)) { $feature['products_name'] = tep_get_products_name($feature['products_id']); $info_box_contents[$rows] = array('align' => 'center', 'params' => 'class="smallText" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $feature['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $feature['products_image'], $feature['products_name'], 150, 150) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $feature['products_id']) . '">' . $feature['products_name'] . '</a><br>' . $currencies->display_price($feature['products_price'], tep_get_tax_rate($feature['products_tax_class_id']))); } new searchBox($info_box_contents); ?> <!-- featured_product_eof //--> </td> </tr> keep in mind that the other changes are still needed and this should work for MS2, still unsure about MS1. Link to comment Share on other sites More sharing options...
aliharis2004 Posted January 29, 2004 Author Share Posted January 29, 2004 It seems to be working really nice ... however, the only thing I did was change new searchBox($info_box_contents) To new contentBoxHeading($info_box_contents) I had to do this in two places .... let me know if it was supposed to be that way or no .. Link to comment Share on other sites More sharing options...
Noobish-n-stuff Posted January 29, 2004 Share Posted January 29, 2004 oh, don't worry about that. i setup a custom box-class, to give it a different look. changing it to "contentbox" is a good choice. i'm thinking about adding a description to that box also. hi ho hi ho off to code i go... Link to comment Share on other sites More sharing options...
aliharis2004 Posted January 29, 2004 Author Share Posted January 29, 2004 gr8 and you read my mind .... thats exactly I was wondering, what I need to do add content to that box :lol: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.