Inherit filter bug

  • Posts: 210
  • Thank you received: 4
5 years 4 months ago #301410

-- HikaShop version -- : 4.0.1

Hello there,
Filters work great, but today the bug came

i have few customs fields - they are filter1, filter2 ... filter10 for different of my products types i store in this field different data
example
filter1 (value, name)
0 - red - for product type 1
1- green - for product type 1
5 - car - for product type 2
6 - bike - for product type 2
10 - minus 50 .. plus 100C - for product type 3
11 - minus 50 .. plus 120C - for product type 3
12 - minus 50 .. plus 200C - for product type 3
etc
After that i use filter for different category it works only if combination of filters returns product
but if combination of filters on product listing will give no data to user then he used filter - the filters (single list in my case) will contains all
data from custom fields witch is associated to this filters (for all filters on page) , but it have to contain only data for a parent category
you know like - sorry no data found please try again

see youself here is an example aketo.kz/datchiki/temperatury/termosopro...=303&filter__56=none

this not corect

but this is corect
aketo.kz/datchiki/temperatury/termosopro..._54=&filter__56=none

Also i want to ask - how to make filter name instead choose value in my filters ?
As you see on this page aketo.kz/datchiki/temperatury/termosoprotivleniya
there are 6 filters - but only one of them the 6th has name

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 4 months ago #301431

Hi,

1. Since the filters have the "dynamic display" setting activated (I presume), it means that each filter only display the choices matching what is preselected in the other filters.
If you don't display the clear button, then once you selected a combination of choices which has no results, you'll not be able to unselect any filters. In order to avoid that, once dynamic filters don't have any results they deactivate their "dynamic display" setting until their are results again.
If you don't want that, then you'll have to change the code.
I think changing that code:

