Filters aren't resetting correctly

  • Posts: 13
  • Thank you received: 0
1 year 8 months ago #300237

-- HikaShop version -- : 4
-- Joomla version -- : 3.8.13
-- PHP version -- : 7.0.30

Greetings.

I'm currently creating a series of filters for a product page that are displayed in a module (01_normal.png). At first they seem to work with no problems, products related with the selected filter are shown (02_filter selected.png). However, when I try to remove a filter by clicking in the "delete" button, the page reloads but the module doesn't show all the filter options again, instead only the delete button appears (03_filter cleared.png).

The only way to display them again is by selecting other filter module or clicking the "Filtro" button. Nor Joomla or the server's error log show any issue.

I attach some images of the problem and the setting that I'm using for the filters and the modules.

Last edit: 1 year 8 months ago by HALVAM. Reason: Adding extra details

Please Log in or Create an account to join the conversation.

  • Posts: 70149
  • Thank you received: 10504
  • MODERATOR
1 year 8 months ago #300260

Hi,

You should turn off the "deletable" setting of the filter and that should help.

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
1 year 8 months ago #300340

I think i found the problem in code used in the onclick attribute of the delete button:

document.getElementById('filter_Laboratorios_CFM_4_module_226').value=' '; document.forms['hikashop_filter_form_module_226'].submit();return false;

There is a whitespace between the apostrophes in value=' ' that is causing the filters don't reset correctly. If I change the code using an inspector tool and remove the whitespace, the filter resets normally.

I looked for any category that lacks a name, both in Joomla's backend and in phpMyAdmin but i haven't found anything.

As a temporal solution. Where can I find the code of the onclick attribute to remove the whitespace?

Please Log in or Create an account to join the conversation.

  • Posts: 70149
  • Thank you received: 10504
  • MODERATOR
1 year 8 months ago #300342

Hi,

You can find it in the file administrator/components/com_hikashop/classes/filter.php
You can search there for that code:

.value=\' \'
as there are several occurences.
However, this empty space is added on purpose because in some cases the empty value would create issues.

On my end, turning off the deletable otpion of the filter fixes the issue without any problem. Was that not a good solution for you for some reason ?

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
1 year 8 months ago #300379

On my end, turning off the deletable otpion of the filter fixes the issue without any problem. Was that not a good solution for you for some reason ?


The thing is that my client isn't conviced on how the filter looked in some pages after I disabled that option. When a product is assigned to multiple categories of the same filter list, the selected filter and its delete button appears alongside the other categories of the filter list. Image 01

You can find it in the file administrator/components/com_hikashop/classes/filter.php
You can search there for that code:


I imagine that all changes made in that file are going to be reseted after an update, am i right? If so, how can i fix this issue? It's the first time that the filters do something like this

Attachments:
Last edit: 1 year 8 months ago by HALVAM. Reason: Adding an image.

Please Log in or Create an account to join the conversation.

  • Posts: 70149
  • Thank you received: 10504
  • MODERATOR
1 year 8 months ago #300426

Hi,

Thank you for your feedback. So we had a look deeper into it and added a patch so that it would work properly even with that option activated. It will be available with the next version of HikaShop to be released soon.
So you can apply the changes you want to the filter.php for the time being and then you won't have the problem after the update even without your patch.

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum