Articles tagged with: collection
Problem: I had added a new product attribute. Suppose the attribute code is ‘test’. I have been trying to fetch/select that newly added product attribute. Here is my Magento collection code:- I don’t see the attribute ‘test’ when I print the collection data.
Here is a quick tip to add OR query and AND query to collection object. I am implementing this on product collection. Getting product collection
Scenario: You have created a custom module. You have entered certain data in your database. You need to show the data randomly. Solution:
There are different important functions that you can implement in your Collection object. The functions are present in Varien_Data_Collection_Db class. The class file is present in lib/Varien/Data/Collection/Db.php Here are some of the functions that you can use in your collection object:-
Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category? Category ids are stored for product in a [...]