if(!empty($filter->filter_options['custom_field']) && !empty($datas['products'])){
to:
if(!empty($filter->filter_options['custom_field'])){
in the file administrator/components/com_hikashop/classes/filter.php should do it.

2. In the settings of the filters you have the "title position" setting that you can set to "inside" for that.

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

  • Posts: 210
  • Thank you received: 4
5 years 4 months ago #301446

nicolas wrote:
2. In the settings of the filters you have the "title position" setting that you can set to "inside" for that.


In the settings of the filters the "title position" already enabled to "inside" for that in my case.

I think it is because we need to replace in /administrator/components/com_hikashop/classes/filter.php
on line
$html.='<OPTION VALUE="none"
to
$html.='<OPTION VALUE="none" selected

in front view now for a single dropdown it looks like ok

but unfortunely not for a multiple dropdown
this option selected must be disabled for a multiple dropdowns
but enabled for a single dropdowns

how to make correctly ?

I mean here is for example htmls select tag of internal hikashop filter by manufacturer
<div class="hikashop_filter__56">
<span id="filter_values_container__56_hikashop_category_information_module_" class="filter_values_container">
<SELECT  size=1 name="filter__56" id="filter__56_hikashop_category_information_module_">
<OPTION VALUE="none">Manufacturer</OPTION>
<OPTION  name="manufacturers" value="12">ОВЕН</OPTION>
<OPTION  name="manufacturers" value="1029">DANFOSS</OPTION>
</SELECT>
</span>
</div>

on the fron view then page already loaded Manufacturer select element already selected this option
like default
<OPTION VALUE="none">Manufacturer</OPTION>
but for all my filters for customs fields i see in the select element - text - choose value,
but it should contain
<OPTION VALUE="none">My filter Name</OPTION>
selected
<OPTION VALUE="none" select>Manufacturer</OPTION>

something like that

Last edit: 5 years 4 months ago by Bender.

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

  • Posts: 210
  • Thank you received: 4
5 years 4 months ago #301447

nicolas wrote: Hi,

1. Since the filters have the "dynamic display" setting activated (I presume), it means that each filter only display the choices matching what is preselected in the other filters.
If you don't display the clear button, then once you selected a combination of choices which has no results, you'll not be able to unselect any filters. In order to avoid that, once dynamic filters don't have any results they deactivate their "dynamic display" setting until their are results again.
If you don't want that, then you'll have to change the code.
I think changing that code:

if(!empty($filter->filter_options['custom_field']) && !empty($datas['products'])){
to:
if(!empty($filter->filter_options['custom_field'])){
in the file administrator/components/com_hikashop/classes/filter.php should do it.


it is pitty but it dont work

let me explain one more time the bug

I have 6 customs fields

in each of custom field i store different values for filtering for a different categories of products because i dont want to make my products table
in db big (this method said to me one of yours comrade on this forum)

here is an example code on loaded page
<SELECT  size=2 name="filter___49" id="filter___49_hikashop_category_information_module_">
<OPTION VALUE="none" selected>Temp range</OPTION>
<OPTION  name="custom_field" value="0">No data</OPTION>
<OPTION  name="custom_field" value="311">-50...+50 °С</OPTION>
<OPTION  name="custom_field" value="310">-50...+85 °С</OPTION>
<OPTION  name="custom_field" value="300">-50...+100 °С</OPTION>
<OPTION  name="custom_field" value="301">-50...+120 °С</OPTION>
<OPTION  name="custom_field" value="303">-50...+150 °С</OPTION>
<OPTION  name="custom_field" value="304">-50...+180°С</OPTION>
<OPTION  name="custom_field" value="309">-50...+200 °C</OPTION>
<OPTION  name="custom_field" value="305">-60...+250 °С</OPTION>
<OPTION  name="custom_field" value="308">-50...+500 °С</OPTION>
</SELECT>

It works good as it should - it shows only values for a category temp sensors

also for all of my other filters for this category the are contain dynamic data for products

if i will enable filter one by one - it works good dynamic data will show only variants for filter applied

but is I choose two or more filters and the result of such sql query will return null rows in this case i will get follow <SELECT> tag for my 1st filter in the example
<SELECT  size=2 name="filter___49" 
id="filter___49_hikashop_category_information_module_">
<OPTION VALUE="none" selected>Temp range</OPTION>
<OPTION  name="custom_field" value="0">No data</OPTION>
<OPTION  name="custom_field" value="1">Normally closed</OPTION>
<OPTION  name="custom_field" value="2">Normally open</OPTION>
<OPTION  name="custom_field" value="3">Inductive</OPTION>
<OPTION  name="custom_field" value="4">Capacitive</OPTION>
<OPTION  name="custom_field" value="5">Ultrasonic</OPTION>
<OPTION  name="custom_field" value="6">Оптический диффузный</OPTION>
<OPTION  name="custom_field" value="7">Немеханический магнитный</OPTION>
<OPTION  name="custom_field" value="8">Оптический ретрорефлекторный</OPTION>
<OPTION  name="custom_field" value="9">Оптический барьерный</OPTION>
<OPTION  name="custom_field" value="2001">0.0025 МПа</OPTION>
<OPTION  name="custom_field" value="10">0.016 МПа</OPTION>
<OPTION  name="custom_field" value="11">0.025 МПа</OPTION>
<OPTION  name="custom_field" value="12">0.04 МПа</OPTION>
<OPTION  name="custom_field" value="13">0.06 МПа</OPTION>
<OPTION  name="custom_field" value="14">0.1 МПа</OPTION>
<OPTION  name="custom_field" value="15">0.16 МПа</OPTION>
<OPTION  name="custom_field" value="16">0.25 МПа</OPTION>
<OPTION  name="custom_field" value="17">0.4 МПа</OPTION>
<OPTION  name="custom_field" value="18">0.6 МПа</OPTION>
<OPTION  name="custom_field" value="19">1.0 МПа</OPTION>
<OPTION  name="custom_field" value="20">1.6 МПа</OPTION>
<OPTION  name="custom_field" value="21">2.5 МПа</OPTION>
<OPTION  name="custom_field" value="22">4.0 МПа</OPTION>
<OPTION  name="custom_field" value="23">6.0 МПа</OPTION>
<OPTION  name="custom_field" value="24">10.0 МПа</OPTION>
<OPTION  name="custom_field" value="25">16.0 МПа</OPTION>
<OPTION  name="custom_field" value="26">25.0 МПа</OPTION>
<OPTION  name="custom_field" value="27">40.0 МПа</OPTION>
<OPTION  name="custom_field" value="28">1,5 кВт</OPTION>
<OPTION  name="custom_field" value="29">3 кВт</OPTION>
<OPTION  name="custom_field" value="30">4 кВт</OPTION>
<OPTION  name="custom_field" value="31">5,5 кВт</OPTION>
<OPTION  name="custom_field" value="32">7,5 кВт</OPTION>
<OPTION  name="custom_field" value="33">11 кВт</OPTION>
<OPTION  name="custom_field" value="34">15 кВт</OPTION>
<OPTION  name="custom_field" value="35">18,5 кВт</OPTION>
<OPTION  name="custom_field" value="36">22 кВт</OPTION>
<OPTION  name="custom_field" value="37">30 кВт</OPTION>
<OPTION  name="custom_field" value="38">37 кВт</OPTION>
<OPTION  name="custom_field" value="39">45 кВт</OPTION>
<OPTION  name="custom_field" value="40">55 кВт</OPTION>
<OPTION  name="custom_field" value="200">Красный</OPTION>
<OPTION  name="custom_field" value="201">Желтый</OPTION>
<OPTION  name="custom_field" value="202">Зеленый</OPTION>
<OPTION  name="custom_field" value="203">Синий</OPTION>
<OPTION  name="custom_field" value="204">Белый</OPTION>
<OPTION  name="custom_field" value="311">-50...+50 °С</OPTION>
<OPTION  name="custom_field" value="310">-50...+85 °С</OPTION>
<OPTION selected="selected" name="custom_field" value="300">-50...+100 °С</OPTION>
<OPTION  name="custom_field" value="301">-50...+120 °С</OPTION>
<OPTION  name="custom_field" value="302">-50...+125 °С</OPTION>
<OPTION  name="custom_field" value="303">-50...+150 °С</OPTION>
<OPTION  name="custom_field" value="304">-50...+180°С</OPTION>
<OPTION  name="custom_field" value="309">-50...+200 °C</OPTION>
<OPTION  name="custom_field" value="305">-60...+250 °С</OPTION>
<OPTION  name="custom_field" value="306">-50...+300 °С</OPTION>
<OPTION  name="custom_field" value="307">-50...+450 °С</OPTION>
<OPTION  name="custom_field" value="308">-50...+500 °С</OPTION>
<OPTION  name="custom_field" value="400">5 А</OPTION>
<OPTION  name="custom_field" value="401">10 А</OPTION>
<OPTION  name="custom_field" value="402">15 А</OPTION>
<OPTION  name="custom_field" value="403">25 А</OPTION>
<OPTION  name="custom_field" value="404">40 А</OPTION>
<OPTION  name="custom_field" value="405">60 А</OPTION>
<OPTION  name="custom_field" value="406">80 А</OPTION>
<OPTION  name="custom_field" value="407">100 А</OPTION>
<OPTION  name="custom_field" value="408">120 А</OPTION>
<OPTION  name="custom_field" value="409">150 А</OPTION>
<OPTION  name="custom_field" value="410">200 А</OPTION>
<OPTION  name="custom_field" value="411">250 А</OPTION>
<OPTION  name="custom_field" value="412">600 А</OPTION>
<OPTION  name="custom_field" value="413">800 А</OPTION>
</SELECT>

as you can see it now html element SELECT contains all data witch i store in custom field associaed to this filter also for all filters on category

also for internal filter by brand it will contain all brands in hikashop

But the normal result for this user's operation have to be something like 'sorry no data to display, please choose another combination of filters'

and show in html SELECT element user's selected values or to flush all filters and fill them only values associated to fields

I hope you understand me

Last edit: 5 years 4 months ago by Bender.

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

  • Posts: 210
  • Thank you received: 4
5 years 4 months ago #301448

Also what means "Defined limits" in filter setting
what it using for ?

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 4 months ago #301572

Hi,

1.

in each of custom field i store different values for filtering for a different categories of products because i dont want to make my products table
in db big (this method said to me one of yours comrade on this forum)

I think that's where the problem is. I would rather recommend to have the values in different custom fields. Sure, you'll have a bigger hikashop_product table but that shouldn't be too much of a problem unless you have hundred of thousands of products and hundreds of custom fields.
Actually, having to activate the "dynamic display" setting adds MySQL queries to the page to know what to display in each dropdown so I'm not sure it helps performance-wise.
Even if the hikashop_product table doubles in size it shouldn't be a problem.

Having it setup like that, you'll have only the relevant values in each dropdown. And that's why I wasn't able to understand the problem you had as I didn't had it on my end the way I set up the custom fields and filters.

2. When you're applying a filter on a custom field, you have the "values" area where you can enter numbers so that the filter will actually contain the ranges between these numbers instead of the values entered in the custom field.
It's useful when you custom field contain values, or prices.
So in the filter, you'll end up with choices like that:
from 10 to 50
from 50 to 200
from 200 to 1000
And if you activate that "defined limits" setting, you'll also get:
below 10
above 1000
in the choices of the filter.

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

  • Posts: 210
  • Thank you received: 4
5 years 4 months ago #301663

actually i'm gonna upload a thousands of product and make a thousands of filters for them in shop, do you mean Hikashop as a product is not suitable for such applications ? What kind of future so waiting us the users of Hikashop, what is Hikashop life cycle?

This bug should be fixed in future releases, now i used "by click" function - seems like ok
Also will be nice to use ajax for filtering instead get or post data.

What about my second question - titles of filters ?

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 4 months ago #301675

Hi,

1. No, I just mean that you shouldn't group values of things you want to filter in separate filters in the same custom fields. The issue you have is a by-product of doing that. If you setup the values that should be in the same dropdown in the same custom field, and the values that should be in different dropdowns in different custom fields, it should work fine.

2. Regarding the future of HikaShop, redoing completely the filter system is something we want to work on, hopefully in 2019 although I can't promise any date as we didn't start anything yet on that. Of course, when we redo it, having the system fully ajax will be one of the main points of improvements, (like we did previously with the checkout, the add to cart, etc).

3. Regarding the title of the filters, I missed the question in my previous message. Sorry for that.
Replacing :

$html.='<OPTION VALUE="none"
by:
$html.='<OPTION VALUE="none" selected
won't work. It's more complex. I think we actually need something like that instead:
$html.='<OPTION VALUE="none"'.(empty($selected) || !count($selected) || in_array('none', $selected) ? ' selected', '').'
Note that there are two places in the file where you would have to change that code.

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

  • Posts: 210
  • Thank you received: 4
5 years 3 months ago #301912

it is if to make size of filter=1 in filter settings bug will go away.

left as is

thanks a lot

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

  • Posts: 210
  • Thank you received: 4
5 years 3 months ago #301913

Where to find file witch shows filter after user use it

i want to delete br element from this code

<div class="hikashop_filter__55"><span class="hikashop_filter_title">Максимальный ток</span>
<br/><span id="filter_values_container__55_hikashop_category_information_module_" class="filter_values_container">> 
<a class="hikashop_filter_list_selected" style="font-weight:bold">100 А</a>

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 3 months ago #301925

Hi,

There is no such <br/> tag by default.
I suppose that you must have a translation override of the translation:
CURSOR_TITLE_SEPARATOR=": "
with:
CURSOR_TITLE_SEPARATOR="<br/>"
instead, which could explain the resulting HTML in your message.

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

  • Posts: 210
  • Thank you received: 4
5 years 3 months ago #301941

nicolas wrote: Hi,

There is no such <br/> tag by default.
I suppose that you must have a translation override of the translation:
CURSOR_TITLE_SEPARATOR=": "
with:
CURSOR_TITLE_SEPARATOR="<br/>"
instead, which could explain the resulting HTML in your message.


I cheked translation overide but CURSOR_TITLE_SEPARATOR=": "
no translation also a searched for br element in the translation
there are only 4 places with br element but no one of them associated with filters

what else may be ?

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

  • Posts: 4508
  • Thank you received: 610
  • MODERATOR
5 years 3 months ago #302116

Hello,

Did you check in your HikaShop Language files, just to be sure :



If yes, and nothing seems wrong, next step can you provide :
- Some frontend/Backend access via our Contact us form and add an Url link to this topic

Regards

Last edit: 5 years 3 months ago by Philip.

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

  • Posts: 210
  • Thank you received: 4
5 years 3 months ago #302323

Philip wrote: Hello,

Did you check in your HikaShop Language files, just to be sure :



If yes, and nothing seems wrong, next step can you provide :
- Some frontend/Backend access via our Contact us form and add an Url link to this topic

Regards


I did check - there is no overrides about theme
I sent access to your email

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

  • Posts: 4508
  • Thank you received: 610
  • MODERATOR
5 years 3 months ago #302403

Hello,

Please note these differents points :
- When I go to your website backend, I notice that you haven't default template (like ProtoStar by example), sometimes it's good to
switch to such a default template in order to see if your display issue.
On the same idea, for a reason or another, I wasn't able to switch to another template

- You haven't any override view on the product/filter view, so I checked your template css, I find this :



You have some custom css that set your span (html inline elements) to be a block element, and so the </br> + span in block create 2 back to line.

Note that we understand where come from the </br> it's from a function that have to set html title display and so this leads to provide you 2 solutions :
- Delete from your Css the "display: block;"
- Try to edit your filter.php in YourWebsite\components\com_hikashop\views\product\tmpl folder, and around line 1275, remove the
</br> to see if the result can match your needs.

Hope this will fit your needs
Regards

Last edit: 5 years 3 months ago by Philip.

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

  • Posts: 210
  • Thank you received: 4
5 years 3 months ago #302424

now its ok
replaced

.hikashop_filter_title {color:#555; font-weight:bold; font-size:12px; margin-bottom:8px; display:block}

to
.hikashop_filter_title {color:#555; font-weight:bold; font-size:12px; margin-bottom:8px; }

Last edit: 5 years 3 months ago by Bender.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum