开发者

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

开发者 https://www.devze.com 2023-02-18 11:10 出处:网络
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

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..!!


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.


you can use functionally of setOrder('$attribute','ASC') to reorder

0

精彩评论

暂无评论...
验证码 换一张
取 消