3

How can I change the scope of the customer attribute property "validation_rules". This attribute exists in customer_eav_attribute (containing min_text_length and max_text_length).

Adding it to customer_eav_attribute_website does not work. Scope is still "global". Where do I have to customize?

$installer->getConnection()->addColumn($installer->getTable('customer/eav_attribute_website'), 'validate_rules',
    'text DEFAULT NULL');

Any ideas?

0

In Magento, there is only one scope for Customers. A customer is either unique per website or globally. Because of this, there is only 1 value for each customer per attribute. This is different from products which can have store and website level values.

I suggest that you either change your customer scope to website, if that is what you are actually after, or, more likely, come up with a different way to store the data you are trying to store on the customer entity.

You might consider creating a new model and structure it much like the static block model. This model has an identifier which can be the same across different instances. Each instance is tied to one or more store views. You could then store the "identifier" value for your model in the new customer "validation_rule_identifier" that replaces the "validation_rules" attribute that you have now. When you need the logic that was formerly using the validation_rules attribute, you should load the new model and filter by the current store and the current customer's validation_rule_identifier value. This should allow you to accomplish what you are hoping to do right now.

Unfortunately, the solution is not simpler although most of the logic is already built inside the static block model classes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.