Cursor filter in custom field doesn t work

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #172445

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 2.5.24
-- PHP version -- : 5.3.29

Hi!
I tried to create a filter cursor on a custom field which is a checkbox.

It is a date with mupltiple choices like 1999,2000,2001 (example)



I created a filter on it like follows



and a module on the left of my page like this



If I go and filter from 1980 to 1981, where there are no products it keeps bringing me all products. example
in this product there is 2000,2001,2002,2003,2004,2005 selected.


Is it because its a checkbox field and cursor works only with text?
Thanks!

Attachments:

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #172446

i checked with field too. But the same.
What I need to do is to display a between filter but I can t find another way

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

  • Posts: 26264
  • Thank you received: 4043
  • MODERATOR
10 years 10 months ago #172494

Hi,

More than a potential problem with the "cusor filter + multi checkbox custom field" ; your configuration is not right.
Your custom field values are "1,2,3,4,5..." and your filter is based on "1960,1961,1962..." so you can't have matches.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #172500

I tested with fields too.

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

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

Hello,

As Jerome said your filter is based on a custom field values from 1980 to 2014 ("cursor maximum/minimum values") If you want to use it with your checkbox custom fields, you'll have to :
- Use it with values from 1 to 35
OR
- Set the values of your custom field as their titles from 1980 to 2014.

I tested with fields too.

What do you exactly mean by that ? can you give us more information ?

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #172620

It was checkbox and I made it field.
I wrote in the field 2000
I filtered with the cursor 1980 to 1981 and it still brings up the item

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

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

Can you give me a temporary back-end access through a private message so that I can directly test it and tell you from where your issue is coming from ?
Thanks.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #172783

ok. I ll pm you

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

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

Did you removed the "Xpovo.." filter and custom field ? if not can you please give me then name of the filter and custom field.
Thanks :).

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #173028

NAME OF FILTER IS Xρονολογία With columnname xronologia and id 2
FILTER NAME IS Xρονολογία apply on xronologia and id 3

I thing I gave you wrong site to see it. thats why you can t find it . I ll pm again with the correct sorry

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

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

Hello,
Cursor filters are not supposed to support "checkbox" custom fields, so the "solution" will be to directly use some code customization which will require some development skills.

To do that you can use that code through the "administrator\components\com_hikashop\classes\filter.php" file :

for($i = (int)$values[0]; $i <= (int)$values[1]; $i++){
      $limit .=' OR b.'.$filter->filter_data.' LIKE "%'.$i.'%" ';
}
Just after these lines :
}else{
	$limit=' b.'.$filter->filter_data.' BETWEEN '.(int)$values[0].' AND '.(int)$values[1].' ';

Last edit: 10 years 10 months ago by Mohamed Thelji.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #173251

Thanks for the reply Mohamed, but can you be a little more specifiq?
a.What would be the result of adding such code?

b. is this result combined with cursor filter or should I use some other ?

c. this is a new type in filters ?

Thanks for your time.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #173255

cursor still doesnt work with these modification.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #173263

Hi,

To summarize you problem, now for the checkboxes the values are years too and not values from 1 to 35, right ?
When using the cursor on years it display products even if they are not in the correct range ?

As Jérome and Mohamed said cursors are not really made to be used like that, it must be applied on one value and not many as it can be the case with the checkboxes.

Mohamed gave you some code which should be working fine, if it's not that's potentially because of the "BETWEEN" part of the MySQL request. So you have to remove it and only use the "LIKE" part.

Thanks to try that instead:

}else{
	//$limit=' b.'.$filter->filter_data.' BETWEEN '.(int)$values[0].' AND '.(int)$values[1].' ';
	$limit = '';
	for($i = (int)$values[0]; $i <= (int)$values[1]; $i++){
		if($i != (int)$values[0])
			$limit .= ' OR';
		$limit .=' b.'.$filter->filter_data.' LIKE "%'.$i.'%" ';
	}

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #173391

Hi Xavier.
Yes values are years too.
Yes it displays every product
But.
I dont care if I use cursor or something else.
I only need to use some how a filter RANGE or BETWEEN .

I did that too so my code looks like.


if(in_array($filter->filter_data,array('weight','length','width','height','surface','volume','price'))){
$type=$filter->filter_data;
$case='( '.$this->getUnitSelect($filter, $type, $i).' )';
$limit=' '.$case.' BETWEEN '.(int)$values[0].' AND '.(int)$values[1].' ';

}else{
//$limit=' b.'.$filter->filter_data.' BETWEEN '.(int)$values[0].' AND '.(int)$values[1].' ';
$limit = '';
for($i = (int)$values[0]; $i <= (int)$values[1]; $i++){
if($i != (int)$values[0])
$limit .= ' OR';
$limit .=' b.'.$filter->filter_data.' LIKE "%'.$i.'%" ';
} }
$filters[]=$limit;
}

}else{
return false;
}

but it still doens t work.

Please have a real look in my admin to see it your self. Maybe I m doing something wrong. And my client is already mad.
Thanks.
I ll pm you my back end

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

  • Posts: 26264
  • Thank you received: 4043
  • MODERATOR
10 years 10 months ago #173764

Hi,

Regarding your configuration, the code of the filters and the specifications we made ; The cursor has not been made to work with the custom fields like that.
It is something made in order to have a "range" for one single value like the price, the weight, or a single value in a custom field.
Because you want to mix the range system and a custom field with multiple value, I can tell you that it won't be possible unless you modify the HikaShop core, what you started to do.

When you got multiple value in a custom field, all selected values are "serialized" in the database column so it's not possible to use "<" or ">" in SQL queries because the value is not a single number.. It's a list of integers separated by comas.

So your custom field value will be something like : ",1960,1961,1962,"
You have to use that specification if you want to modify the core and generate a compatible query.
I will recommend you to use "phpMyAdmin" in order to try SQL queries. Like that I don't have a good idea to propose you, I guess I will require more reflection time.

I admit that the filter system have some limitations and when we create it we didn't think at all possibilities.
I am sure that we will improve the filter system and maybe make a re-factoring of a part of it ; but it won't be in a short delay, we have other elements we want to refactor before (the product edition page, the checkout, the add to cart)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 10 months ago #173776

you answer coverd me.
I ll be waiting for such function, and I believe most of your clients would think it as natural -- to have the ability to filter a range between fileds.
The truth is that most free component have this as a buildin function, but the balance still goes on hikashop even if it is a paid component in my case , because of its great support and really few bugs.

Thanks!

The following user(s) said Thank You: Jerome

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

Time to create page: 0.128 seconds
Powered by Kunena Forum