I've got a very strange problem. I created a custom attribute named "taille_ecran" which mean in english "screen size". The labels of this attribute are numbers like 1.2, 1.6, 2, 5, 6, etc…
When I try to add a custom filter like this :
$_productCollection->addAttributeToSelect('taille_ecran');
$_productCollection->addFieldToFilter(array(
array('attribute'=>'taille_ecran','lteq'=>$_GET['max_size']),
));
The filter filters by the option_id of thoses labels in "taille_ecran" instead of labels values. In fact, here is the ID of my labels :
31 => 1.2
41 => 5 etc…
When I tried to get the labels "lteq" under 7 there is no result and when I try 35 I get 1 result which is 1.2.
I try also to print this value in my products list :
echo $_product->getTailleEcran();
// print 31 when it's for 1.2...
It's very hard for me to explain clearly what is happening. I don't have this problem with other attribute.
Thanks in advance for your help !
Best Answer
Try this: