bigfunkychief Posted May 10, 2003 Posted May 10, 2003 Maybe someone has tried this before.... I'm trying to customize my page so that when it first loads, it automatically shows you one specific category of products, same one every time. I guess I'm looking for the code that displays the products, and I'm also wondering how I'd pass my category variable to the code.... thanks in advance for your time! osCommerce rules!
Guest Posted May 10, 2003 Posted May 10, 2003 Are you wanting to have this Category appear on the Default Page, along with everything else that already appears? Or, did you want to link to a certain Category that is placed outside of osC, that when clicked, brought you into this specific Category? Please advise. -R
bigfunkychief Posted May 10, 2003 Author Posted May 10, 2003 Like this: I sell guitars, so when someone opens the page, I'd like to have it display the category GUITARS >> NEW on the screen. If someone went to the left and clicked GUITARS then on NEW, they'd get a certain product listing. I'd like for that product listing to be defaultly displayed when the user first opens the.... so i'd really be removing: <td class="main"><?php echo tep_customer_greeting(); ?></td> <td class="main"><br><?php echo TEXT_MAIN; ?></td> and adding some type of PHP code that would display GUITARS >> NEW. Hope that makes sense! thanks!
Guest Posted May 10, 2003 Posted May 10, 2003 I would recommend that you use something like the /MODULES/NEW_PRODUCTS.PHP file and modify it accordingly. The code in this file is fairly straightforward and you should be able to follow what it trying to do. If you need someone to do this for you, let me know. Good Luck. -R
bigfunkychief Posted May 10, 2003 Author Posted May 10, 2003 that makes sense, thanks! In new_products.php, this code : 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 = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } would you be able to simply explain how the if else statement works there? what is is checking for, and what does the 2 different $new_products_query statements do?
Guest Posted May 10, 2003 Posted May 10, 2003 remove that part of the code... its not necessary. This is the only bit of code that you need to be concerned with right now... $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); This is what should be modified and used to make your query. -R
bigfunkychief Posted May 14, 2003 Author Posted May 14, 2003 I was able to get it working thanks to your advice....thanks!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.