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)

Hi Chris,

Actually, I have just noticed that your code is working when there are other children:

e.g. http://www.melbournelaserclinic.com.au/skin-treatment.php?About-Acne-Skin-Care-Advice-3

But is not working (i.e. shows all categories and children) when the category has no children:

e.g. http://www.melbournelaserclinic.com.au/skin-treatment.php?Birthmarks-7

Page is attached below:
Attachments:

skin-treatment.php 6K

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

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
Thanks mate - worked a treat.