group sub categories

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 18, 2008   (RSS)

I am trying to display "sub categories" grouped on a page like this:

Main category title
Sub category 1 title
- product thumbnail
- product thumbnail
- product thumbnail
Sub category 2 title
- product thumbnail
- product thumbnail
- product thumbnail

I have a list field set up as 'sub_category' in the 'products' section.
How can I group the sub category products on the main category page?

Re: [Dave] group sub categories

Hi Dave,
This is what I have for the viewer and it just repeats. I need $record['sub_category'] as the title, then the thumbnails listed below.

<?php foreach ($productsRecords as $record): ?>

<div class="prod_title"><?php echo $record['sub_category'] ?> <?php echo $record['category'] ?></div>

<?php foreach ($record['product_image'] as $upload): ?>
<div class="prodlist"><a href="<?php echo $record['_link'] ?>&category=Sinks"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $record['productName'] ?>" border="0" /></a><br/>
<?php echo $record['model'] ?></div>
<?php endforeach ?>

<?php endforeach; ?>

Re: [IronVictory] group sub categories

By Dave - July 18, 2008

What is it repeating? Is it sorting the subgroup items together, though?

Do you have an url that you can post? Let me know some more details and I'll try and help! :)
Dave Edis - Senior Developer
interactivetools.com