Support » Plugin: Advanced AJAX Product Filters » Refresh URL when filtering for selected filters

  • Hi,
    I am trying to update the URL when the customer filters the products. I found the option to enable the “Refresh URL” at the backend and tried this. But I found that this will enable the URL update for all filters I made using this plugin. I don’t want that.
    I have filters for Brands, Models, Conditions and Prices. I have added filters on the shop page for Brand and Condition.

    My shop page URL is “mywebsite.com/shop/” and I need to update the URL to show “mywebsite.com/shop/hp” if the user selects “HP” from the filter for brands, but if the user filters using the filter for condition URL should not be updated.

    Similarly, the page “mywebsite.com/shop/hp” will load all the products under the brand “HP” and on this page, I have a filter for filtering models. For eg, I have models “EliteBook”, “Pavilion” etc. and if I select EliteBook, the URL needs to be updated to “mywebsite.com/shop/hp/elitebook”
    Here EliteBook is not a product, it is a product category.

    My Product URL is “mywebsite.com/shop/hp/elitebook/elitebook-8460p/” where “EliteBook 8470P” is a product.

    Is it possible to update the URLs like the above condition?
    Could you please help me to tackle this situation?

    Thanks in advance.

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

    (@dholovnia)

    Hi,

    This cannot be done with the filters.

    You need to use categories. So ‘HP’ will be one of the parent categories, ‘EliteBook’ sub-category of ‘HP’. Instead of the filters you can use just WooCommerce default categories widget. To remove product_cat from the url you can use plugin eg https://wordpress.org/plugins/permalink-manager-for-woocommerce/

    Regards,
    Dmytro

    Thread Starter noobieboy

    (@noobieboy)

    Hi @dholovnia,
    Thanks for the quick reply.

    Is there any workaround for this?
    Here I have added a custom function to update the URL, but when I click the filter for the second time, the filter does not work.
    My code changes “mywebsite.com/shop/” to “mywebsite.com/shop/hp/”. But if I try to filter products under “Dell”, it will show “No products found”. When I checked the network tab, the filter function is calling a URL mywebsite.com/shop/hp/?filters=berocket_brand[dell] instead of mywebsite.com/shop/?filters=berocket_brand[dell].

    Will it be possible to make a workaround like this?

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    Hi,

    ‘I have added a custom function to update the URL’ so you need to add a support to our plugin to support your code =) It is not only about to update an url but and explain our filters where they are now and what they should do.

    Best way how to make it I provided above. If you want to add custom code to change how our plugin works it is up to you. But we are not providing support for custom code.

    Regards,
    Dmytro

    Thread Starter noobieboy

    (@noobieboy)

    Once again thank you.
    I’m not sure whether you misunderstood or not, my custom function didn’t touch any of your plugin files. It was a simple ajax function to get the brand slug. I just wanted to check whether there is any way to skip the brand name while filtering the products for the second or third time.

    One last question. Will it be possible to add the same filter as I said, if I change my brands to parent categories instead of “berocket_brand” like you suggested above?

    Appreciate your time.
    Thank you.

    • This reply was modified 1 year, 10 months ago by noobieboy.
    Plugin Author RazyRx

    (@razyrx)

    Hello,

    Plugin use link that page has on filtering.
    If you use JavaScript code to change page link from mywebsite.com/shop/ to mywebsite.com/shop/hp/, then after this plugin will use mywebsite.com/shop/hp/

    Regards,
    Oleg

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Refresh URL when filtering for selected filters’ is closed to new replies.