Cursor filter for custom fields

  • Posts: 23
  • Thank you received: 0
9 years 9 months ago #190639

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.28

Hi,

i have a custom field (type text - also tried single selection list) where i only enter integer values.
Now i want a cursor on that field.

Unfortunately i am not allowed to select a custom field for the cursor filter type. But what exactly the reason for that?
I read in another forum thread that you are using BETWEEN SQL query command.
The BETWEEN command is applicable for columns of the type integer, string and datetime. So it would be possible to use it.
Alternatively it would also be possible to use CONVERT and CAST commands to force the values to be number types before using the BETWEEN command. The cursor filter anyway only makes sense for numeric fields, so in case someone uses the cursor filter on a non-numeric field it is his own fault.

I think this would be a feature a lot of people are missing?!

Last edit: 9 years 9 months ago by raven-worx.

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

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

Hi,

Why not.
Add the code:

$fieldsClass = hikashop_get('class.field');
			$fields = $fieldsClass->getData('all','product');
			if(!empty($fields)){
				foreach($fields as $field){
					$this->values[] = JHTML::_('select.option', 'b.'.$field->field_namekey,$field->field_realname);
				}
			}
after the line:
$this->values[] = JHTML::_('select.option', 'b.product_average_score',JText::_('RATING'));
in the file administrator/components/com_hikashop/types/product_information.php and that will work.

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

  • Posts: 23
  • Thank you received: 0
9 years 9 months ago #190714

But why is such an essential feature not already implemented?! Is there a special reason?
I would be great if i could avoid reappling the change everytime i upgrade the component.

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

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

No one asked. It's as simple as that.
That code will of course be in the next version of HikaShop. I just gave you the code in case you wanted to do it before we publish next release of HikaShop in a month or so.

The following user(s) said Thank You: raven-worx

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

  • Posts: 23
  • Thank you received: 0
9 years 9 months ago #190783

I see, great! Thank you!

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

Time to create page: 0.054 seconds
Powered by Kunena Forum