Here is a code snippet exaple how you fetch all products by it’s attribute set name:-
//Fetch attribute set id by attribute set name
$attrSetName = 'my_custom_attribute';
$attributeSetId = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
//Load product model collecttion filtered by attribute set id
$products = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('name')
->addFieldToFilter('attribute_set_id', $attributeSetId);
//process your product collection as per your bussiness logic
$productsName = array();
foreach($products as $p){
$productsName[] = $p->getData('name');
}
//return all products name with attribute set 'my_custom_attribute'
print_r($productsName);
That’s it, have happy time with magento
!!!
Advertisement

Really useful tip, thanks.
This code looks great. However, where do you add it in Magento? Can you edit your post with the path where this snippet needs to go?
Thanks….
Newbie,
This is simply a code snippet , not a module. If your requirement needs to load all products by attribute set you can use this snippet.
Thanks
Thanks for this code.
But I want to load all products by color attribute.
Can you give me example?
I really enjoy reading your posts. I have a question that I’ve been searching and searching for — some of the things you have posted seem close, but I just can’t quite get it. I would like to setup a product that has many attributes. Let’s say 10 different attributes. Each attribute might have 20 different values. If you lined them up together in rows, then each row would define a specify product of that product type. What I’d like to do is define a product type that show up as though it were the product with a grid view of all the attributes that are associated with that product type (maybe category or sub-category). From there the user would select a radio button on the respective “row” that would indicate the specific SKU (i.e. that row that makes up the 10 different attributes and their respective values is unique and defines the product). From there add to the shopping cart. Would you be able to point me in the right direction? Thanks.
You should try Magento’s grouped product.
1.Create all you attributes as drop down with all possible values.
2.Create your products with all possible combination.
3.Create a grouped products and add previously create products as child with this.
nice article
Can you tell me how to add product to cart with multiple attribute
I’ll try this. THanks for sharing.
Awesome, great tips! Keep it up, thanks man!
Thanks. We can’t underestimate the affect that setting certain MySQL variables can have on performance and speed.
Thanks, Vicharo.