Search Results
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 |
Questions related to Magento collections
1
vote
Filter product collection by non-flat attribute
when you create the attribute it should be on the Global level and filterable. This way it will be usable in the layared navigation.
Also it will require the attribute to be a dropdown or multiselect. …
1
vote
Associating Categories with Additional Collections Other Than Products
Also I suggest you add collection models to your extension for easy access to these collections you're building in the database and provide blocks through the extension that display this info in the frontend …
7
votes
Filter product collection by custom attribute
try and use
$collection->addAttributeToFilter('ean', '678678');
This post gives some nice pointers on using collections …
6
votes
Accepted
fatal error: Call to a member function getCollection() on a non-object in magento
The error basically tells us that Mage::getModel('easylife/easylife') doesn't return a valid class. Please make sure the file Ics/Easylife/Model/Easylife.php exists and looks somewhat like the code …
7
votes
Most efficient way to get all ID's from a collection
In this case you can use the collection object
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('entity_id');
[...]
do your loop
[...] …
0
votes
Accepted
using data from a collection to find link values
foreach ($_productCollection as $item)
{
var_dump($item->getData());exit;
}
A collection always returns a model for each item. … When calling Mage::getModel('catalog/product')->getCollection() each item in that collection will be of an instance op Mage_Catalog_Model_Product. …
5
votes
Accepted
How collections are working?
Basically a collection is from a resource class in an extension that specifies the table to use. … This class extends the core resource class which in it's turn extends a Varien Collection class which ends up using Zend to create the actual query that is executed. …
1
vote
How to display various special "sale items" pages?
This extension would need a template to render the products to a list or grid or whatever you would like and a block class behind it that retrieves the collection. … );
return $collection;
}
}
And then retrieve the products in your extensions template file using the getCollection method. …
2
votes
How to add an object to a collection?
When we take a look at template/checkout/onepage/billing.phtml we can see that the dropdown actually comes from the function getAddressesHtmlSelect, this function is located in the block class extende …
2
votes
$this->getProductCollection() returns only 15 items
It's probably due to the $this->getProductsCount() having a value of 15. This causes the query to only return 15 records.
Do a var_dump on this method to see if it is indeed 15.
5
votes
Product collection Sort by Custom attribute with yes/no Option
Also it's probably better to load the product collection via the catalog/category model instead of joining another table. … Also, to have yes come as last make the order ascending instead of descending
$category = Mage::getModel('catalog/category')->load(37);
$collection = $category->getProductCollection()
->addStoreFilter …
6
votes
How to attach order status to order item collection?
You can use the join method on the getSelect object
$collection = Mage::getResourceModel('sales/order_item_collection')
->addAttributeToSelect('*');
$collection->getSelect()->join( array('orders …
1
vote
What are the performance implications when loading collections in different ways?
Varien_Profiler::start(‘collection-method-one’); //start the profiler
$children = Mage::getModel('catalog/category')->getCollection();
$children->addAttributeToSelect('name')
->addAttributeToFilter … addAttributeToFilter('is_active', 1)
->addAttributeToFilter('include_in_menu', 1)
->addAttributeToSort('position');
Varien_Profiler::stop(‘your-key’);// end the profiler
Varien_Profiler::start(‘collection-method-two …
11
votes
Accepted
applying layered navigation to CMS page filled with new products
[Namespace]_[Module]_Model_Cron
{
public function assignToNew()
{
$collection = Mage::getResourceModel('catalog/product_collection')
$collection->addAttributeToFilter('updated_at … ', array('gteq' => date('Y-m-d', strtotime('-1 week')));
$collection->addAttributeToFilter('status', 1);
[...]
// whatever you need to filter
[...] …
19
votes
Accepted
How to list all users
Go ahead and try the following
$collection = mage::getModel('customer/customer')->getCollection();
var_dump((string)$collection->getSelect());
which will return you to following
SELECT e.* FROM … customer_entity AS e WHERE (e.entity_type_id
= '1')
This is the default query for a customer collection. …