Re: [ht1080z] Category filter by another table
Hi,
I took a look at your code. If I understand it correctly, if your page has returned products, you want to display them. If not, you want to display the records from "$cat1Records". I did notice this in your code:
<?php if ($cat1Record['_isSelected'] || $cat1Record['_isDescendantSelected']): ?>
<a href="<?php echo $cat1Record['_link'] ?>"><?php if($cat1Record['name']) echo $cat1Record['name']; else echo $cat1Record['name']; ?></a>
<?php else: ?>
<a href="<?php echo $cat1Record['_link'] ?>"><?php if($cat1Record['name']) echo $cat1Record['name']; else echo $cat1Record['name']; ?></a>
<?php endif; ?>
In this code, you are outputting a category link regardless of whether that record is part of the selected category branch or not. If you want to only output categories if they're selected or their children are selected, try this:
<?php if ($cat1Record['_isSelected'] || $cat1Record['_isDescendantSelected']): ?>
<a href="<?php echo $cat1Record['_link'] ?>"><?php if($cat1Record['name']) echo $cat1Record['name']; else echo $cat1Record['name']; ?></a>
<?php endif; ?>
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/