realbig / theme_pmwoodwinds

1 stars 0 forks source link

Sometimes Used/New/All does not work correctly #31

Closed d4mation closed 5 years ago

d4mation commented 5 years ago

Bug Report

What's the issue you encountered?

Sometimes Used/New/All does not work correctly

Have you hard-refreshed your Browser? (Control+F5 on a PC, CMD+Shift+R on a Mac)

Yes

How can the issue be reproduced?

Click around the page. Try using pagination and swapping between Used/New. Eventually I was able to reproduce and it no longer updated the URL bar properly.

Link to the page in question:

http://pmwoodwind.wpengine.com/products/instruments/

What does your environment look like?

BigActual commented 5 years ago

How was this resolved?

d4mation commented 5 years ago

The hidden select field would remove options for "New" or "Used" if there were no matching results for the currently chosen Filters. This made it so that the "New" and "Used" links at the top of the page would try to change the hidden select field to a value that did not exist. So, I added some JavaScript to force-add the options to the hidden select field if they did not exist, thereby fixing the functionality.

FacetWP does not have a way to turn that functionality for Select fields, so this workaround was necessary.

Descriptive Commit Message and code can be found here: https://github.com/realbig/theme_pmwoodwinds/commit/6066383d1c3998dfce96e5c7ec32899be2f3193c