在帐户创建页面中删除名字,姓氏和确认密码字段

时间:2012-06-19 11:14:59

标签: magento field

我进行了大量搜索,以删除帐户创建页面中first name, Last name and confirm password字段等必填字段。 到目前为止,我已从表required value from 1 to 0

重命名为eav_attribute

此后我隐藏first name, Last Name, Confirm Password来自register.phtml

但我还是得到了 The first name cannot be empty, The Last name cannot be empty, etc,..

有人知道怎么做吗?

请给我一个解决这个问题的想法..

1 个答案:

答案 0 :(得分:2)

您必须再更改两个文件:

更改/js/prototype/validation.js并注释掉以下行:

['validate-cpassword', 'Please make sure your passwords match.', function(v) {
                var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
                var pass = false;
                if ($('password')) {
                    pass = $('password');
                }
                var passwordElements = $$('.validate-password');
                for (var i = 0; i < passwordElements.size(); i++) {
                    var passwordElement = passwordElements[i];
                    if (passwordElement.up('form').id == conf.up('form').id) {
                        pass = passwordElement;
                    }
                }
                if ($$('.validate-admin-password').size()) {
                    pass = $$('.validate-admin-password')[0];
                }
                return (pass.value == conf.value);
            }],

之后,您还必须更改Magento Customer Core模型。有两种类型的验证:通过前端javascript和后端Customer模型。 使用您自己的客户模块重写模型。然后复制validate()公共函数。并注释掉以下几行:

$confirmation = $this->getConfirmation();
        if ($password != $confirmation) {
            $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
        }