Magento attributes in attribute set

can someone please tell me how to check if an attribute has been created?

I have a block which displays products based on a given attribute.
The thing is if the attribute has not been created, I’m getting an error on the frontend.

Is there a way to check if the attribute exists?

Thanks.

3 thoughts on “Magento attributes in attribute set”

  1. $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_id');
    

    Try above code which means check the status that is specified attribute available in magento ( if you know the id ).

  2. Try this as well :

    $attributes = $product->getAttributes();
    foreach ($attributes as $attribute) {
        if ($attribute->getIsVisibleOnFront()) {
            $value = $attribute->getFrontend()->getValue($product);
            // do something with $value here
        }
    }
    

Leave a Reply

Your email address will not be published. Required fields are marked *