How to echo/print attribute set name on frontend catalog page
-
12-12-2019 - |
Question
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.
Solution
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/