<?php if (!defined('ABSPATH')) { exit; } // Exit if accessed directly ?> <div class="panel panel-default"> <div class="panel-heading"> <a class="title" data-toggle="collapse" data-parent="#accordion" href="#collapse-<?php echo $product->id; ?> "> <?php echo '#' . absint($product->id) . ' — ' . apply_filters('woocommerce_admin_download_permissions_title', $product->get_title(), $download->product_id, $download->order_id, $download->order_key, $download->download_id) . ' — ' . sprintf(__('File %d: %s', 'woocommerce'), $file_count, woocommerce_get_filename_from_url($product->get_file_download_path($download->download_id))); ?> </a> <button rel="<?php echo absint($download->product_id) . ',' . esc_attr($download->download_id); ?> " class="revoke_access btn btn-danger btn-sm pull-right" data-order-id="<?php echo $download->order_id; ?> " data-nonce="<?php echo wp_create_nonce('revoke-access'); ?> "><?php _e('Revoke Access', 'woocommerce'); ?> </button>
?> <tr> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee; word-wrap:break-word;"><?php // Show title/image etc echo apply_filters('woocommerce_order_product_image', $image, $_product, $show_image); // Product name echo apply_filters('woocommerce_order_product_title', $item['name'], $_product); // SKU echo $show_sku && $_product->get_sku() ? ' (#' . $_product->get_sku() . ')' : ''; // File URLs if ($show_download_links && $_product->exists() && $_product->is_downloadable()) { $download_file_urls = $order->get_downloadable_file_urls($item['product_id'], $item['variation_id'], $item); $i = 0; foreach ($download_file_urls as $file_url => $download_file_url) { echo '<br/><small>'; $filename = woocommerce_get_filename_from_url($file_url); if (count($download_file_urls) > 1) { echo sprintf(__('Download %d:', 'woocommerce'), $i + 1); } elseif ($i == 0) { echo __('Download:', 'woocommerce'); } echo ' <a href="' . $download_file_url . '" target="_blank">' . $filename . '</a></small>'; $i++; } } // Variation echo $item_meta->meta ? '<br/><small>' . nl2br($item_meta->display(true, true)) . '</small>' : ''; ?> </td> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $item['qty'];
public static function render_products_table($order, $idx) { $packages = get_post_meta($order->id, '_wcms_packages', true); $package = $packages[$idx]; $products = $package['contents']; ob_start(); ?> <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee"> <thead> <tr> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Product', 'woocommerce'); ?> </th> <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Quantity', 'woocommerce'); ?> </th> </tr> </thead> <tbody> <?php foreach ($products as $item) { $_product = function_exists('get_product') ? get_product($item['product_id']) : new WC_Product($item['product_id']); $attachment_image_src = wp_get_attachment_image_src(get_post_thumbnail_id($_product->id), 'thumbnail'); $image = $attachment_image_src ? '<img src="' . current($attachment_image_src) . '" alt="Product Image" height="32" width="32" style="vertical-align:middle; margin-right: 10px;" />' : ''; ?> <tr> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee; word-wrap:break-word;"><?php // Show title/image etc echo apply_filters('woocommerce_order_product_image', $image, $_product, true); // Product name echo apply_filters('woocommerce_order_product_title', $_product->get_title(), $_product); // SKU echo $_product->get_sku() ? ' (#' . $_product->get_sku() . ')' : ''; // File URLs if ($_product->exists() && $_product->is_downloadable()) { $download_file_urls = $order->get_downloadable_file_urls($item['product_id'], $item['variation_id'], $item); $i = 0; foreach ($download_file_urls as $file_url => $download_file_url) { echo '<br/><small>'; $filename = woocommerce_get_filename_from_url($file_url); if (count($download_file_urls) > 1) { echo sprintf(__('Download %d:', 'woocommerce'), $i + 1); } elseif ($i == 0) { echo __('Download:', 'woocommerce'); } echo ' <a href="' . $download_file_url . '" target="_blank">' . $filename . '</a></small>'; $i++; } } ?> </td> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $item['quantity']; ?> </td> </tr> <?php } ?> </tbody> </table> <?php $contents = ob_get_clean(); return $contents; }