close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

dropdown filter

Thread began 1/16/2017 1:40 pm by Jamie | Last modified 1/23/2017 3:10 pm by Ray Borduin | 172 views | 7 replies |

Jamie

dropdown filter

hey Ray

On the attached page the default results returned are listed by category (mens, womens or childrens at the moment) from the productcategories table

I want to allow the user to then filter using the dropdown based on brand name (from the productmanufacturers table) so that it will show only mens, for example and then by brand name.

How wouold I do this with the RS and search/filter o sort?

Thanks

Sign in to reply to this post

Ray BorduinWebAssist

If you give the list a name you should be able to check for that list name as a trigger and define a filter for the recordset. Where are you getting stuck?

Sign in to reply to this post

Jamie

  Where are you getting stuck?  



these bits:

  check for that list name as a trigger and define a filter for the recordset  
Sign in to reply to this post

Ray BorduinWebAssist

Currently your list uses the code:

<select class="select filterBy">

It will need a name attribute to refer to it after submit.

Something like:
<select class="select filterBy" name="filterBy">

Then you can use the $_POST['flterBy'] value in an IF statement and in the search code to do the filter.

Sign in to reply to this post

Jamie

OK, have tried setting the search up using:

<?php

$searchProducts_1 = new WA_MySQLi_Search("Categories","");

if ((isset($_GET["WADbSearch1"])) && ($_GET["WADbSearch1"] != "")) {
$searchProducts_1->clearSearch();
$searchProducts_1->setSearch(array("type"=>"k","comparison"=>"like", "and"=>" "), array("ManufacturerName"), "c", "".((isset($_POST["FilterBrand"]))?$_GET["FilterBrand"]:"") ."");
}
?>
<?php
if ((isset($_GET["FilterBrand"])) && ($_GET["FilterBrand"] === "")) {
$searchProducts_1->clearSearch();
$searchProducts_1->setSearch(array("type"=>"v","comparison"=>"="), array("ProductSKU"), "s", "donotshowresults");
}
?>
<?php
@session_start();
if (isset($_GET['FilterBrand'])) {
$_SESSION["FilterBrand"] = $_GET['FilterBrand'];
}
?>



but a) it stops the unfiltered results from showing
and
b) the dropdown doesnt do anything

have atatched the page

Sign in to reply to this post

Ray BorduinWebAssist

Your form action is set to POST and you are using GET in your trigger and filter code. Those would have to match.

Sign in to reply to this post

Jamie

ok am getting there....

I have added a submit button to trigger the option but

1) how do I get it to trigger without the button
2) no results are being returned

fresh version of the page attached

Sign in to reply to this post

Ray BorduinWebAssist

You can use javascript and the onchange event of the list to automatically submit the form and then trigger off the select list itself instead of the button.

You will have to debug the search returning no results. Maybe dump the recordset to the body of the page above the results and see what the final query is and see if you can spot the problem:

var_dump($RecordsetName);

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...