Rachael w. Posted December 11, 2006 Posted December 11, 2006 Is it possible to have all the items in a category (which are listed in a subcategory) to show in a list view when clicking a category? An example: Records-> (1828) 33 rpm (168) 45 rpm (1660) 78 rpm When one clicks on records it shows the clickable subcategory images for 33rpm 45rmp and 78rpm and the category list (in the infobox) expands to show that there are subcategories. I would like the page that now shows the subcategory images to show all the 1828 records in a list then the buyer can click on a subcategory in the infobox to narrow the list. Is this possible? Is there a contrib for this? Thanks in advance!
Rachael w. Posted January 6, 2007 Author Posted January 6, 2007 I still havent found an answer to this question. Does anyone know? In categories with only 2 sub categories I think it would look better to have a page will all the items rather than a page with two boxes to click on.
spax Posted January 6, 2007 Posted January 6, 2007 A box with 1828 records :blink: you'd never stop scrolling. :D
Rachael w. Posted January 6, 2007 Author Posted January 6, 2007 A box with 1828 records :blink: you'd never stop scrolling. :D :blink: Awww, I didnt want that...I had hoped to have it separate the pages like a normal category page. With the next> :blush:
Rachael w. Posted January 6, 2007 Author Posted January 6, 2007 well I found this topic: Show categories and subcategories And I used this code posted by itsover: Hi, As of osCommerce 2.2 Milestone 2 Update 051113, to do this modification, open catalog/index.php 1) Around line 20, replace if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { with if (tep_count_products_in_category($cPath) > 0) { $category_depth = 'products'; // display products } else { Same as previously. 2) Around line 195, replace // We show them all $listing_sql = "select " . $_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; with // We show them all $cPathA = explode("_", $cPath); $size = sizeof($cPathA)-1; $subcategories_array = array(); tep_get_subcategories($subcategories_array, $cPathA[$size]); $size_sc = sizeof($subcategories_array); //Subcat count $cat_Search = "("; for($i = 0; $i < $size_sc; $i++){ $cat_Search .= "p2c.categories_id = '" . $subcategories_array[$i] . "' or "; } $cat_Search .= "p2c.categories_id = '" . $cPathA[$size] . "'" . ")"; $listing_sql = "select " . $_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and " . $cat_Search . ""; Hope this helps. I added "p.products_image" to the "$listing_sql =........." to get the image to show in the list also. This is exactly what I wanted to do, however, I cant seem to get the products name to show. I have the Short Description in Products mod installed and its showing the short description, just not the products name above it. Anyone have any suggestions on where I went wrong? Thanks!!!!
Rachael w. Posted January 6, 2007 Author Posted January 6, 2007 Oh, and I havent tried it on my live site (which now has categories and subcategories with over 8,000 products) so I dont know if its gonna show a list of 4,000 products without a break or not! ;)
wheeloftime Posted January 7, 2007 Posted January 7, 2007 well I found this topic: Show categories and subcategories And I used this code posted by itsover: I added "p.products_image" to the "$listing_sql =........." to get the image to show in the list also. This is exactly what I wanted to do, however, I cant seem to get the products name to show. I have the Short Description in Products mod installed and its showing the short description, just not the products name above it. Anyone have any suggestions on where I went wrong? Thanks!!!! You'll have to add pd.products_name within the query also.
Rachael w. Posted January 7, 2007 Author Posted January 7, 2007 You'll have to add pd.products_name within the query also. I swear I did just that and thought it didnt work!!! Yep, that worked this time. Thanks for your help!
Rachael w. Posted January 7, 2007 Author Posted January 7, 2007 It worked! I tried it on the live site and its working fine! Has those 8,000 products separated by the page (as I thought it would ;) ) and now I have no more ugly main category pages which I have to find a photo for! :) Thanks to all who helped! I did change it a bit from the original code, just one line because I wanted it to show the listing the same as it does for any other product listing (with images). I changed this: $listing_sql = "select " . $_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and " . $cat_Search . ""; To this: $listing_sql = "select " . $_list . " p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and " . $cat_Search . "";
Rachael w. Posted August 10, 2007 Author Posted August 10, 2007 I created this edit as a contribution, I didnt see that anyone had submitted it. It can be found here: http://www.oscommerce.com/community/contributions,5351
Recommended Posts
Archived
This topic is now archived and is closed to further replies.