magento:修改lastname为非必填(本地化)

1,修改字段属性

UPDATE `eav_attribute` SET `is_required` = '0' WHERE `eav_attribute`.`attribute_id` =22;
UPDATE `eav_attribute` SET `is_required` = '0' WHERE `eav_attribute`.`attribute_id` =7;
UPDATE `customer_eav_attribute` SET `validate_rules` = 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:0;}' WHERE `customer_eav_attribute`.`attribute_id` =7;
UPDATE `customer_eav_attribute` SET `validate_rules` = 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:0;}' WHERE `customer_eav_attribute`.`attribute_id` =22;

执行以上两条sql,把字段属性先设置为非必填
2.去掉验证代码

app/code/core/Mage/Customer/Model/Address/Abstract.php
app/code/core/Mage/Customer/Model/Customer.php

找到
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
$errors[] = Mage::helper('customer')->__('Please enter the last name.');
}
并注释

One thought on “magento:修改lastname为非必填(本地化)”

  • ed

    Hi,在修改lastname为非必填后,当lastname为空值时,网站后台的客户管理列表中的“name”无显示,怎么解决?(magento1.8)

    回复
发表评论
Magento2 技术支持 上门服务

工作时间
周一至周六
9:00-18:00
相关咨询电话
15360669780
侨海科技