我發現了兩種方法來解決這個問題。
- 刪除構建的前綴,並添加一個新的自定義前綴。
- 否決
Mage_Customer_Helper_Data
類和它的getNamePrefixOptions
方法。
我用Nr2時
NR 1:更多的工作,你將需要更新tempaltes。但是,如果需要添加新的翻譯,爲客戶管理起來更容易。
NR2:您可以在配置中添加更多前綴值。然後在課堂上製作一個用於商店/語言的開關。添加新的語言可能需要添加更多的代碼。
我用來推翻getNamePrefixOptions
public function getNamePrefixOptions($store = null)
{
$pre_val = $this->_prepareNamePrefixSuffixOptions(
Mage::helper('customer/address')->getConfig('prefix_options', $store)
);
// Show all prefixes in the admin
if (Mage::app()->getStore()->isAdmin()) {
return $pre_val;
}
// Transform array keys to integers
$pre_val = array_values($pre_val);
$lang_code = Mage::app()->getLocale()->getDefaultLocale();
$new_prefixes_values = array();
// Add language codes here, and add their prefix key's, count starts at 0
switch ($lang_code) {
case "nl_NL":
// Set key the same as the value, that's how Magetnto gives it at first
$new_prefixes_values = array($pre_val[0] => $pre_val[0], $pre_val[1] => $pre_val[1]);
break;
case "de_DE":
$new_prefixes_values = array($pre_val[2] => $pre_val[2], $pre_val[3] => $pre_val[3]);
break;
default: // other languages
$new_prefixes_values = array($pre_val[0] => $pre_val[0], $pre_val[1] => $pre_val[1]);
break;
}
return $new_prefixes_values;
}
我填補了前綴下拉選項設置什麼:Dhr.;Mevr.;Herr;Frau
這是一個有點硬編碼,但作品,並允許您更改值