Check if attribute code exists - magento-create-setup.php #3

florinel-chis opened this Issue Aug 14, 2012 · 1 comment

2 participants


After loading the attribute by code, it would be nice to check if the attribute code exists so you get a nice error message instead of stack trace...

 $m = Mage::getModel('catalog/resource_eav_attribute')


if(null===$m->getId()) {
        //attribute does not exist
        echo "//ERROR: Attribute code: *".$code."* does not exists\n";
        return false;

Good idea. I just pushed a fix for this.

@astorm astorm closed this Aug 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment