Error while fetch data from db
-
12-12-2019 - |
Question
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
Solution
I guess your model is not an Eav Model
and it is a simple flat table
Model .So You cannot used addAttributeToFilter()
function for filter the collection.
You can use addFieldToFilter()
in that case
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange