Admin Customer Search Not Listing Specific Custom Field Option

  • Posts: 7
  • Thank you received: 0
4 years 3 months ago #314161

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.3.3
-- Browser(s) name and version -- : CHROME 79.0.3945.79

I have a GENDER custom field. when I search (in Admin>Hikashop>Customer) the keyword FEMALE, it will filter all customers with FEMALE gender. But when I search MALE keyword, it will list down customers with both MALE and feMALE, since 'female' contains a keyword 'male'. Is there a way where I can search and display the specific gender only? Thank you for any help.

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

  • Posts: 7
  • Thank you received: 0
4 years 3 months ago #314169

Any help is highly appreciated. thanks

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
4 years 3 months ago #314174

Hi,

There are basically two ways to go about this:
1. You change the way the search is done to only match exact terms (this would require code modification)
2. You change the terms so that their text don't overlap.

When you configure your custom field, you have for each value of the custom field a "value" input and a "title" input.
The value is the data stored in the database and the "title" is what the user sees in the dropdown/radio of the custom field.
So if you enter for example "male" and "fem" as the "value" of your custom field values instead of "male" and "female", you'll be able to search "male" and "female" without having an overlap on their text in the database, while the users will still see "male and "female" thanks to the values.
Also, you'll want to run a mass action on the user data via the menu System>Mass action with a filter on the column of your custom field with the value "female" and an action "update the values" on that same field with the string "fem" so that the users who already selected "female" will get the new value in the database.

PS: please note that we don't work on weekends. That's why we couldn't answer you faster :)

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

  • Posts: 7
  • Thank you received: 0
4 years 3 months ago #314188

Thanks for your assistance. But what happens if the customer's name contains FEM but is a male? I think it will filter this as well. Do

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

  • Posts: 12953
  • Thank you received: 1778
4 years 3 months ago #314192

Hello,

In that case it will require code customization of the way customers are filtered. Even if you didn't changed your custom field values, you would have faces that issue if your customers name contained "mal".

The file that will have to be customized will be "administrator\components\com_hikashop\views\user\view.html.php".

Kind regards,
Mohamed.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum