In response to: [url "http://www.interactivetools.com/forum/forum-posts.php?postNum=2236729#post2236729"]Filtering by category from a detail page[/url], ...
Hi Jerry
I am trying to follow your instructions on the above thread and the cmsbcookbook, but I am unable to get things to work as desired. When the search form is submitted the page refreshes but the results do not change on the list page. No errors are recorded in the error log.
I am guessing that there could be a couple of issues:
1. Your code is for a detail page. I am using this code with a category menu. (When using a category menu I am not really sure how to differentiate between what is a 'list page' and what is a 'detail page'.)
2. I am guessing that maybe that <form>… </form> needs to envelope <section id="pinboot">… </section>
For your reference my roomtags are "Kitchen, Bathroom, Bedroom". I would like the default view of the page to be a list of pages where the $categoryRecord['parentNum'] == $page['num'] (this part of the code works). I would then like the website user to be able to further filter this results where:
$categoryRecord['parentNum'] == $page['num'] AND roomtag=kitchen
or
$categoryRecord['parentNum'] == $page['num'] AND roomtag=bathroom
or
$categoryRecord['parentNum'] == $page['num'] AND roomtag=bedroom
Here is my code:
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<select name = "roomtag_match" >
<option value="">Please Choose a Category</option>
<?php foreach (getListOptions('iw_pages', 'roomtag') as $value => $label): ?>
<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['roomtag']);?>>
<?php echo $label; ?></option>
<?php endforeach ?>
</select>
<input type="submit" name="submit" value="Search" >
</form>
<section id="pinBoot">
<?php foreach ($iw_pagesRecords as $categoryRecord): ?>
<?php if($categoryRecord['parentNum'] == $page['num']): ?>
<article class="white-panel">
<?php foreach ($categoryRecord['photos'] as $index => $upload): ?>
<img src="<?php echo $upload['thumbUrlPath2'] ?>" width="100%" title="<?php echo htmlspecialchars($upload['info1']) ?>" alt="<?php echo htmlspecialchars($upload['info1']) ?>" />
<?php break; ?>
<?php endforeach ?>
<h4><?php echo htmlencode($categoryRecord['name']) ?></h4>
<p><?php echo htmlencode($categoryRecord['short_description']) ?></p>
<a href="<?php echo $categoryRecord['_link'] ?>">Read more…</a>
</article>
<?php endif ?>
<?php endforeach; ?>
</section>
Thanks
Jeff