hayesb2 Posted November 19, 2013 Posted November 19, 2013 My site only has 5 main categories, but has MANY sub-categories for each main category. When I click on a main category it lists the sub-categories in TWO places...down the left side of the website (which is good) but also in the main content area (which I do not want). How do I change this so that the main content area displays products within the category? I dont care if its random products, the newest products, etc. Just so long as its products within the category. Note - I realize I can put products under the main category without including them in a sub-category and it will resolve the issue, but this is not feasible for me as my supplier only has products within the sub-categories. Please advise.
Guest Posted November 20, 2013 Posted November 20, 2013 Hi, I think that many people who have read this are willing to help you, but this is almots impossible, because no one know what you really have there. Two options: 1) The best way - show us your shop, then we can give you advice, 2) Show us atleast picures of your shop and the problem area.
♥bruyndoncx Posted November 20, 2013 Posted November 20, 2013 and it is unclear how much instruction you need ... does it help if I say, it is the 'nested' case you want to change, and if you can comment out the section with the categories query that is pretty high on the page, I think you have what you need. The file to modify is catalog/index.php KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
hayesb2 Posted November 21, 2013 Author Posted November 21, 2013 Yes I can provide an example... Here is a test website which you can go to that has just stock OSC 2.3 - http://zakzilla.com/ Now if you click on "hardware" category you will see it expands the sub-categories on the left side, but also displays the sub-categories in the main content area as shown in this screenshot with the red box - http://i.imgur.com/hwkaI0i.png (Direct link - http://zakzilla.com/index.php?cPath=1) Now if I login to my admin panel and add 1 single product to the "hardware" category that is NOT within a sub-category it will reformat the main content area to look like this - http://i.imgur.com/fxvJa7l.png So now does my question above make sense? On my live production site I have 100+ sub-categories and it clutters up the content area and I want to suppress the sub-categories from displaying in the main content area...as mentioned above the option to add a product that is not within a sub-category is not a feasible option with my supplier feed, I just gave that as an example that I'm aware you can do that to suppress all of those sub-categories to display but thats not an option for me. Please advise.
♥joli1811 Posted November 21, 2013 Posted November 21, 2013 Hi, I would be looking at this line of code in index.php /*///////////////////////////*/ <h1><?php echo $category['categories_name']; ?></h1> <div class="contentContainer"> <div class="contentText"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } $number_of_categories = tep_db_num_rows($categories_query); $rows = 0; while ($categories = tep_db_fetch_array($categories_query)) { $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories['categories_name'] . '</a></td>' . "\n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo ' </tr>' . "\n"; echo ' <tr>' . "\n"; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> /*///////////////////////////////////////////////////////////////////////////*/ and test with commenting out the lines you do not need maybe starting with // do nothing, go through the loop } else { // $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { // $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } Never tested so need to check what effects it has I was not using a standard left hand category box !!! Regards Joli To improve is to change; to be perfect is to change often.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.