Page 1 of 1

Good way to filter

Posted: 09 Nov 2017, 16:48
by Bevi
Laravel 2017.10

Hello sir, :)
I would like to make a filter to search words inside my description field.

Let's say I have a description field that says "blue silk socks" and I want to make a query that filter the word "socks."
What should I do to put a filtered word in an anchor?

I already have an anchor for the category "clothes"

Code: Select all

 <li><a class="btn btn-default"href="/list?f_name=clothes&f_catid=2">Clothes</a></li>
Now I want another anchor that does something like "/list?f_name=clothes&f_catid=2 and "socks" in field description"

I hope you understand what I wanna do.

Thanks in advance :D

Re: Good way to filter

Posted: 09 Nov 2017, 22:13
by aimeos
Use the "f_search" parameter like used in the input field of the full text search (catalog filter component, search subpart).
Here you can find all used parameter names: https://aimeos.org/docs/Developers/Html ... eter_names

Re: Good way to filter

Posted: 10 Nov 2017, 16:06
by Bevi
Ok, I made some anchors like

Code: Select all

<li><a class="btn btn-default"href="/list?f_search=socks">Socks</a></li>
It's working fine but the f_search content gets injected into the searchbar
Is there a way to clear the searchbar after clicking the anchor without losing the filtered content? :geek:

Re: Good way to filter

Posted: 12 Nov 2017, 11:29
by aimeos
You can overwrite this template and don't show the content of the f_search parameter:
https://github.com/aimeos/ai-client-htm ... lt.php#L10

Re: Good way to filter

Posted: 27 Nov 2017, 15:39
by Bevi
Hello again, Sir.
Is there a way to create sub-categories?

Let's say I have a category called "cars", and then I need 2 subcategories called "electric cars" and "essence cars."

If the client clicks on cars, he'll see both of the subcategories, if he clicks "electric cars" he'll only display electric cars.

I would like to handle these using anchors instead of many checkboxes.

Re: Good way to filter

Posted: 27 Nov 2017, 22:12
by aimeos
What does "anchors" vs. "checkboxes" mean?

You can configure showing products also from sub-categories in parent categories:
https://aimeos.org/docs/Configuration/C ... sts/levels

If you want to have more control, you can add your products to both categories (parent and child)