PDA

View Full Version : Displaying Categories in Columns


Jamie
October 27th, 2004, 08:52 PM
In version 1.5.0, you can display sub categories below the category detail in as many columns as you like. We will be adding support in the future to do the same for categories at the top level. If you need to accomplish this before the next release (1.6?) then follow the steps below:

1. Please make sure you know how to modify template files. It is explained in the documentation: http://www.squirrelcart.com/help. Do not modify these template files directly inside the squirrelcart/themes/squirrelcart folder! That would be very very bad! :eek:

2. Add the following to the bottom of the "show_categories_header.php" template:
<table><tr>

3. Add the following to the top of "show_category_detail.php"
<td valign="top">

4. Replace the contents of "show_category_detail_seperator.php" (yes, we know "seperator" is misspelled! :rolleyes: )
<?php
// workaround to put categories in columns

// set the variable below to the number of categories you want per row
$cats_per_row = 2;

// if counter not set, start it at one
if (!$GLOBALS['cat_count']) $GLOBALS['cat_count'] = 1;

// close the category that was just shown
print '</td>';

// if the cats per row has been met, reset the counter, and close out the row
if ($GLOBALS['cat_count'] == $cats_per_row) {
$GLOBALS['cat_count'] = 1;
print "</tr><tr>";
} else {

// increment the counter
$GLOBALS['cat_count']++;
}
?>Change the number to the right of $cats_per_row to the number of columns you want.


5. Replace the contents of the "show_categories_footer.php" template with the following:
<!--
Template file: show_categories_footer
This file controls the appearance of the bottom of the Category Detail section in home.php
-->

<?php
print '</td>'; // close out the last category shown

// code to close out any left over table cells
while($GLOBALS['cat_count'] < $cats_per_row) {
print '<td></td>';
$GLOBALS['cat_count']++;
}

print '</tr></table>';
?>

THE END

-Jamie

sonjiab
August 12th, 2006, 02:39 PM
Hi Jamie,

Ias there a work around like this thread for version 2.3.2?

Jamie
August 16th, 2006, 11:46 AM
Hi,

Unfortunately, we don't have a workaround to do this in newer versions.

sonjiab
August 16th, 2006, 05:58 PM
its really needed, I won't be able to use the upgrade I just bought, I assumed that we wouldn't devolve so to speak

Rich
August 18th, 2006, 11:35 AM
It is documented that the themes used within v1.x.x are not compatible with v2.x.x. Since the above modifications are intended for a v1.x.x template file, they will not work in v2.x.x.

We have not revisited this forum post to determine the exact changes that are needed to achieve the same layout in v2.x.x. We will be updating posts such as this one as time permits.