See Mage_Eav_Model_Entity_Setup::removeAttribute()
. It takes two arguments - the first is the entity code, and the second is the attribute code.
Edit - to run from a non-installation scope:
<?php
include 'app/Mage.php';
Mage::app();
$setup = Mage::getResourceModel('catalog/setup','catalog_setup');
$setup->removeAttribute('catalog_product','attr_code');
I'm not sure if I understand you correctly, but I'll try with explaining how the loading of the EAV Attributes actually (should) work(s).
If you save a Product in the Admin without choosing a Store View, the Attributes should all get stored with the default store id = 0.
An attribute in Magento has a Scope, which defines if it can be overridden on website or storeview level.
If you load a Product in the frontend, the values for the attributes are loaded from the current store view / website with a fallback to the default store.
So, if you want to save an attribute with the same value for all store views, you only have to save it with the store id = 0, or just do this in the admin context without setting a store id.
You do not have to save the attribute for every store view (if it does not change between them).
If you have to, you are probably not in the admin context or you have a module installed which messes sth up
Best Answer
EAV attributes in the
eav_attribute
table are directly linked to theentity_type
table. So all attributes can be revealed by a left-join query across those two tables:Example output:
Related non-SQL question: