Zen-cart Extended National Table management

Source: Internet
Author: User

 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.