opencart修改后台文件夹名

时间:2022-07-09 22:00:13

在使用opencart进行二次开发时,若需要修改后台目录的文件夹名是可以操作的。具体步骤如下:

1、将网站后台文件夹名字改成opencartadmin

2、在该文件夹下找到config.php文件如图

$document_root = $_SERVER['DOCUMENT_ROOT'];
$server_name = $_SERVER['SERVER_NAME'];
//$website_root = str_replace("admin/", "", $document_root); if ( isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1')) ) {
// HTTP
define('HTTP_SERVER', 'https://' . $server_name . '/admin/');
define('HTTP_CATALOG', 'https://' . $server_name . '/'); // HTTPS
define('HTTPS_SERVER', 'https://' . $server_name . '/admin/');
define('HTTPS_CATALOG', 'https://' . $server_name . '/'); define('CDN_SERVER', 'https://d1eki5bd8dytdi.cloudfront.net/'); } else {
// HTTP
define('HTTP_SERVER', 'http://' . $server_name . '/admin/');
define('HTTP_CATALOG', 'http://' . $server_name . '/'); // HTTPS
define('HTTPS_SERVER', 'http://' . $server_name . '/admin/');
define('HTTPS_CATALOG', 'http://' . $server_name . '/'); define('CDN_SERVER', 'http://d1eki5bd8dytdi.cloudfront.net/'); } // DIR
define('DIR_APPLICATION_GLOBAL', $document_root . '/');
define('DIR_APPLICATION', $document_root . '/admin/');
define('DIR_SYSTEM', $document_root . '/system/');
define('DIR_LANGUAGE', $document_root . '/admin/language/');
define('DIR_TEMPLATE', $document_root . '/admin/view/template/');
define('DIR_CONFIG', $document_root . '/system/config/');
define('DIR_IMAGE', $document_root . '/image/');
define('DIR_CACHE', $document_root . '/system/cache/');
define('DIR_DOWNLOAD', $document_root . '/system/download/');
define('DIR_UPLOAD', $document_root . '/system/upload/');
define('DIR_LOGS', $document_root . '/system/logs/');
define('DIR_MODIFICATION', $document_root . '/system/modification/');
define('DIR_CATALOG', $document_root . '/catalog/');
define('DIR_INVOICE', $document_root . '/admin/invoice/');
define('DIR_VENDOR', $document_root . '/vendor/');
define('DIR_EXCEL', $document_root . '/admin/excel/');
define('HTTP_PROTENTIAL_CUSTOMER_EXCEL', HTTP_SERVER . 'excel/protential_customer.xlsx');
define('HTTP_PROTENTIAL_MANUFACTURER_EXCEL', HTTP_SERVER . 'excel/protential_manufacturer.xlsx');
define('HTTP_EXCEL', HTTP_SERVER . 'excel/');
define('DEFAULT_VOLUME_ID', 4);
define('DEFAULT_PRICE_TYPE_ID', 1);
define('DEFAULT_ORDER_CUSTOMER_ID', 66);
define('ATTR_BRAND_ID', 18);
define('ATTR_GROUP_ID', 7);
define('ATTR_SPECIFICATION_ID', 21);
define('ATTR_EXPIRATION_ID', 13);
define('NORMAL_USER_ID', 5);
define('AUTHORIZED_USER_ID', 1);
define('RANDOM_SORT_BASE', 1000);
define('DEFAULT_CURRENCY', 'CNY');
define('STUFF_COMMISSION', 0.05);
define('MODEL_NO_LENGTH',6);
define('LENGTH_CLASS_ID_METER', 4);
define('FOB_CURRENCY_ID', 4); // DB
/*
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'cso-main-db.cukuz7fl9ajn.ap-southeast-1.rds.amazonaws.com');
define('DB_USERNAME', 'admin');
define('DB_PASSWORD', 'cso1234#');
define('DB_DATABASE', 'CSOMain');
define('DB_PREFIX', 'oc_');
*/
require_once("../inc/dbConfig.php");

