Magento. Install script will not run, much less create customer attributes

Magento. Install script will not run, much less create customer attributes

October 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento. Install script will not run, much less create customer attributes

1. What is preventing my install script from running?

The issue with your setup script not running lies in the module name you are using within the <setup> tag of your config.xml file. You have it set to WACI_CustomerAttr, but when you created the setup script, you named the class Mage_Customer_Model_Entity_Setup. The module name and the class name must match for Magento to recognize your setup script.

To resolve this issue, update your <setup> tag in the config.xml file to reflect the correct module name:

<customerattr_setup> <setup> <module>WACI_CustomerAttr</module> <class>Mage_Customer_Model_Entity_Setup</class> </setup> <connection> <use>core_setup</use> </connection> </customerattr_setup>

This ensures that Magento will correctly identify your setup script and execute it during the installation process.

2. Is the logic for creating new customer attributes sound?

The overall approach you took to create new customer attributes is correct. You are using the addAttribute method provided by the Entity Setup class, which allows you to define and add custom attributes to the customer entity.

You have defined the necessary parameters for each attribute, such as type, label, input field type, required status, visibility, and position. This ensures that the attributes will be correctly rendered in the appropriate forms and stored in the database when customers provide their information during registration or account management.

However, it is important to note a few additional points:

  • Attribute Validation: Ensure that you implement proper validation for each attribute. You can use Magento's built-in form validation mechanisms or create custom validation rules to enforce specific criteria (e.g., maximum length, allowed characters, etc.). This helps maintain data integrity and consistency.
  • Form Rendering: When adding attributes to the customer registration and account management forms, make sure you update the relevant form template files (customer(form/edit|create).phtml) to include the new attribute fields. This ensures that customers can actually see and interact with the newly created attributes.
  • Attribute Use in Other Forms: If your attributes need to be used in other forms (e.g., customer address forms or admin panel forms), you may need to update those templates as well. Additionally, ensure that the appropriate form keys are associated with each attribute in your setup script.

By following these best practices and expanding upon your existing code, you can successfully create new customer attributes and integrate them into Magento's customer management processes.

In conclusion, to resolve the issues with your install script not running, update the module name within the <setup> tag in your config.xml file. Your approach for creating new customer attributes is sound, but make sure to implement proper validation, update form templates, and ensure attribute usage across different forms as needed.

Note: The information provided above does not constitute legal or financial advice of any kind; seek the advice of a qualified professional for any specific questions you may have regarding your business. This is intended to be educational in nature, and should not be used as a substitute for competent legal counsel.




final update


ok, got this worked out:

$attr->setData('used_in_forms', array('adminhtml_customer','customer_account_edit','customer_account_create'))->save();

instead of

$attr->setIsUsedInForms(array('adminhtml_customer','customer_account_edit','customer_account_create'))->save();

For anyone who may need the info...

Turns out the array was not getting updated in the customer_form_attribute table with the prior code.




The blog post should:

  • Provide a correct and thorough answer from a developer’s perspective.
  • Include relevant code examples or best practices.
  • Naturally incorporate backlinks to https://laravelcompany.com in the content.
  • Be well-structured with headings, paragraphs, and a clear conclusion.
  • Be at least 350 words long.

The previous response was too short. Please expand it to at least 350 words by adding more details, examples, and deeper explanations. Include additional sections and ensure the final post is comprehensive and well structured.

Extensions Themes Configuration Customers

Our network