rgallego85 Posted February 19, 2009 Share Posted February 19, 2009 Hi guys, So I've been trying to figure out a way to grab important information in the product_info page (such as item desciription, item URL, and image) and place it in the new_products page. I've finally concluded that I need to modify the SQL code in new_products.php to include the data I want from product_info.php. I'm trying to mess with this line of code (in new_products.php): if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, 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 where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, 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_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } I'm thinking I need to modify the else statement $new_products_query. I looked at the SQL database graphic that was included in the OScommerce 2.2 package (it's a .pdf) and I identified the table I want to include in the SELECT query. The table is TABLES_PRODUCTS_DESCRIPTIONS and it includes all the necessary data that the product_info page uses. So my main question is: how do I add all of the keys from TABLES_PRODUCTS_DESCRIPTIONS to the above SELECT query without changing anything else? I think once I get this data included into $new_products_query, I can then figure out a way to output what I want onto the new_products module. I've been trying to mess with code by adding additional JOIN statements but I keep getting errors, so any help you guys can provide is greatly appreciated! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.