Created
March 3, 2012 12:17
-
-
Save mikejolley/1965842 to your computer and use it in GitHub Desktop.
version of email_order_items_table for use outside of the class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach($order->get_items() as $item) : | |
$_product = $order->get_product_from_item( $item ); | |
$file = $sku = $variation = $image = ''; | |
if ($show_image) : | |
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $_product->id ), 'thumbnail'); | |
$image = apply_filters('woocommerce_order_product_image', '<img src="'.$src[0].'" alt="Product Image" height="'.$image_size[1].'" width="'.$image_size[0].'" style="vertical-align:middle; margin-right: 10px;" />', $_product); | |
endif; | |
if ($show_sku && $_product->get_sku()) : | |
$sku = ' (#' . $_product->get_sku() . ')'; | |
endif; | |
$item_meta = new order_item_meta( $item['item_meta'] ); | |
$variation = '<br/><small>' . $item_meta->display( true, true ) . '</small>'; | |
if ($show_download_links) : | |
if ($_product->exists) : | |
if ($_product->is_downloadable()) : | |
$file = '<br/><small>'.__('Download:', 'woocommerce').' <a href="' . $order->get_downloadable_file_url( $item['id'], $item['variation_id'] ) . '">' . $order->get_downloadable_file_url( $item['id'], $item['variation_id'] ) . '</a></small>'; | |
endif; | |
endif; | |
endif; | |
$return .= '<tr> | |
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'. $image . apply_filters('woocommerce_order_product_title', $item['name'], $_product) . $sku . $file . $variation . '</td> | |
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'.$item['qty'].'</td> | |
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'; | |
if ( $order->display_cart_ex_tax || !$order->prices_include_tax ) : | |
$ex_tax_label = ( $order->prices_include_tax ) ? 1 : 0; | |
$return .= woocommerce_price( $order->get_line_subtotal( $item ), array('ex_tax_label' => $ex_tax_label )); | |
else : | |
$return .= woocommerce_price( $order->get_line_subtotal( $item, true ) ); | |
endif; | |
$return .= ' | |
</td> | |
</tr>'; | |
// Show any purchase notes | |
if ($show_purchase_note) : | |
if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) : | |
$return .= '<tr><td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;">' . apply_filters('the_content', $purchase_note) . '</td></tr>'; | |
endif; | |
endif; | |
endforeach; | |
echo return; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment