From 11951aa9570d97e42863204a0227213fe2a00c4d Mon Sep 17 00:00:00 2001 From: hayden-t Date: Mon, 15 Jul 2024 20:45:10 +0930 Subject: [PATCH] show upload name in cart --- upload/catalog/controller/common/cart.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/upload/catalog/controller/common/cart.php b/upload/catalog/controller/common/cart.php index 2ae2243b3bc..73b920b1eff 100644 --- a/upload/catalog/controller/common/cart.php +++ b/upload/catalog/controller/common/cart.php @@ -32,7 +32,19 @@ public function index(): string { foreach ($products as $product) { if ($product['option']) { foreach ($product['option'] as $key => $option) { - $product['option'][$key]['value'] = (oc_strlen($option['value']) > 20 ? oc_substr($option['value'], 0, 20) . '..' : $option['value']); + if ($option['type'] != 'file') { + $value = $option['value']; + } else { + $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); + + if ($upload_info) { + $value = $upload_info['name']; + } else { + $value = ''; + } + } + + $product['option'][$key]['value'] = (oc_strlen($value) > 20 ? oc_substr($value, 0, 20) . '..' : $value); } }