Why can't i use functions like ->addAttributeToSort('name', 'ASC'); in my custom model?

I had created a custom model which uses ORM, i tried out “Weblog” example in the link http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-5-magento-models-and-orm-basics and i was able to retrieve values from db using collection, but i cannot use functions like “->addAttributeToSort(‘name’, ‘ASC’);” with my collection object.

Are these functions specific only to product model such as “catalog/product”? if so how could i use such filtering capabilities to my custom function?

Thank you very much..!!

2 thoughts on “Why can't i use functions like ->addAttributeToSort('name', 'ASC'); in my custom model?”

  1. Those functions are specific to EAV models. Otherwise you are limited to the ‘field’ equivalents like addFieldToFilter() and addOrder().

    To make your custom model use an EAV resource read the rest of that tutorial, especially part 7.

Leave a Reply

Your email address will not be published. Required fields are marked *