Support » Plugin: Advanced AJAX Product Filters » Preset filters are being removed

  • Resolved steves_co

    (@steves_co)


    Hi,

    Currently the above link has a preset filter which is &filters=product_cat[6288], denoting a product category within WordPress which I have built from the back-end. This is working correctly and the result is as expected – all products within that category are shown on this page.

    However, when setting a category from the product filters from the sidebar, such as Skin Types > Dry for example the filtering set before as filters=product_cat[6288] is overridden by &filters=skin-types[6658]. The products that are shown on this new page has some products that should be in the category, however since the first filter is not being applied, some products are still being shown (not falling under product_cat 6288)

    My goal is to get them together with a pipe ‘|’ since I know that the final result within that part should look like &filters=product_cat[6288]|skin-types[6658] for it to work correctly. However on clicking and setting the category, the preset filter is being removed and technically overriden.

    Is there any way I can achieve the pipe ‘|’ functionality successfully? Can be either through code or from the plugin setup.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Dima Holovnia

    (@dholovnia)

    Hi,

    Let me explain you how it is working and you will understand how to make it work.

    When applying some filter script is getting all selected filters on the page, removing current filters from the url and creating new url with selected filters.

    As you can see your page don’t have product_cat filter. As a result on step of gathering selected filter values for the url it cannot take category as there is no such filter.

    It is easy to solve it. Create category filter and add it to the page. Hide it with custom CSS. Users will not see it and filters will.

    Regards,
    Dima

    steves_co

    (@steves_co)

    Hi Dima,

    Thanks for your reply.

    I have tried this but with no success. The product_cat filter returns only one filter which would be pre-selected, however in the case of the above link provided in my question, the product_cat which would be pre-selected is the brand page (Payot) and not product_cat[6295]. This is incorrect in my case since we would be already in the brand page and we would need the product_cat to be selected as 6295(sunscreen) for the filtering to have an effect within those two arguments (brand + product_cat).

    I have tried this also the other way round, where the link operates by the sub category instead of the brand and then the brand is linked as per brand filter, however the same issue arises where I cannot link both brand and product_cat in conjunction.

    I have also tried inserting some Javascript code within the Advanced Ajax Product Filter where it reads the url and with some regex inserts the value within the url and reloads the page with window.location.href. However this is reloading twice: first the page container with products due to ajax reload and second the whole page. Twice reloading is not the way to do since it doesn’t seem nice at all.

    Any other tips than the above, I will keep trying to make this work meanwhile however I feel like I am stuck in a dead-end at the moment.

    Thanks 🙂

    steves_co

    (@steves_co)

    Hi Dima,

    To explain better the above, this is an image of what I obtained when inserting the product category filter: https://ibb.co/89CVn57 . The selection there should not be the brand but product_cat[6295] in this case Sunscreen.

    Thanks 🙂

    Plugin Author Dima Holovnia

    (@dholovnia)

    Hi,

    Sorry but it still doesn’t help.

    https://franks.com.mt/product-category/brands/payot/?bpage=products&cat_id=6288&filters=product_cat%5B6288%5D
    Why opening with pre-set filter product_cat[6288] it should select product_cat[6295]?

    Please describe it in a bit another way.
    1. What did you make already?
    2. What you expected to get?
    3. What did you get?

    Right now I don’t understand what is the problem with so ofc cannot help you.

    Regards,
    Dima

    steves_co

    (@steves_co)

    Hi Dima

    Nevermind, I have managed to solve it. I was doing a small mistake on my local server which when deployed live left the result required.

    Thanks for your help and brainstorming, I appreciate it 🙂

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.