Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 9698

Questions related to Magento collections

17 votes
2 answers
30k views

Difference Between setData() and addData()

What's the difference between setData() and addData()? Is there a connection if I update a product or set a new one?
user1240207's user avatar
  • 1,339
0 votes
1 answer
1k views

Calculated Column using Product Custom Attribute in Zend_Db_Expr

$collection->getSelect()->columns(array('computed' => new Zend_Db_Expr ('custom_attr * (-1)'))); This gives me Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not … found: 1054 Unknown column 'custom_attr' in 'field list'' I'm trying to add a custom column in the collection based from a product attribute. …
user1240207's user avatar
  • 1,339
3 votes
1 answer
172 views

Use External Database for a Custom Collection

I've been following this thread but I couldn't get it to work, How do I get my Collection to use a different DB connection?. … I'm trying to load a collection from an external database separate from the main magento database. config.xml: <otherdb_setup> <connection> <host><! …
user1240207's user avatar
  • 1,339
4 votes
1 answer
713 views

Apply Saved Filters to Custom Collection

How am I going to apply these parameters upon loading the collection? … Mage::getModel('custom/model')->getCollection(); Or perhaps how am I going to retrieve the grid collection with the filters applied to it? …
user1240207's user avatar
  • 1,339
0 votes
1 answer
55 views

Loading Products Filtered by Category

This snippet works fine except that it returns a different set of product collection, mainly due to is anchor attribute: $category = Mage::getModel('catalog/category')->load(1371); $collection = Mage: … I could simulate what the cron is getting by defining: Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); I want to get the collection that includes the sub category products. …
user1240207's user avatar
  • 1,339
1 vote
2 answers
4k views

Adding Category Attribute to Select

I'm trying to add a custom category attribute to the category collection: $product = Mage::getModel('catalog/product'); $product->setId($productId); $categories = $product->getResource() ->getCategoryCollection … ($product) ->addAttributeToSelect('some_custom_attribute'); However, some_custom_attribute doesn't get included to the collection data: [4] => array(11) { ["entity_id"] => string(4) "1164" ["entity_type_id …
user1240207's user avatar
  • 1,339