2

I am Trying to fetch and filter data from database

 $collection = Mage::getModel('some/some')->getCollection()->addAttributeToFilter(something);

but it give me an error

Fatal error: Call to undefined method My_Comment_Model_Mysql4_Comment_Collection::addAttributeToFilter() in C:\xampp\htdocs\sahara\app\design\frontend\default\default\template\comment\comment.phtml on line 9

1 Answer 1

2

I guess your model is not an Eav Model and it is a simple flat tableModel .So You cannot used addAttributeToFilter() function for filter the collection.

You can use addFieldToFilter() in that case

1
  • good catch amit Commented Dec 19, 2014 at 1:33

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.