Zen cart前台英文后台中文(Zen cart后台取消多语言输入的方法)
zen cart前台英文后台中文(zen cart后台取消多语言输入的方法)
方法是:在后台把默认语言设置成英文,这样每次打开前台和后台默认都是英文。当安装了超过一个语言后,zen cart后台有切换语言的功能,切换到中文就行了。
问题是:当安装了超过一个语言后,zen cart后台的分类和商品的编辑页面会把各个语言的输入框都列出来,导致页面过长,无用信息过多,浪费输入资料的时间。
我们要实现:不管后台切换到中文还是英文,分类和商品的编辑页面只保留英文语言输入。
1,\admin\includes\configure.php里的最后面加入下面几行:
代码:
define('ONLY_ONE_LANGUAGE_WHEN_EDITING', true); //bbs.phpdz.cn
define('THE_LANGUAGE_WHEN_EDITING', 'en');
//define('THE_LANGUAGE_WHEN_EDITING', 'gb');
2,\admin\includes\header.php里大概在18行,找到:
代码:
$languages = zen_get_languages();
变为:
代码:
$languages = zen_get_languages(false); //bbs.phpdz.cn
3,\admin\includes\functions\general.php里,找到:
代码:
function zen_get_languages() {
global $db;
$languages = $db->Execute("select languages_id, name, code, image, directory
from " . TABLE_LANGUAGES . " order by sort_order");
while (!$languages->EOF) {
$languages_array[] = array('id' => $languages->fields['languages_id'],
'name' => $languages->fields['name'],
'code' => $languages->fields['code'],
'image' => $languages->fields['image'],
'directory' => $languages->fields['directory']);
$languages->MoveNext();
}
return $languages_array;
}
变为:
代码:
//bbs.phpdz.cn
function zen_get_languages($only_one=ONLY_ONE_LANGUAGE_WHEN_EDITING) {
global $db;
if ($only_one){
$languages = $db->Execute("select languages_id, name, code, image, directory
from " . TABLE_LANGUAGES . " where code='" . THE_LANGUAGE_WHEN_EDITING . "'");
}
else{
$languages = $db->Execute("select languages_id, name, code, image, directory
from " . TABLE_LANGUAGES . " order by sort_order");
}
while (!$languages->EOF) {
$languages_array[] = array('id' => $languages->fields['languages_id'],
'name' => $languages->fields['name'],
'code' => $languages->fields['code'],
'image' => $languages->fields['image'],
'directory' => $languages->fields['directory']);
$languages->MoveNext();
}
return $languages_array;
}