难道是有一些扩展与1.4.2.0版本不兼容?例如,因为 Magento v. 1.7 在Mage_Customer_Helper_Address
类中确实有这个方法。您可以创建一个覆盖助手并将此方法添加到其中:
/**
* Get string with frontend validation classes for attribute
*
* @param string $attributeCode
* @return string
*/
public function getAttributeValidationClass($attributeCode)
{
/** @var $attribute Mage_Customer_Model_Attribute */
$attribute = isset($this->_attributes[$attributeCode]) ? $this->_attributes[$attributeCode]
: Mage::getSingleton('eav/config')->getAttribute('customer_address', $attributeCode);
$class = $attribute ? $attribute->getFrontend()->getClass() : '';
if (in_array($attributeCode, array('firstname', 'middlename', 'lastname', 'prefix', 'suffix', 'taxvat'))) {
if ($class && !$attribute->getIsVisible()) {
$class = ''; // address attribute is not visible thus its validation rules are not applied
}
/** @var $customerAttribute Mage_Customer_Model_Attribute */
$customerAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', $attributeCode);
$class .= $customerAttribute && $customerAttribute->getIsVisible()
? $customerAttribute->getFrontend()->getClass() : '';
$class = implode(' ', array_unique(array_filter(explode(' ', $class))));
}
return $class;
}