show similar children links from Category Section at foot of page

15 posts by 3 authors in: Forums > CMS Builder
Last Post: February 9, 2010   (RSS)

Re: [benedict] show similar children links from Category Section at foot of page

By Chris - December 15, 2009

Hi Benedict,

After browsing through your site, I think I may have figured out what you want to achieve. I'm not sure if I have this right, so please let me know if not:

If a user is viewing a top-level category (e.g. "Facial Ageing"), you want to list its child categories as related. If a user is viewing a second-level category (e.g. "Cheek Enhancement"), you want to list the child categories of the parent category.

If that's true, replace the "rootCategoryNum" line with the following:

'rootCategoryNum' => ( $category['parentNum'] ? $category['parentNum'] : $category['num'] ),

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

By benedict - February 8, 2010

Hi Chris,

Yes, that worked a treat. Thanks very much.

There is one last thing I want to achieve here and that is remove the active item from the presented list.

So if the user has chosen "acne scarring", the related items would show all related items but not acne scarring itself ( as the user is already at that page).

Thanks in advance.

Re: [benedict] show similar children links from Category Section at foot of page

By Chris - February 9, 2010

Hi benedict,

To skip the current category when listing your related categories, add the line in red below:

<?php foreach ($relatedCategoryRecords as $record): ?>
<?php if ($record['num'] == $category['num']) { continue; } ?>


I hope this helps! Please let me know if you have any questions.
All the best,
Chris

By benedict - February 9, 2010

Thanks mate - worked a treat.