然后用使用编辑器对admin全部替换成opencartadmin

<?php

$document_root = $_SERVER['DOCUMENT_ROOT'];
$server_name = $_SERVER['SERVER_NAME'];
//$website_root = str_replace("opencartadmin/", "", $document_root); if ( isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1')) ) {
// HTTP
define('HTTP_SERVER', 'https://' . $server_name . '/opencartadmin/');
define('HTTP_CATALOG', 'https://' . $server_name . '/'); // HTTPS
define('HTTPS_SERVER', 'https://' . $server_name . '/opencartadmin/');
define('HTTPS_CATALOG', 'https://' . $server_name . '/'); define('CDN_SERVER', 'https://d1eki5bd8dytdi.cloudfront.net/'); } else {
// HTTP
define('HTTP_SERVER', 'http://' . $server_name . '/opencartadmin/');
define('HTTP_CATALOG', 'http://' . $server_name . '/'); // HTTPS
define('HTTPS_SERVER', 'http://' . $server_name . '/opencartadmin/');
define('HTTPS_CATALOG', 'http://' . $server_name . '/'); define('CDN_SERVER', 'http://d1eki5bd8dytdi.cloudfront.net/'); } // DIR
define('DIR_APPLICATION_GLOBAL', $document_root . '/');
define('DIR_APPLICATION', $document_root . '/opencartadmin/');
define('DIR_SYSTEM', $document_root . '/system/');
define('DIR_LANGUAGE', $document_root . '/opencartadmin/language/');
define('DIR_TEMPLATE', $document_root . '/opencartadmin/view/template/');
define('DIR_CONFIG', $document_root . '/system/config/');
define('DIR_IMAGE', $document_root . '/image/');
define('DIR_CACHE', $document_root . '/system/cache/');
define('DIR_DOWNLOAD', $document_root . '/system/download/');
define('DIR_UPLOAD', $document_root . '/system/upload/');
define('DIR_LOGS', $document_root . '/system/logs/');
define('DIR_MODIFICATION', $document_root . '/system/modification/');
define('DIR_CATALOG', $document_root . '/catalog/');
define('DIR_INVOICE', $document_root . '/opencartadmin/invoice/');
define('DIR_VENDOR', $document_root . '/vendor/');
define('DIR_EXCEL', $document_root . '/opencartadmin/excel/');
define('HTTP_PROTENTIAL_CUSTOMER_EXCEL', HTTP_SERVER . 'excel/protential_customer.xlsx');
define('HTTP_PROTENTIAL_MANUFACTURER_EXCEL', HTTP_SERVER . 'excel/protential_manufacturer.xlsx');
define('HTTP_EXCEL', HTTP_SERVER . 'excel/');
define('DEFAULT_VOLUME_ID', 4);
define('DEFAULT_PRICE_TYPE_ID', 1);
define('DEFAULT_ORDER_CUSTOMER_ID', 66);
define('ATTR_BRAND_ID', 18);
define('ATTR_GROUP_ID', 7);
define('ATTR_SPECIFICATION_ID', 21);
define('ATTR_EXPIRATION_ID', 13);
define('NORMAL_USER_ID', 5);
define('AUTHORIZED_USER_ID', 1);
define('RANDOM_SORT_BASE', 1000);
define('DEFAULT_CURRENCY', 'CNY');
define('STUFF_COMMISSION', 0.05);
define('MODEL_NO_LENGTH',6);
define('LENGTH_CLASS_ID_METER', 4);
define('FOB_CURRENCY_ID', 4); // DB
/*
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'cso-main-db.cukuz7fl9ajn.ap-southeast-1.rds.amazonaws.com');
define('DB_USERNAME', 'opencartadmin');
define('DB_PASSWORD', 'cso1234#');
define('DB_DATABASE', 'CSOMain');
define('DB_PREFIX', 'oc_');
*/
require_once("../inc/dbConfig.php");

注意:一些vqmod模式的功能插件默认找admin这个后台文件夹名字,那你可以针对此vqmod的相应xml文件也做如此修改调整即可。