0

I have a product attribute set name DSLR, in frontend page i need to get product collection filtered b this product attribute set

$dslrAttributeSetId = $this->getAttributeSetIdByName('DSLR'); //how??
$collection->addAttributeToFilter('attribute_set_id', array('eq' => $dslrAttributeSetId));

how can i get this product attribute set id by product attribute set name?

1 Answer 1

1

Here is the code for m1 you can take idea for this code for m2

<?php
$attributeSetName = "default"; // put your own attribute set name
$attribute_set = Mage::getModel("eav/entity_attribute_set")->getCollection();
$attribute_set->addFieldToFilter("attribute_set_name", $attributeSetName)->getFirstItem();
echo $attribute_set->getAttributeSetId();
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.