Problem with Deletable Filter option for Text type filters with Inside title pos

  • Posts: 141
  • Thank you received: 3
4 years 9 months ago #308466

-- HikaShop version -- : 4.1.0
-- Joomla version -- : 3.9.8
-- PHP version -- : 7.2.14

Hi, I have problem with „Deletable Filter” option for filters type TEXT and which have title position set as INSIDE. After removing selection using deletion button next to the filter field the title of the filter which should be inside the field is not visible (the title of the filter is visible only after usage of global RESET button which reset all filters selections and not after usage of deletion button next to the filter field). If I choose other title position for test field – for example left– the title of the text filed is visible after using deletion button next to the filter field. The problem concern only TEXT type filters – for example for single dropdown type filters with title position set as inside deletion function is working properly and title of the dropdown filter is visible inside the field.


Please find attached images:
1) filters before selection
2) filters after selection
3) filters after deletion using deletion buttons next to the filters which caused no title inside text type filter






Regards,
Greg

Attachments:

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
4 years 9 months ago #308533

Hi,

Try changing the line:

if(strlen($value) < 1) {
to:
if(strlen(trim($value)) < 1) {
in the file administrator/components/com_hikashop/classes/filter.php and that should fix the problem.
Ideally, I would recommend to not set the title inside for the text filters and instead add a placeholder and if necessary hide the title with CSS. It will be better for accessibility and you won't have that issue.

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

  • Posts: 141
  • Thank you received: 3
4 years 9 months ago #308556

Hi, Thank you for your feedback. Unfortunately I cannot find indicated line in my file administrator/components/com_hikashop/classes/filter.php.
I have tested solution with placeholder, but the description of the field (added using placeholder) also disappears after removing selection using deletion button next to the filter field and the description is visible only after usage of global RESET button which reset all filters selections and not after usage of deletion button next to the filter field.
Regards,
Greg

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
4 years 9 months ago #308558

Hi,

Ah right, I was looking at the code of HikaShop 4.2.0 which is to be released soon, and I didn't think this area had changed.
With the 4.1.0, it's the line:
if($filter->filter_options=='inside' && empty($name)){
that you want to change to:
if($filter->filter_options=='inside' && strlen(trim($name)) < 1){

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

  • Posts: 141
  • Thank you received: 3
4 years 9 months ago #308588

Hi Nicolas, I have not found code

if($filter->filter_options=='inside' && empty($name)){
in administrator/components/com_hikashop/classes/filter.php. but I have found the line:
if($filter->filter_options['title_position']=='inside' && empty($name)){
and I replace it by the line:
if($filter->filter_options['title_position']=='inside' && strlen(trim($name)) < 1){

However after this change the title of the filter also disappears after removing selection using deletion button next to the filter field

Regards,
Greg

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

  • Posts: 4502
  • Thank you received: 610
  • MODERATOR
4 years 9 months ago #308694

Hello,

Quite strange that this didn't change anything, can you check that you didn't have any override view.
To check this, go to Components => HikaShop => Configuration, then in Display dropdown select Views :



If you have a little trash icon, then you have an override maybe from an old HikaShop version, and that can explain your issue and the fact that you didn't find the same code than us, but awaiting news from you to be sure.

Regards

Last edit: 4 years 9 months ago by Philip.

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

  • Posts: 141
  • Thank you received: 3
4 years 9 months ago #308745

Hi, No, I haven’t an override of template_product_filter.php
I using Hikashop ver. 4.1.0 since May and I have additionally downloaded same version of Hikashop once again on 10.07.2019 and I have installed once again.
Please find enclosed txt file based on administrator/components/com_hikashop/classes/filter.php
Regards,
Greg

Attachments:

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
4 years 9 months ago #308748

Hi,

Add the code:

		if($name == ' ')
			$name = '';
after the code:
		if(!empty($selected)){
			$name=htmlentities($selected[0], ENT_COMPAT, 'UTF-8');
		}
in the administrator/components/com_hikashop/classes/fitler.php file and it should fix the problem once and for all.

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
4 years 9 months ago #308819

Hi Nicolas, thank you ! it works :)

Regards,
Greg

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
4 years 9 months ago #308823

Thanks. We've added the change on our end too.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum