1

我想知道如何通过安装/升级脚本更新 Magento 中的客户地址属性 - 特别是Input Validation下拉列表和Maximum Text Length字段。

截屏

4

1 回答 1

3

在您config.xml必须指明用于模块设置的模型:

//inside <global> node
<resources>
    <stackoverflow_question_setup>
        <setup>
            <module>StackOverflow_Question</module>
            <class>Mage_Customer_Model_Entity_Setup</class>
        </setup>
    </stackoverflow_question_setup>
</resources>

设置脚本:

<?php
/* @var $installer Mage_Customer_Model_Entity_Setup */
$installer = $this;
$installer->startSetup();
$data = array(
    'input_validation' => 'alpha',//see the values of the input validation dropdown to find out what you can put in here
    'max_text_length' => 456
);
$serializedData = serialize($data);
$installer->updateAttribute('customer_address', 'firstname', 'validate_rules', $serializedData);
$installer->endSetup();
于 2013-09-27T08:05:14.517 回答