twstdroot Posted May 6, 2003 Posted May 6, 2003 I'm using the main categories module found here http://www.oscommerce.com/community/contri...ions,236/page,4 and would like to make it display more then 2 columns. Is there a way to do this? Quote
Guest Posted May 6, 2003 Posted May 6, 2003 in the includes/modules/main_categories.php file Find the code: if ($col> 1) { Change to: if ($col> 2) { Or whatever number you would like for the number of columns. If you want 3 columns use "2", if you want 4 columns use "3", etc. HTH Quote
glenda Posted July 3, 2003 Posted July 3, 2003 Hello, I'm using the Main Categories Contribution...MANY thanks to Gustavo A. Barreto A. for writing this contrib! http://www.oscommerce.com/community/contri...ions,236/page,4 I've got a lot of wasted space since some of my categories have many subcategories while others have none and the script puts two main categories per row. Anyone know how I can fix this problem? http://www.plazmaart.com/rocknroll/default.php (temp addy) Quote Mary
twstdroot Posted July 3, 2003 Author Posted July 3, 2003 do you want to remove the sub-categories entirely from the 2 column layout? if so, you should be able to edit the modules PHP to remove the portion that builds the sub-categories pretty easily. I haven't looked at the code so I can't tell you exactly which lines. Quote
glenda Posted July 3, 2003 Posted July 3, 2003 I'm sorry I removed the dynamic Main Categories... that's just plain html on my default page. This is the result I get when I use the dynamic categories: Category 1___________________ Subcat 1.1 Subcat 1.2 Subcat 1.3 Category 3___________________ _____________________________Subcat 4.1 _____________________________Subcat 4.2 _____________________________Subcat 4.3 _____________________________Subcat 4.4 _____________________________Subcat 4.5 Category 5___________________ So you can see the wasted space I'm talking about. Is there any way to get the categories/subcategories to display the way I have them on my default page? Thank you! Quote Mary
azer Posted July 23, 2003 Posted July 23, 2003 i have a changed code for the contribution given by some member and i dont know how to : 1. make 3 columns or more 2. change the size of the pictures to a defined size : <?php /* $Id: main_categories.php,v 1.0a 2002/08/01 10:37:00 Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com/ Copyright (c) 2002 Barreto Gustavo Barreto <[email protected]> http://www.barreto.net/ Based on: all_categories.php Ver. 1.6 by Christian Lescuyer History: 1.0 Creation 1.0a Correction: Extra Carriage Returns Released under the GNU General Public License */ // Preorder tree traversal function preorder($cid, $level, $foo, $cpath) { global $categories_string, $HTTP_GET_VARS; // Display link if ($cid != 0) { for ($i=0; $i<$level; $i++) $categories_string .= ' '; $categories_string .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath =' . $cpath . $cid) . '">'; // 1.6 Are we on the "path" to selected category? $bold = strstr($HTTP_GET_VARS['cPath'], $cpath . $cid . '_') || $HTTP_GET_VARS['cPath'] == $cpath . $cid; // 1.6 If yes, use <b> if ($bold) $categories_string .= '<b>'; $categories_string .= $foo[$cid]['name']; if ($bold) $categories_string .= '</b>'; $categories_string .= '</a>'; // 1.4 SHOW_COUNTS is 'true' or 'false', not true or false if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($cid); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; } // Traverse category tree foreach ($foo as $key => $value) { if ($foo[$key]['parent'] == $cid) { // print "$key, $level, $cid, $cpath<br>"; preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : '')) ; } } } ?> <!-- main_categories //--> <table width=100% border=0><tr> <?php ////////// // Get categories list ////////// // 1.2 Test for presence of status field for compatibility with older versions $status = tep_db_num_rows(tep_db_query('describe categories status')); $query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id"; // 1.3 Can't have 'where' in an if statement! if ($status >0) $query.= " and c.status = '1'"; $query.= " and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"; $categories_query = tep_db_query($query); // Initiate tree traverse $categories_string = ''; preorder(0, 0, $foo, ''); ////////// // Display box contents ////////// $info_box_contents = array(); $row = 0; while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['parent_id'] == 0) { $cPath_new = tep_get_path($categories['categories_id']); $text_subcategories = ''; $subcategories_query = tep_db_query($query); while ($subcategories = tep_db_fetch_array($subcategories_query)) { if ($subcategories['parent_id'] == $categories['categories_id']) { $cPath_new_sub = "cPath=" . $categories['categories_id'] . "_" . $subcategories['categories_id']; $text_subcategories .= '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '">' . $subcategories['categories_name'] . ',</a> ' . " "; } // if } // While Interno $row++; //azer pr ligne modifiee category_big_image par categories_image echo '<td valign=top width=100><a href="' . tep_href_link (FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name']) . '</a></td><td valign=top width=50% class="smallText"><font size=-1><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '"><b>' . $categories['categories_name'] . '</b></a></font><br><font size=-2>' . $text_subcategories; if ((($row / 2) == floor($row / 2))) { ?> </tr> <tr> <td colspan=6><img src="images/dot.gif" width=5 height=5></td> </tr> <?php } } } ?> </tr></table> <!-- main_categories_eof //--> any advice will be good :wink: Quote MS2
azer Posted July 23, 2003 Posted July 23, 2003 self answer : for the first question i had to change if ((($row / 2) == floor($row / 2))) { by if ((($row / 3) == floor($row / 3))) { Quote MS2
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.