六月 02
如果你在 MYSQL 強制設定
default-character-set = utf8
default-collation = utf8_general_ci
OSCommeric 還是不吃你這一套,存進去的資料仍然不會是UTF8

首先請先用 OSCommeric 備份你的資料庫,備份完後請先用文字檔確認內容沒有亂碼。(很重要,後面會用到)
接下來在下面2個檔案中修改程式
osc/includes/application_top.php
osc/admin/includes/application_top.php
找到
tep_db_connect() or die('Unable to connect to database server!');
修改成下面這個樣子(2個檔案都要修改)
tep_db_connect() or die('Unable to connect to database server!');
if (substr(mysql_get_server_info(), 0, 3) >= '4.1') {
tep_db_query("SET NAMES 'UTF8'");
}
改完後你會發現原來正常顯示的資料都變成亂碼,不用緊張
這時候再把我們之前備份的資料庫再還原回去(再次提醒還原前一定要確認備份的檔案內容是正常的,沒有亂碼的)
還原完成後,資料庫與網頁的顯示就都正常了。
四月 27
如果你是使用 KMD 的 OSCommeric 在 PHP5 上執行會有一些小問題
在後台按下 "客戶/訂單" 會出現下面的訊息
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in
/var/www/osc/admin/customers.php on line 763
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in
/var/www/osc/admin/customers.php on line 765
Warning: reset() [function.reset]: Passed variable is not an array or object in
/var/www/osc/admin/includes/classes/object_info.php on line 17
Warning: Variable passed to each() is not an array or object in
/var/www/osc/admin/includes/classes/object_info.php on line 18
要解決此問題要修正2個檔案
在 admin/customers.php 中找到下面程式
line 7XX: $customer_info = array_merge($country, $info, $reviews);
line 7XX: $cInfo_array = array_merge($customers, $customer_info);
修改成
$customer_info = array_merge((array)$country, (array)$info, (array)$reviews);
$cInfo_array = array_merge((array)$customers, (array)$customer_info);
---------------------------------------------------------------------------------------
在 admin/includes/classes/object_info.php 中找到下面程式
class objectInfo {
// class constructor
function objectInfo($object_array) {
reset($object_array);
while (list($key, $value) = each($object_array)) {
$this->$key = tep_db_prepare_input($value);
}
}
}
修改成
class objectInfo {
function objectInfo($object_array) {
$object_array = is_array($object_array) ? $object_array : array($object_array);
reset($object_array);
while(list($key, $value) = each($object_array)) {
$this->$key = tep_db_prepare_input($value);
}
}
}
這就子就解決了