Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to limit categories in What's New box?


glokenspeil

Recommended Posts

I use the following code to exclude any products from category 324 from being included in the random "what's new" box on the left side

 

select p.products_id, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " c where p.products_status = '1' and c.categories_id != 324 order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW

 

 

it appears to be working but is slowing down the site.

 

 

is there a better way to exclude a category from being used in the random function?

 

Thanks!

Link to comment
Share on other sites

I use the following code to exclude any products from category 324 from being included in the random "what's new" box on the left side

 

select p.products_id, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " c where p.products_status = '1' and c.categories_id != 324 order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW

 

Try this.

 

select p.products_id, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " c where p.products_status = '1' and p.products_id = c.products_id and c.categories_id != 324 order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW

Lloyd

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...