filterByAttribute
Permalink
Hi,
I have a a page list using this code
but hp_price is a string and $frPrice is a number
Is there a way I can set the hp_price as a number also?
I have a a page list using this code
$pl->filterByAttribute('hp_price', $frPrice, '<=');
but hp_price is a string and $frPrice is a number
Is there a way I can set the hp_price as a number also?
Thank for that but I don't think it will work.
I am passing the $frPrice in a dropdown from a form. This code is sat in the controller and I am trying to sayonly show pages if the attribute is less or equal to the number in frPrice. The problem is that price is a text field attribute not a number.
I am passing the $frPrice in a dropdown from a form. This code is sat in the controller and I am trying to sayonly show pages if the attribute is less or equal to the number in frPrice. The problem is that price is a text field attribute not a number.
I don't think there is a good way to make this happen. There is a Number Attribute Type, but in order to use that you would have to create a new attribute and delete the old one then set it on each page again.
Otherwise you could just get the full page list and test for that attribute value in the loop when you are displaying them.
Otherwise you could just get the full page list and test for that attribute value in the loop when you are displaying them.
Hmmm, this was what I was thinking, but I can do that as the this then mucks up the pagination as you are returning say 20 items but only showing 5.
Also the number value acts like a select box so I would have to put in up to 8000 entries to get $8000 to show as some prices are $7891
Not great
Also the number value acts like a select box so I would have to put in up to 8000 entries to get $8000 to show as some prices are $7891
Not great
How big is the un-filtered list? If not enormous, you could get the whole lot, filter in php, then paginate afterwards.
There is currently around 300 entries max
How could I do the pagination afterwards?
How could I do the pagination afterwards?
( EDIT - I probably got that back to front. You wanted numbers, not strings. )