problem with filters after Hikashop 4.2.2 update

  • Posts: 141
  • Thank you received: 3
5 years 1 week ago #313117

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.13
-- PHP version -- : 7.2.14

Hi, After update from Hikashop 4.2.1 to 4.2.2 I have problem with proper functioning of Hikashop filters

After publishing of certain number of custom filters in the Hikashop filter module filters are not working properly (I cannot find any systematics in this subject). I setup test installation and up to 9 filters in Hikashop filter module filters are working ok but with 10 filters and more filters in Hikashop filter module filters are not working properly. I try to publish/unpublish different filters but type of filters has no impact on this situation only number of filters. I also checked this with Prostar Template and problem exist. I haven’t set any maximum number of filters neither in Hikashop filter module or in Hikashop configuration. I didn't override product / filter.php.

Up to 9 filters:

(a) filtering works ok
(b) dynamic filters works ok
(c) deletable filters are presented with deletion button after filter is set
(d) after Reset button is set filtering is reset and all filter fields are reset as well

please find below how it looks on images (with 9 filters in Hikashop filter module) - when is ok:
image 1 – after some filters are set



image 2 - after reset button is set




From 10 filters and more:

(a) filtering works ok
(b) dynamic filters are not working (you need to refresh browser using F5 to start dynamic filters working)
(c) deletable filters are not presented properly - they are without deletion button after filter is set (you need to refresh browser using F5 to see deletaion button next to the field)
(e) after Reset button is set filtering is reset but all filter fields are still look as they were set (you need to refresh browser using F5 to unset filter fields)
(f) additionally in some cases reset button not appears when filters are set until browser is refresh (F5)

please find below how it looks on images (with11 filters in Hikashop filter module) - when is not ok:
image 3 - after some filters are set



image 4 – after reset button is set




It is really strange. I cannot find any systematics why with certain number of filters filter module works fine and after certain number of filters problem occurs. Additionally when I checked this also on different installation the problem occur after exceeding different number of filters. However, the common feature is that after refreshing the browser via F5, the filter fields look correct.

I had also problem with filters after update to HIkashop 4.2.0 – this was discussed on this forum thread: link - I don’t know but maybe this new problem has similar roots to the previous one.

I would like to ask for help with this problem.

Regards,
Greg

Attachments:
Last edit: 5 years 1 week ago by Greg_C.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
5 years 1 week ago #313135

Hi,

I think that the issue is related to the fact that the parameters are added to the URL. Browsers and web servers have URL size limits of different degree. And some also have settings to change that:
stackoverflow.com/questions/1051485/what...aracter-limit-on-url
So it's possible that if the URL with all the filters in the parameters is too long, it can cause some trange behavior with the refreshing of the filters/results area.
Increasing the max number of characters of the server might help.
Alternatively, you can open the hikashop_filter table and reduce the number of characters of the namekey for each filter.
IT could help substantially.

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

  • Posts: 141
  • Thank you received: 3
5 years 1 week ago #313150

Hi Nicolas, I checked this and with Hikashop 4.2.2 problem starts when I have 10 filters in Hikashop filter module, which “generate” only 247 characters in URL. After I back again to Hikashop 4.2.1 problem doesn’t start even if I have 18 filters (all, which were created for test purposes) in Hikashop filter module. Additionally in 4.2.1 URL after filters are set looks like that:

(…)/en/shop/products
and in 4.2.2 URL after filters are set looks like that:
(…)/en/shop/products?limitstart=0&filter_Test_1=&filter_Color_2=none&filter_Format_3=Large&filter_Keywords_6=&filter_Category_5=none&filter_aa_7=&filter_bb_8=&filter_cc_9=&filter_dd_10=&filter_ee_11=

Problem started when I made Hikashop update from 4.2.1 to 4.2.2. I didn't make any other changes.

Regards,
Greg

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
5 years 1 week ago #313153

Hi,

The main change to the filters system between the 4.2.1 and the 4.2.2 (besides all the fixes), is the addition of this code:

				
				if(resp.newURL) {
					var urlInHistory = resp.newURL.replace('tmpl=raw&', '', 'g').replace('filter=1&', '', 'g').replace('&tmpl=raw', '', 'g').replace('&filter=1', '', 'g');
					window.history.pushState(data, d.title, urlInHistory);

					window.addEventListener('popstate', function(e) {
						if(window.location.href.includes('hikashop_url_reload=1')) {
							window.location.href.replace('&hikashop_url_reload=1','').reload();
						}
					});
				}
				
in media/com_hikashop/js/hikashop.js
This adds the parameters of the filters to the URL in the address (so that why you get a different URL).
So you can delete that bit and see if that helps. But I don't see why it would change anything.

The following user(s) said Thank You: Greg_C

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

  • Posts: 141
  • Thank you received: 3
5 years 1 week ago #313170

Hi Nicolas, thank you, this change in the code solved the problem
I will check in addition with my server provider what kind of limitation I have in URL length
However after this change I can again use many filters without problems

I have question if this deleted code is important for functioning of Hikashop ?

Regards,
Greg

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

  • Posts: 1119
  • Thank you received: 114
5 years 1 week ago #313171

Hi,

You probably will find your answer here: www.hikashop.com/forum/filters-search/89...iltering.html#311469

Hope that helps

Thanks

The following user(s) said Thank You: Greg_C

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

  • Posts: 141
  • Thank you received: 3
5 years 1 week ago #313172

Hi,
@kyratn
thank you for clarification !

In my case possibility to save/favourite/share pages with their filter settings in the url is not crucial

Important for me is to have possibility to view a product and then go back to the product listing and see filter settings still exactly the same to continue browsing but this is working even after code deletion

However to have choice I need to discover why I cannot use more filters with this code – otherwise I have no choice and I need to delete this code

Regards,
Greg

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
5 years 1 week ago #313206

Hi,

So from what you say, I suppose that the issue is linked to the fact that the URL becomes too big with that piece of code when you have a lot of filters.
So try what I suggested before to shorten the namekeys of the filters in the database. That might be enough to avoid the problem while keeping that piece of code in.

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

  • Posts: 141
  • Thank you received: 3
5 years 1 week ago #313236

Hi Nicolas, thank you for information

Regards,
Greg

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

  • Posts: 11
  • Thank you received: 0
5 years 6 days ago #313241

Hi,
i've have the same problem with the filter after the upgrade to the last hikashop version 4.2.2.
The filter does't work.

Attachments:

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
5 years 6 days ago #313248

Hi,

I checked your website and the issue you have doesn't look like what is described by @Greg_C here.
In your case, when a filter is used, the main area is not refreshed.
That's because some of the view files were customized based off of an old version of HikaShop and thus you didn't get all the modifications necessary for the AJAX filtering to work properly.
You need to check the folder templates/YOUR_TEMPLATE/html/com_hikashop/product/ via FTP.
There, rename the files one by one and test the filters each time in order to find the view file override which you need to recustomize.
I suppose that it's probably listing.php or listing_div.php that you'll have to redo for the filters to work properly.

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

  • Posts: 11
  • Thank you received: 0
5 years 6 days ago #313265

Yes... problem solved ...
was the file listing.php

Thanks

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

Time to create page: 0.131 seconds
Powered by Kunena Forum