Zen-cart the management of the national table is rough, especially in the corresponding country drop-down list to adjust, such as the common country to adjust to the front, then you need to expand the Country table field. Related to National table management is admin/countries.
Zen-cart the management of the national table is rough, especially in the corresponding country drop-down list to adjust, such as the common country to adjust to the front, then you need to expand the Country table field. Related to National table management is the admin/countries.php file, which requires some changes to this file: ///////////////////////
$cnt =
$db
->metaColumns(TABLE_COUNTRIES);
if
(!isset(
$cnt
[
strtoupper
(
‘countries_name_cn‘
)])){
$db
->Execute(
"ALTER TABLE "
.TABLE_COUNTRIES.
" ADD countries_name_cn VARCHAR( 64 ) NULL DEFAULT ‘‘"
);
}
if
(!isset(
$cnt
[
strtoupper
(
‘order_by‘
)])){
$db
->Execute(
"ALTER TABLE "
.TABLE_COUNTRIES.
" ADD order_by int(11) NOT NULL DEFAULT ‘0‘"
);
}
/////////////////////// Then there is the modification of the SQL when inserting the edits, and of course the subsequent modification of the form (omitted here). This can add the Chinese name and the sort code, after the sorting code added, but also to modify the two get the country drop-down list of functions (one for the foreground background): #includes/functions/functions_lookups.php
function zen_get_countries(
$countries_id =
‘‘
,
$with_iso_codes = false) {
global $db
;
$countries_array =
array
();
if (zen_not_null(
$countries_id
)) {
}
else {
///////////////////////
$cnt =
$db
->metaColumns(TABLE_COUNTRIES);
if
(!isset(
$cnt
[
strtoupper
(
‘order_by‘
)])){
$db
->Execute(
"ALTER TABLE "
.TABLE_COUNTRIES.
" ADD order_by int(11) NOT NULL DEFAULT ‘0‘"
);
}
///////////////////////
$countries = "select countries_id, countries_name
from
" . TABLE_COUNTRIES . "
order by order_by, countries_name";
$countries_values =
$db
->Execute(
$countries
);
while (!
$countries_values
->EOF) {
$countries_array
[] =
array
(
‘countries_id‘ =>
$countries_values
->fields[
‘countries_id‘
],
‘countries_name‘ =>
$countries_values
->fields[
‘countries_name‘
]);
$countries_values
->MoveNext();
}
}
return $countries_array
;
}
#admin/includes/functions/general.php
function zen_get_countries(
$default =
‘‘
) {
global $db
;
$countries_array =
array
();
if (
$default
) {
$countries_array
[] =
array
(
‘id‘ =>
‘‘
,
‘text‘ =>
$default
);
}
///////////////////////
$cnt =
$db
->metaColumns(TABLE_COUNTRIES);
if
(!isset(
$cnt
[
strtoupper
(
‘countries_name_cn‘
)])){
$db
->Execute(
"ALTER TABLE "
.TABLE_COUNTRIES.
" ADD countries_name_cn VARCHAR( 64 ) NULL DEFAULT ‘‘"
);
}
if
(!isset(
$cnt
[
strtoupper
(
‘order_by‘
)])){
$db
->Execute(
"ALTER TABLE "
.TABLE_COUNTRIES.
" ADD order_by int(11) NOT NULL DEFAULT ‘0‘"
);
}
///////////////////////
$countries =
$db
->Execute("select countries_id, countries_name,countries_name_cn
from
" . TABLE_COUNTRIES . "
order by order_by, countries_name");
while (!
$countries
->EOF) {
$countries_array
[] =
array
(
‘id‘ =>
$countries
->fields[
‘countries_id‘
],
‘text‘ =>
$countries
->fields[
‘countries_name‘
].
" - "
.
$countries
->fields[
‘countries_name_cn‘
]);
$countries
->MoveNext();
}
return $countries_array
;
}
The function adds logic to determine if the corresponding field exists, preventing an error. Enterprise Templates Web site |
Zen-cart Extended National Table management