Filtering of exact text string

  • Posts: 69
  • Thank you received: 1
10 years 2 months ago #168862

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4
-- Error-message(debug-mod must be tuned on) -- : Question pertaining to filters

Hi,

I am trying to search for an exact text string... and need some advice. I have read several of the posts regarding this subject...

I have a custom field called MATERIAL
MATERIAL contains
Cotton
Cotton Fleece
Cotton Terrycloth
Cotton/Polyester blend

I need to be able to search for each distinct set of products and I would like to keep these values in the database of products so that I can see them on back end display, and also make them available when comparing products

I know that I can have values for the custom field like 001, 002, 003, etc. and map these to filter module, but is there an easy way to make them distinct without changing their values in the database?

Dennis


______________
Dennis Kmetz

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

  • Posts: 12953
  • Thank you received: 1778
10 years 2 months ago #168939

Hello Dennis,
Can you give us more information about want you want to do and where do you want to use it through some screenshots for example ?
Thanks :).

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

  • Posts: 69
  • Thank you received: 1
10 years 2 months ago #169025

Hi Mohamed,

I think I figured it out... I placed the values of the custom field in quotes... AND made Cotton two words... so this works and allows me to filter on the individual items:
"All Cotton"
"Cotton Fleece"
"Cotton Terrycloth"
"Cotton/Polyester blend"

Dennis


______________
Dennis Kmetz

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

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #169041

Yes, you need to not have a value inside other values of your custom field otherwise the values with that value inside them will also match when the user select that value in a filter.

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

  • Posts: 69
  • Thank you received: 1
10 years 2 weeks ago #178736

Nicolas,

I thought this was working for me but it is not... here is my situation. I have a radio button custom field with values and titles. My custom field values are a, b, c and I have so many different values that I go into double characters... so I am into values of x, y, z, aa, ab, ac etc.

What I just discovered is that when I select the filter value for "a", I get a product with a custom field value of "a" which is good, but I also get a product with a value of "ag"... which is incorrect. Both products are being returned when I filter on what should return just the a product with the value of "a". I confirmed that the additional product (the one that should not be returned) is correctly set with a value of "ag". I also exported the product, and confirmed it that way.

So, it appears that the filter does not distinguish between products with values of "a" and "ag". If I filter on values of "ag", then the filter works properly and returns only products with "ag" values. Do I need to change all my values to be the same length? For example, if should I change my custom field values from a, b, c, to a1, b1, c1, etc. and update my inventory accordingly?

Please advise me on how to proceed.

Dennis


______________
Dennis Kmetz

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

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
10 years 2 weeks ago #178740

Hi,

Yes, you should update the values with less letters to have the same amount of letters so that they aren't found inside other values.

Note that we added a patch in the filtering system with the 2.3.4 version of HikaShop which should normally avoid the problem.

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

  • Posts: 69
  • Thank you received: 1
9 years 11 months ago #182818

This solved my problem... thanks!


______________
Dennis Kmetz

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

  • Posts: 69
  • Thank you received: 1
9 years 9 months ago #189465

Hi,

My problem is back... sort of. I have different data and I am now on 2.3.5.

I have a custom field being used as a filter. The filter value is SUPER PREMIUM with no quotes or anything else in the value field within this custom field. The inventory item (when exported) has the value SUPER PREMIUM in the custom field... so far so good.

I think the issue may be the submit value (I am using the filter module) in the form of the product/filter.php file.

The submit value is SUPER and not SUPER PREMIUM. Thus I select no inventory items. Here is the code that is generated:

<input onchange="document.forms['hikashop_filter_form_module_148'].submit();" type="checkbox" name="filter_Quality__Glove_Price_Range_[]" value="Super" premium="" id="field_8_0_module_148">
Thanks,

Dennis


______________
Dennis Kmetz
Last edit: 9 years 9 months ago by dkmetz@taylorbruce.com. Reason: spelling

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

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
9 years 9 months ago #189574

Hi,

Could you provide a link to the page with the filter so that we could look at the issue ?

Could you also provide a screenshot of the options of the filter ?

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

  • Posts: 69
  • Thank you received: 1
9 years 9 months ago #189583

Nicolas,

Here you go...
page with the issue
181.224.147.219/~steineri/index.php?opti...t=listing&Itemid=367

Screenshot of options of the custom field used as the filter
prntscr.com/6108ik

The filter screen
prntscr.com/6109h8

Thanks,

Dennis


______________
Dennis Kmetz

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

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
9 years 9 months ago #189715

Hi,

Thank you. We found the issue.
Change the line:

if($type!='hidden') $input = '<INPUT '.$onClick.' '.$checked.' type="'.$type.'" name="filter_'.$filter->filter_namekey.$tab.'" value='.$val[0].' id="field_'.$filter->filter_id.'_'.$key.'_'.$divName.'">';
to:
if($type!='hidden') $input = '<INPUT '.$onClick.' '.$checked.' type="'.$type.'" name="filter_'.$filter->filter_namekey.$tab.'" value="'.htmlentities($val[0]).'" id="field_'.$filter->filter_id.'_'.$key.'_'.$divName.'">';
in the file administrator/components/com_hikashop/classes/filter.php and that will fix the problem.

The following user(s) said Thank You: dkmetz@taylorbruce.com

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

  • Posts: 69
  • Thank you received: 1
9 years 9 months ago #189757

Nicolas,

This worked... thanks for the prompt reply!

Dennis


______________
Dennis Kmetz

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

Time to create page: 0.085 seconds
Powered by Kunena Forum