Guest Posted July 28, 2006 Share Posted July 28, 2006 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 More sharing options...
♥FWR Media Posted May 1, 2007 Share Posted May 1, 2007 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. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
♥FWR Media Posted May 1, 2007 Share Posted May 1, 2007 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. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
♥FWR Media Posted May 1, 2007 Share Posted May 1, 2007 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. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.