Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How To Exclude A Category In Specials Module Shown At Index.php


williamkharvey

Recommended Posts

Hi Guys, London says hello. :thumbsup: wish us luck in trying to keep our great city safe.

 

I have a question relating to the specials and new products modules. My aim is to show both on the index page but would like to eliminate one of the categories from showing. This is because one of the categories (accessories) has 90% of the products and dominates the modules when showing at index.php (they work on random). I am looking to eliminate the accessories category altogether.

My question is - how can i achieve this?

Any help will be welcome.

 

On a seperate note on another site i have, when i put all products on sale (700 products) using specials by categories, the site slows down considerably (+3seconds). Does anyone know why this is and whether if there is a way to speed things up? Maybe a way to cache the specials?

 

Thanks all.

Link to comment
Share on other sites

Hi Guys, London says hello. :thumbsup: wish us luck in trying to keep our great city safe.

 

I have a question relating to the specials and new products modules. My aim is to show both on the index page but would like to eliminate one of the categories from showing. This is because one of the categories (accessories) has 90% of the products and dominates the modules when showing at index.php (they work on random). I am looking to eliminate the accessories category altogether.

My question is - how can i achieve this?

Any help will be welcome.

 

On a seperate note on another site i have, when i put all products on sale (700 products) using specials by categories, the site slows down considerably (+3seconds). Does anyone know why this is and whether if there is a way to speed things up? Maybe a way to cache the specials?

 

Thanks all.

 

You might be able to add a little bit to the sql statement in the /store/includes/modules.new_products.php that gathers that info. In the $new_products_query, just before the order by statement, you could put in 'and p2c.categories.id != (id number of the category you don't want to show)'. That might do it.

Link to comment
Share on other sites

On a seperate note on another site i have, when i put all products on sale (700 products) using specials by categories, the site slows down considerably (+3seconds). Does anyone know why this is and whether if there is a way to speed things up? Maybe a way to cache the specials?

 

You could try some of the cache related contributions.

http://www.oscommerce.com/community/contributions,5029

http://www.oscommerce.com/community/contributions,2873

Link to comment
Share on other sites

You might be able to add a little bit to the sql statement in the /store/includes/modules.new_products.php that gathers that info. In the $new_products_query, just before the order by statement, you could put in 'and p2c.categories.id != (id number of the category you don't want to show)'. That might do it.

 

Thanks for the quick response, i've tried to update the module without success. This may be because i'm not sure where/how to include the statement. I have pasted my code below and would be greatful if you could assist me.

Regards

 

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 rand() 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 rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...