superspeedyplugins / issue-tracker

Submit bugs and feature requests for any of our plugins
0 stars 0 forks source link

SSF URL parameter name renaming is not being accepted in the hasUsableFilters function (and maybe others), and slugs not being read #171

Open dhilditch opened 1 month ago

dhilditch commented 1 month ago

There is a setting which gets saved and is configurable for the admin page where users can rename their URL parameters, e.g. they can change ?pa_manufacturer=190 to ?manufacturer=190.

Similarly, there is a setting to use slugs instead of IDs, so e.g. they can have ?pa_manufacturer=adidas or ?manufacturer=adidas and instead of 190 (the term id), they lookup adidas with the slug and find the term id.

Please check and fix these issues in the class-fww-link.php file.

dhilditch commented 1 month ago

To replicate, create an atribute which does not have archives enabled. You can disable archives from Products > Attributes > {Attribute Name} [edit] > Enable Archives - uncheck this to disable archives and then that attribute will use a URL parameter.

Then visit settings > ssf > and choose a name for an attribute, e.g. change pa_manufacturer to manufacturer.

Similarly, change the parameter to use a slug rather than an ID.

Now, from the /shop/ page enable that attribute to end up on a URL like /?manufacturer=adidas - you'll see the shop does not get filtered.

This seems to currently happen because of the $pm->hasUsableFilters() not checking the aliases (pa_manufacturer = manufacturer) and/or not knowing the alias of adidas to 123 etc, but please follow the code through. It seems like generating these URLs from getPermaLink() in that class is working, so there's code there you can follow to see how the URLs are generated and that should help in ensuring they get deconstructed properly.

Glynnage commented 1 month ago

I can't break this.

Started with adding a whole new attribute and going through the repro steps and no issue. Tried also on already existing attribute and no issue there either.

I would like to know @dhilditch settings to see our differences.

hmkayani commented 1 week ago

@dhilditch same here. i am unable replicate it at my end too. followed the exact steps you shared above.