解決 OSCommeric 在 PHP5 上執行的問題

如果你是使用 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);
        }
    }
}

這就子就解決了

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *