仅在首页的 CS-Cart 管理员中,我收到错误消息:
警告:在第 255 行的 app\controllers\backend\index.php 中为 foreach() 提供的参数无效
这个函数的代码是:
function fn_get_orders_taxes_subtotal($orders, $params)
{
$subtotal = 0;
if (!empty($orders)) {
$_oids = array();
foreach ($orders as $order) {
if (in_array($order['status'], $params['paid_statuses'])) {
$oids[] = $order['order_id'];
}
}
if (empty($oids)) {
return $subtotal;
}
$taxes = db_get_fields('SELECT data FROM ?:order_data WHERE order_id IN (?a) AND type = ?s', $oids, 'T');
if (!empty($taxes)) {
foreach ($taxes as $tax) {
$tax = unserialize($tax);
foreach ($tax as $id => $tax_data) {
$subtotal += !empty($tax_data['tax_subtotal']) ? $tax_data['tax_subtotal'] : 0;
}
}
}
}
return $subtotal;
}
有问题的具体行是:
foreach ($tax as $id => $tax_data) {
有什么想法可能发生在这里吗?奇怪的是,这并没有显示是否打开了模板调试。