0

i have a custom model that i want to display in a page-anted grid for users on a page in storefront. i can call the collection in the phtml with a filter and it works, but when i move the call to the block it does not work if i try to filter (i can call the whole collection just when i add the filter it stops working)the collection any ideas? this is the call

Mage::getModel('model/name')->getCollection()->addFilter('group_id', $val);
2
  • 1
    Perhaps $val is undefined... can you share more of your code?
    – scrowler
    Jul 18, 2016 at 21:42
  • oh I am embarrassed $val wasn't set properly i was annoyed when i saw your comment but you were right thank you Jul 19, 2016 at 3:55

1 Answer 1

2

Use addFieldToFilter instead of addFilter:

Mage::getModel('model/name')->getCollection()->addFieldToFilter('group_id', $val);
2
  • 1
    oh I am embarrassed $val wasn't set properly oops, thank you anyhow Jul 19, 2016 at 3:56
  • Generally a good comment, but it depends on the implementation of the custom collection
    – scrowler
    Jul 19, 2016 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.