Custom

  • Posts: 2
  • Thank you received: 0
11 years 6 months ago #101262

In my hikashop business site, there is one category of products (laptops) which has filters on top. So the user can filter for specific prices, availability of the product, size of the hard drive, etc.

Each product has some custom field, which sometimes are numeric and sometimes alphanumeric (text).

I tried to make a filter for the custom field 'videochip'. The custom field has is of the 'text'-type, and i would like the filter to be a singe drop-down menu, which should auto-populate with all the different values that exist in the custom field.

I seem not to be able to set this up in hikashop. Even so, when i try to add some (text-) values under Vales for this filter and this custom field, the values are not saved; Seemingly only numeric values can be used.

Is this correct? Is it possible to have a single dropdown filter with textual values? can Hikashop generate this values dynamically from the custom fields of the products, or should the admin always manually set all the possibles values?

Or am i completely lost. Any help would me much appreciated.

Attachments:

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

  • Posts: 82760
  • Thank you received: 13347
  • MODERATOR
11 years 6 months ago #101420

Hi,

You can't use it that way.

The values of custom field filters can be used to enter ranges of numbers for custom fields where the shop owner can enter any possible number in the custom field as a text field.

Otherwise, you need to leave these values inputs empty and the filter will use the values of the custom field to generate the dropdown. It's thus not possible to use text/textarea custom fields in this case as the system is not able to load all the values from all the products.
So you would instead have to add all the possible values in the custom field and chang its type to dropdown so that you can select the values in the products and the filter will get the values from the cusotm field options.

The following user(s) said Thank You: roonsie22

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

  • Posts: 2
  • Thank you received: 0
11 years 6 months ago #101539

Okay thank you for a clear explanation.

Do you agree with me still this would be a good feature?

You state that it is not possible for the system to gather all the values of the custom fields of the products, when they are of the type 'text'. I guess you mean this would make the PHP code need more memory while generating the page. But really, say there are 500 products total with like 25 unique values (of 25 chars length average) in the custom field the filter is active on, this (the filter logic) would only take 312KB memory.

Am i right and do you follow me? If you don't agree, i will probably try to hack this into my Hikashop myself ;-)

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

  • Posts: 82760
  • Thank you received: 13347
  • MODERATOR
11 years 6 months ago #101723

Hi,

It would be a nice feature but I'm afraid of the consequences of mis configuration of users who would do that with thousands of products where the custom field value would be different for each one. That would create a dropdown of thousands of choices and the processing of the page would blow out (the query loading all the data would take long, the HTML would be big, etc) and the website wouldn't be accessible at all if he would get a fatal error because of that.

In your case, if you have only 25 unique values, you can enter them in the values of the custom field and simply select them in the products as a dropdown instead of having to write them each time in your products. It is more efficient, and it will work with the current system. So it's not even a matter of resources limitation.

Based on these two points, I don't see the benefit of such feature for now. But be free to hack in the code. It is open :)
It's in the file administrator/components/com_hikashop/classes/filter.php that you will be able to do your changes.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum