Attachments not displaying
-
Hello! Good day. Plugin was working great till the last update for me. It did never work for me unless I updated the code from “frontend-my-account-attachments.php” and that was working perfectly. I have this coded saved so when the plugin update, I replace the php and all keep working good. With this recent updated, I upload the code and gives me critical error on the website so now my code doesn’t work and it’s no displaying attachments at front
<?php
$wcoa_attachments = WCOA_Attachment::get_list(0, get_current_user_id());
if (!$wcoa_attachments || count($wcoa_attachments) === 0) {
_e('There are no attachments to display.', 'sld-wcoa');
return;
}
// Define an array mapping file extensions to their corresponding icon URLs
$file_icons = array(
'vp3' => 'https://abdigitizing.com/wp-content/uploads/2024/06/VP3.png',
'xxx' => 'https://abdigitizing.com/wp-content/uploads/2024/06/XXX.png',
'zip' => 'https://abdigitizing.com/wp-content/uploads/2024/06/ZIP.png',
'dst' => 'https://abdigitizing.com/wp-content/uploads/2024/06/DST.png',
'emb' => 'https://abdigitizing.com/wp-content/uploads/2024/06/EMB.png',
'exp' => 'https://abdigitizing.com/wp-content/uploads/2024/06/EXP.png',
'hus' => 'https://abdigitizing.com/wp-content/uploads/2024/06/HUS.png',
'jef' => 'https://abdigitizing.com/wp-content/uploads/2024/06/JEF.png',
'pdf' => 'https://abdigitizing.com/wp-content/uploads/2024/06/PDF.png',
'pes' => 'https://abdigitizing.com/wp-content/uploads/2024/06/PES.png',
);
echo '<h2>' . __('Order Attachments', 'woocommerce') . '</h2>';
echo '<table class="order-attachments">';
echo '<thead><tr><th>' . __('Icon', 'woocommerce') . '</th><th>' . __('File Name', 'woocommerce') . '</th><th>' . __('Order', 'woocommerce') . '</th><th class="date-column">' . __('Date', 'woocommerce') . '</th><th>' . __('Action', 'woocommerce') . '</th></tr></thead>';
echo '<tbody>';
foreach ($wcoa_attachments as $item) {
$wcoa_order = wc_get_order($item['order_id']);
$item['order_url'] = $wcoa_order->get_view_order_url();
$file_url = $item['guid'];
$file_name = basename($file_url);
$file_extension = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
$attachment_date = $item['post_date'];
// Check if the file extension has a corresponding icon URL
$file_icon = isset($file_icons[$file_extension]) ? $file_icons[$file_extension] : ''; // Add a default icon URL if needed
echo '<tr>';
echo '<td><img src="' . esc_url($file_icon) . '" alt="' . esc_attr($file_extension) . ' Icon" height="50px"></td>'; // Icon with 50px height
echo '<td>' . esc_html($file_name) . '</td>'; // File name column
echo '<td><a href="' . esc_url($item['order_url']) . '">#' . esc_html($item['order_id']) . '</a></td>';
echo '<td class="date-column">' . esc_html($attachment_date) . '</td>'; // Date column
echo '<td><a href="' . esc_url($file_url) . '" class="button" target="_blank" download>' . __('Download', 'woocommerce') . '</a></td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
?>The page I need help with: [log in to see the link]
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.