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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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