解決方法:
路徑:
\core\library\think\template\taglib\eyou
TagSporderlist.php文件:
增加部分的代碼:
// 一次性獲取所有訂單商品的archives數(shù)據(jù)
$allProductIds = [];
foreach ($orderDetails as $details) {
foreach ($details as $detail) {
$allProductIds[] = $detail['product_id'];
}
}
$allProductIds = array_unique($allProductIds);
$allArchives = [];
if (!empty($allProductIds)) {
$archivesList = Db::name('archives')->field('*')->where('aid', 'IN', $allProductIds)->select();
$typeids = get_arr_column($archivesList, 'typeid');
$arctypeList = Db::name('arctype')->field('*')->where('id', 'IN', $typeids)->getAllWithIndex('id');
foreach ($archivesList as $val) {
$allArchives[$val['aid']] = array_merge($arctypeList[$val['typeid']], $val);
}
}
替換的代碼:
// 商品詳情頁面地址
if (!empty($allArchives[$vv['product_id']])) {
// 商品存在
$details[$kk]['arcurl'] = urldecode(arcurl('home/Product/view', $allArchives[$vv['product_id']]));
} else {
// 商品不存在
$details[$kk]['arcurl'] = urldecode(url('home/View/index', ['aid'=>$vv['product_id']]));
}
參考截圖 修改

以左邊為準