Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New_products not showing subcategories


Guest

Recommended Posts

I've searched and searched but despite that this must have been a problem for others aswell i havent find the solution.

 

Problem:

 

I'm setting up some categories - in my case automobiles. These categories acts as parent categories for a whole lot of subcatgories

 

sample:

* Alfa Romeo

- 146

- 156

- Styling

- Tuning

 

* Fiat

 

Well anyways new_products.php does a fine job of displaying any new product on the front page - however clicking on fx. Alfa Romeo - creates the problem. This category doesent have any products - but instead a lot of subcategories... Question is.. why isnt it showing my new products from these sub categories? And more importantly...how do i make it do so :D

 

 

All help would be greatly appreciated

Link to comment
Share on other sites

  • 9 months later...
I've searched and searched but despite that this must have been a problem for others aswell i havent find the solution.

 

Problem:

 

I'm setting up some categories - in my case automobiles. These categories acts as parent categories for a whole lot of subcatgories

 

sample:

Well anyways new_products.php does a fine job of displaying any new product on the front page - however clicking on fx. Alfa Romeo - creates the problem. This category doesent have any products - but instead a lot of subcategories... Question is.. why isnt it showing my new products from these sub categories? And more importantly...how do i make it do so :D

All help would be greatly appreciated

 

 

Interesting, I'm looking at this problem now. It seems that when you create a sub category below a category then the main

category shows no new products because of the following statement: -

 

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

 

Well in my case ..

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

 

produces a positive number but because all that's under it are categories then it obviously isn't going to find any products attributed to that category id.

 

Surely this must be noted somewhere? Damned if I can find it.

Link to comment
Share on other sites

I believe this is a bug in /includes/modules/new_products.php

 

The query ..

 

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

 

should be ..

 

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

 

Look for the OR.

Link to comment
Share on other sites

My above post is incorrect .. there is no provision in new_products.php to query for products that exist in subcategories.

 

Therefore it seems that a category with a subcategory will not be able to show the new products of its subs unless a query is introduced to determine the sub categories and from there pull the products.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...