1

Magento CE 1.9.0.1

I'm interested in echoing out the product attribute set name on the catalog/category pages. This sounds like a strange thing to do but we use Magento's attribute set in a unique way for classifying products.

I was attempting to pull it from the Mage::getModel('catalog/category') feature in my page template but was unsuccessful.

I also tried to pull the name with the following code:

$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($product->getAttributeSetId());
$attributeSetName  = $attributeSetModel->getAttributeSetName();
echo "<p>" . $attributeSetName "</p>";

Is there a way to get the name to display with their products on the frontend catalog pages? Thanks in advance.

  • 1
    you mean u need to print attribute set nsme on the product list page (ie when u click on the category url) ? – Pradeep Sanku Jan 30 '15 at 18:08
  • Yes, exactly that. – sparecycle Jan 30 '15 at 18:11
3

add the following code in your catalog/product/list.phtml

<?php
$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetModel->load($_product->getAttributeSetId()); // $product is your product object
echo $attributeSetName = $attributeSetModel->getAttributeSetName();
?>

Note check your listing of products is in grid mode or list mode and add accordingly above code

Please check for more in detail http://learnnewtechnologiesonline.com/magentoget-the-attribute-set-name-of-a-product-in-magento/

  • That's it! Worked perfectly. Last question: Do you know if it's possible to group products from the same attribute sets together (sort by ascending > attribute set name)? – sparecycle Jan 30 '15 at 18:21
  • will check and reply – Pradeep Sanku Jan 30 '15 at 18:22
  • Either way, thank you very much for your help Pradeep! – sparecycle Jan 30 '15 at 18:25
  • you need by attribute_set_id or attribute_set_name ? – Pradeep Sanku Jan 30 '15 at 18:48
  • 1
    i got product list collection by attribute_set_id – Pradeep Sanku Jan 30 '15 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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