function set_cart_content()
 {
     global $current_user;
     if ($current_user->ID > 0) {
         $this->content = SunshineUser::get_user_meta('cart', false);
     } elseif (isset($_COOKIE['sunshine_cart_hash'])) {
         $this->content = maybe_unserialize(get_option('sunshine_cart_hash_' . $_COOKIE['sunshine_cart_hash']));
     }
     sunshine_array_sort_by_column($this->content, 'type');
 }
function sunshine_order_data_inner($post)
{
    // Use nonce for verification
    wp_nonce_field(plugin_basename(__FILE__), 'sunshine_noncename');
    // The actual fields for data entry
    $order_data = unserialize(get_post_meta($post->ID, '_sunshine_order_data', true));
    $items = unserialize(get_post_meta($post->ID, '_sunshine_order_items', true));
    sunshine_array_sort_by_column($items, 'type');
    ?>
	<p><strong><a href="<?php 
    echo admin_url('admin.php?page=sunshine_invoice_display&order=' . $post->ID . '&nonce=' . wp_create_nonce('sunshine_invoice'));
    ?>
"><?php 
    _e('Invoice', 'sunshine');
    ?>
</a> | <a href="#sunshine-lightroom-file-list" id="sunshine-file-list-link"><?php 
    _e('Image File List', 'sunshine');
    ?>
</a></strong></p>
	<div id="sunshine-file-list" style="display: none;">
		<?php 
    foreach ($items as $item) {
        if ($item['type'] == 'image') {
            $image_file_list[$item['image_id']] = get_post_meta($item['image_id'], 'sunshine_file_name', true);
        } elseif ($item['type'] == 'package') {
            foreach ($item['package_products'] as $package_product) {
                $image_file_list[$package_product['image_id']] = get_post_meta($package_product['image_id'], 'sunshine_file_name', true);
            }
        }
    }
    foreach ($image_file_list as &$file) {
        $file = str_replace(array('.jpg', '.JPG'), '', $file);
    }
    ?>
		<textarea rows="4" cols="50" onclick="this.focus();this.select()" readonly="readonly"><?php 
    echo join(', ', $image_file_list);
    ?>
</textarea>
		<p><?php 
    _e('Copy and paste the file names above into Lightroom\'s search feature (Library filter) to quickly find and create a new collection to make processing this order easier. Make sure you are using the "Contains" (and not "Contains All") search parameter.', 'sunshine');
    ?>
</p>
	</div>
	<script>
	jQuery(document).ready(function($){
		$('#sunshine-file-list-link').click(function(){
			$('#sunshine-file-list').slideToggle();
			return false;
		});
	});
	</script>
	<p><strong><?php 
    _e('Order Date', 'sunshine');
    ?>
:</strong> <?php 
    echo date(get_option('date_format'), strtotime($post->post_date));
    ?>
</p>
	<?php 
    if ($ip = get_post_meta($post->ID, 'ip', true)) {
        ?>
		<p><strong>IP Address:</strong> <?php 
        echo $ip;
        ?>
</p>
	<?php 
    }
    ?>
	<table width="100%" cellspacing="0" cellpadding="0" id="sunshine-order-data">
	<tr><th><?php 
    _e('Billing Info', 'sunshine');
    ?>
</th><th><?php 
    if (isset($order_data['shipping_first_name'])) {
        _e('Shipping Info', 'sunshine');
    }
    ?>
</th></tr>
	<tr>
		<td>
			<?php 
    echo $order_data['first_name'] . ' ' . $order_data['last_name'] . '<br />' . $order_data['address'];
    if ($order_data['address2']) {
        echo '<br />' . $order_data['address2'];
    }
    echo '<br />' . $order_data['city'] . ', ' . $order_data['state'] . ' ' . $order_data['zip'] . '<br />' . $order_data['country'] . '<br />' . $order_data['email'] . '<br />' . $order_data['phone'];
    ?>
		</td>
		<td>
			<?php 
    if (isset($order_data['shipping_first_name'])) {
        echo $order_data['shipping_first_name'] . ' ' . $order_data['shipping_last_name'] . '<br />' . $order_data['shipping_address'];
        if ($order_data['shipping_address2']) {
            echo '<br />' . $order_data['shipping_address2'];
        }
        echo '<br />' . $order_data['shipping_city'] . ', ' . $order_data['shipping_state'] . ' ' . $order_data['shipping_zip'] . '<br />' . $order_data['shipping_country'];
    }
    ?>
		</td>
	</tr>
	</table>
	<br /><br /><table id="sunshine-cart-items" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<th class="image"><?php 
    _e('Type', 'sunshine');
    ?>
</th>
		<th class="image"><?php 
    _e('Image', 'sunshine');
    ?>
</th>
		<th class="name"><?php 
    _e('Product', 'sunshine');
    ?>
</th>
		<th class="qty"><?php 
    _e('Qty', 'sunshine');
    ?>
</th>
		<th class="price"><?php 
    _e('Item Price', 'sunshine');
    ?>
</th>
		<th class="total"><?php 
    _e('Item Total', 'sunshine');
    ?>
</th>
	</tr>
	<?php 
    $i = 1;
    foreach ($items as $item) {
        ?>
		<tr class="item">
			<td class="type">
				<?php 
        echo ucwords(str_replace('_', ' ', $item['type']));
        ?>
			</td>
			<td class="image">
				<?php 
        if ($item['image_id'] > 0) {
            $image = get_post($item['image_id']);
            $gallery = get_post($image->post_parent);
            if ($thumb = wp_get_attachment_image_src($item['image_id'], array(50, 50))) {
                $image_html = '<img src="' . $thumb[0] . '" alt="' . $item['image_name'] . '" />';
            } else {
                $image_html = '<img src="http://placehold.it/100&text=Image+deleted" alt="Image has been deleted" />';
            }
        }
        echo apply_filters('sunshine_cart_image_html', $image_html, $item, $thumb);
        ?>
			</td>
			<td class="name">
				<strong><?php 
        echo $item['product_name'];
        ?>
</strong><br />
				<div class="comments"><?php 
        echo apply_filters('sunshine_cart_item_comments', $item['comments'], $item);
        ?>
</div>
			</td>
			<td class="qty">
				<?php 
        echo $item['qty'];
        ?>
			</td>
			<td class="price">
				<?php 
        sunshine_money_format($item['price']);
        ?>
			</td>
			<td class="total">
				<?php 
        sunshine_money_format($item['total']);
        ?>
			</td>
		</tr>

	<?php 
        $i++;
    }
    ?>
		<tr class="subtotal totals">
			<th colspan="5" align="right"><?php 
    _e('Subtotal', 'sunshine');
    ?>
</th>
			<td><?php 
    sunshine_money_format($order_data['subtotal']);
    ?>
</td>
		</tr>
		<tr class="tax totals">
			<th colspan="5" align="right"><?php 
    _e('Tax', 'sunshine');
    ?>
</th>
			<td><?php 
    sunshine_money_format($order_data['tax']);
    ?>
</td>
		</tr>
		<tr class="shipping totals">
			<th colspan="5" align="right"><?php 
    _e('Shipping', 'sunshine');
    ?>
 (<?php 
    echo sunshine_get_shipping_method_name($order_data['shipping_method']);
    ?>
)</th>
			<td>
				<?php 
    sunshine_money_format($order_data['shipping_cost']);
    ?>
			</td>
		</tr>
		<tr class="discounts totals">
			<th colspan="5" align="right">
				<?php 
    _e('Discounts', 'sunshine');
    ?>
				<?php 
    if (!empty($order_data['discount_items'])) {
        $discount_names = array();
        foreach ($order_data['discount_items'] as $discount_item) {
            $discount_names[] = $discount_item->name;
        }
        echo '<br />(' . join(', ', $discount_names) . ')';
    }
    ?>
			</th>
			<td>-<?php 
    sunshine_money_format($order_data['discount_total']);
    ?>
</td>
		</tr>
		<?php 
    if ($order_data['credits'] > 0) {
        ?>
		<tr class="credits totals">
			<th colspan="5" align="right"><?php 
        _e('Credits', 'sunshine');
        ?>
</th>
			<td>-<?php 
        sunshine_money_format($order_data['credits']);
        ?>
</td>
		</tr>
		<?php 
    }
    ?>

		<tr class="total totals">
			<th colspan="5" align="right"><?php 
    _e('Total', 'sunshine');
    ?>
</th>
			<td><?php 
    sunshine_money_format($order_data['total']);
    ?>
</td>
		</tr>
		<tr class="payment-method totals">
			<th colspan="5" align="right"><?php 
    _e('Payment Method', 'sunshine');
    ?>
</th>
			<td><?php 
    echo $order_data['payment_method'];
    ?>
</td>
		</tr>
	</table>
<?php 
}