• Resolved mozdt

    (@mozdt)


    I’m having a problem with Search & Filter using woocommerce.

    In Woocommerce I have my categories set up and a ‘designer’ attribute for the clothing designers name (there are only two designers at the moment). I’m using the following code:

    [searchandfilter fields="product_cat,pa_designer" types="menu,checkbox" operators=",or,and" ]

    When selecting a category from the dropdown menu and one of the names it works as expected. If I select a category without selecting a designer it brings all the products back as a result – fine.

    However, if I leave the category as ‘All Product Categories’ with no designers selected, instead of returning everything I get a ‘No content matched your criteria’.

    If I do this again but select just one of the two designers it gets a ‘404 Page not found’.

    If I do it again but this time select both designers it brings all the results.

    So, everything works as expected when a category is chosen but not when the category is left as ‘All Product Categories’.

    Any idea what the problem is?

    https://www.ads-software.com/plugins/search-filter/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt, I’m not sure what the issue is exactly but I’m doing some woocommerce dev at the moment so will give this a test in the next few days and come back to you ??

    Thread Starter mozdt

    (@mozdt)

    That would be great, thanks!

    Thread Starter mozdt

    (@mozdt)

    P.S. is there any way to change the default ‘All…’ dropdown (i.e. ‘All Categories’) so that you can choose to put a custom ‘Select a category’, ‘Select a designer’ etc instead?

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt

    There is some undocumented functionality (I haven’t had time to update the docs yet) which allows you to do this – all_items_labels

    Use like:

    [searchandfilter fields="search,post_tag,category" all_items_labels=",All Tags,All Categories"]

    ??

    Thread Starter mozdt

    (@mozdt)

    Absolutely. Brilliant.

    That solves the problem for this specific site – I’ll just use all_items_labels=”Select a category…,Select a designer…”

    Thanks again!

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt, I’ve managed to have a look at this… I don’t actually use the plugin with Woocommerce but just been testing now…

    So basically, you have product categories, and when you don’t select one (ie “all product categories”) you don’t get the products page?

    If this is the case I think its an easy fix…

    The way the plugin works is to append all the search terms to the url, but when you don’t select anything (ie “all”) the url is basically blank and defaults to your homepage or some other unwanted template…

    What happens if you do a blank search, and then add

    ?post_type=product
    //or
    &post_type=product

    to your URL?

    Does that bring you to the default shop page (ie with a blanks search)?

    If so… I can do a quick update and add a parameter to the shortocde to specify if it is a woocommerce widget which will then add “post_type=product” to blank searches ??

    Thread Starter mozdt

    (@mozdt)

    Okay, just done some tests.

    A blank search at the moment is this:

    https://localhost/devsite/?s=

    Which results in ‘Sorry, no content matched your criteria.’.

    If I change it to this:

    https://localhost/devsite/?post_type=product

    or this:

    https://localhost/devsite/?s=&post_type=product

    I get all categories displayed. ??

    But, if I do a search for ‘designer 1’ and leave the category as ‘select a category’, at the moment I get this:

    https://localhost/devsite/designer/designer-1/

    And an error 404 page. Adding either pieces of code to the above url still results in a 404 error.

    So, if I add the code and leave everything blank it works, but not when leaving the category blank and selecting a designer.

    Hope that makes sense!

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt, yeah that makes sense

    Would you be able to show me what the URL looks like when searching by designer and leaving the product category blank (and returning the actual search results you wanted)?

    Would it be something like

    https://localhost/devsite/designer/designer-1/?post_type=product

    or

    https://localhost/devsite/shop/?designer=designer-1

    or any other URL that works would really help ??

    Thanks

    Thread Starter mozdt

    (@mozdt)

    No problem.

    First, this is the url if I leave category blank and the designer blank:

    https://localhost/devsite/?s=

    That gives me ‘Sorry, no content matched your criteria.’.

    Next, searching a category (in this case ‘accessories’) and leaving the designer blank I get this url:

    https://localhost/devsite/?product_cat=accessories

    That returns all the products in that category.

    Now, if I search the same category for ‘designer 1’ I get this url:

    https://localhost/devsite/?product_cat=accessories&pa_designer=designer-1

    That shows the products only for ‘designer 1’ in ‘accessories’.

    Next, I leave the categories blank with just ‘designer 1’ selected – this is the url:

    https://localhost/devsite/designer/designer-1/

    That gives me a 404 error, as does searching just for ‘designer 2’.

    I’ve tried adding…

    ?s=&post_type=product

    and

    ?post_type=product

    to the url but no dice – I just get a ‘404 page not found’ error.

    Does that make sense?

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt

    What happens when you go to this URL

    https://localhost/devsite/designer/designer-1/?post_type=product

    ?

    Thread Starter mozdt

    (@mozdt)

    I get this error:

    Not found, error 404
    The page you are looking for no longer exists. Perhaps you can return back to the site’s homepage and see if you can find what you are looking for. Or, you can try finding it by using the search form below.

    I’ve also just tried this:

    https://localhost/devsite/designer/designer-1/?s=&post_type=product

    But get the same error.

    If its any help, just clicking on an ordinary category (in this case, accessories) from the homepage gives this url:

    https://localhost/devsite/?dppage=1&product_cat=accessories

    Plugin Author DesignsAndCode

    (@designsandcode)

    Cool thanks will try to look at again in the next couple of days ??

    Thread Starter mozdt

    (@mozdt)

    No problem, happy to help (and thanks for helping). ??

    Plugin Author DesignsAndCode

    (@designsandcode)

    Hey mozdt haven’t forgotten about you ?? going to look in the next couple of days – I’m keen to get this working with woocommerce!

    Thread Starter mozdt

    (@mozdt)

    No problem mate, didn’t want to harass you constantly as its something I can sort of work around for the time being but I’d be interested in testing any beta builds if you want – just shout. ??

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘'All Product Categories' searches not working as expected’ is closed to new replies.