Skip to content

Commit

Permalink
Merge pull request opencart#14048 from hayden-t/patch-11
Browse files Browse the repository at this point in the history
show upload name in cart
  • Loading branch information
danielkerr authored Jul 21, 2024
2 parents a7ae4b5 + 11951aa commit 5505b93
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion upload/catalog/controller/common/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 5505b93

Please sign in to comment.