I am working on a brand filter. When I change the brand name from dropdown, I am not getting anything; it seems that no event was triggered.
Below is my code:
<select onchange="location.href=[server.url type='fullpage' query='sort=price&brand=$brand']">
<?php
$brands = dfr_get_brands_list($category);
foreach ($brands as $brand) : ?>
<option><?php echo $brand; ?></option>
<?php endforeach; ?>
</select>
[server.url type='fullpage' query=''] returns the full URL of the current page, for example: http://www.mysite.com/store/category/shoes/.
You can not mix JavaScript and PHP. JavaScript runs on the client, PHP runs on the server, they can not run together.
Break the logic out of the HTML tag and make a function, call that function onchange. Cleans up the code so it is easier to read and maintain.
What you need to do is to change the code to add the brand dynamically to the end of the url