osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Subcategory Alignment

This is a discussion on Subcategory Alignment within the osCMax v1.7 Discussion forums, part of the osCMax v1.7 Forums category; Please could somebody advise how to adjust the alignment of submenus in the categories box so that main subs and ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 10-27-2006, 02:38 AM
Member
 
Join Date: Jun 2004
Location: UK
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
fuzzyphil
Default Subcategory Alignment

Please could somebody advise how to adjust the alignment of submenus in the categories box so that main subs and nested subs all line up vertically.

I have had to modify my categories.php code to get the look I want however I cannot find any reference to the alignment anywhere.

My modified Subcategory code is included below in case anyone wants to see how I did it. If what you see looks wrong, or could have a detrimental effect elsewhere that I haven't picked up on yet, then please let me know. I am not an expert coder.

Found in includes/boxes/categories.php

-------------------------------------------------------------------------
<tr><td background=images/m07.gif width=211 height=30><span style="padding-left: 10px"></span><span class=ch5>Browse by category</span></td></tr>
<? // ---- CATEGORIES

function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

if(!$tree[$counter]['level']){

$categories_string .= $categories_string ? '' : '';

$categories_string .= '<tr><td background=images/m08a.gif width=150 height=20><span class=ch6></span><a class=ml3 href=';

if ($tree[$counter]['parent'] == 0) {
$cPath_new = 'cPath=' . $counter;
} else {
$cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display categry name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></td></tr> ';

}else{ // SUBCATEGORY

$categories_string .= '<tr><td background=images/m08a.gif width=150 height=20><span class=ch6></span>         ';

for($i=0;$i<$tree[$counter]['le vel'];$i++)
$categories_string .= '    &nbsp ;';

$categories_string .= '    <a class=ml3 style="font-weight:normal;" href=';
if ($tree[$counter]['parent'] == 0) {
$cPath_new = 'cPath=' . $counter;
} else {
$cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>-';
// display category name
$categories_string .= $tree[$counter]['name'];
$categories_string .= '</a></td></tr>';
}

if ($tree[$counter]['next_id'] != false) {
tep_show_category($tree[$counter]['next_id']);
}
}



define(TABLE_CATEGORIES, "categories");
define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");
$categories_string = '';
$tree = array();

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
while ($categories = tep_db_fetch_array($categories_query)) {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
'parent' => $categories['parent_id'],
'level' => 0,
'path' => $categories['categories_id'],
'next_id' => false);

if (isset($parent_id)) {
$tree[$parent_id]['next_id'] = $categories['categories_id'];
}

$parent_id = $categories['categories_id'];

if (!isset($first_element)) {
$first_element = $categories['categories_id'];
}
}

//------------------------
if ($cPath) {
$new_path = '';
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
unset($parent_id);
unset($first_id);
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
if (tep_db_num_rows($categories_query)) {
$new_path .= $value;
while ($row = tep_db_fetch_array($categories_query)) {
$tree[$row['categories_id']] = array('name' => $row['categories_name'],
'parent' => $row['parent_id'],
'level' => $key+1,
'path' => $new_path . '_' . $row['categories_id'],
'next_id' => false);

if (isset($parent_id)) {
$tree[$parent_id]['next_id'] = $row['categories_id'];
}

$parent_id = $row['categories_id'];

if (!isset($first_id)) {
$first_id = $row['categories_id'];
}

$last_id = $row['categories_id'];
}
$tree[$last_id]['next_id'] = $tree[$value]['next_id'];
$tree[$value]['next_id'] = $first_id;
$new_path .= '_';
} else {
break;
}
}
}
$categories_string .= '';
tep_show_category($first_element);
$categories_string .= '';

echo $categories_string;
?>

------------------------------------------------------------------------
This is a snapshot of what it looks like at the moment:

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread



Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
table alignment bibleman osCMax v2 Customization/Mods 5 07-30-2005 12:10 PM
alignment problem matty102 osCMax v1.7 Discussion 2 03-16-2005 10:43 AM
right column alignment issues homeless osCommerce 2.2 Modification Help 1 03-10-2004 08:11 AM
Box content alignment ajax osCommerce 2.2 Modification Help 0 09-28-2003 06:45 PM
Page alignment disorder! mskitti osCommerce 2.2 Installation Help 0 09-27-2003 05:40 PM


All times are GMT -8. The time now is 03:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2008 osCMax