Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display One Category Under What's New Here?


russelbcox

Recommended Posts

Posted

Hello to you all!

 

I am new to Oscommerce, so please be gentle!

 

I have been looking on the web and forums to see if there is a way to only display one category on the home page - under 'What's New Here etc...'

 

At present, the home page shows the most recent added projects (total 4 products set in admin) however, I would only like to display products from the one category.

 

//

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);

//

 

Would I need to set the categoryID in the sql query? The category_id I only want to display is '15'

 

Any pointers where to look?

 

Thanks in advance...

 

Russ

Posted

Hi,

 

I included

 

$new_products_category_id = 15;

 

just above code... here....

 

//

 

 

//

$new_products_category_id = 15;

 

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);

//

 

However, when I go to the shop, I now see no products on home page?

 

This is my table 'products_to_categories' MySQL table...

 

//

products_id,categories_id

53, 15

54, 15

55, 15

56, 15

//

 

 

Any ideas?

 

R

Posted

Hello Vicky

 

Any ideas?

 

Thanks

 

Russ

Posted

Hi,

 

Does anybody know how to set a particular category under 'New_Products'?

 

I tried this '$new_products_category_id = 15;' (15 being the categories_id I would like to display) but it doesn't display any products... any ideas?

 

Russ

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...