Пример #1
0
    ?>
</span></th>
				<th class="pre-order-release-date"><span class="nobr"><?php 
    _e('Release Date', 'wc-pre-orders');
    ?>
</span></th>
				<th class="pre-order-actions"></th>
			</tr>
		</thead>

		<tbody>
		<?php 
    foreach ($pre_orders as $order) {
        ?>
			<?php 
        $item = WC_Pre_Orders_Order::get_pre_order_item($order);
        ?>
			<tr class="order">
				<td class="order-number" width="1%">
					<a href="<?php 
        echo esc_url(add_query_arg('order', $order->id, get_permalink(woocommerce_get_page_id('view_order'))));
        ?>
"><?php 
        echo $order->get_order_number();
        ?>
</a>
				</td>
				<td class="pre-order-title">
					<a href="<?php 
        echo get_post_permalink($item['product_id']);
        ?>
 /**
  * Get column content, this is called once per column, per row item ($order)
  * returns the content to be rendered within that cell.
  *
  * @see WP_List_Table::single_row_columns()
  * @since 1.0
  * @param WC_Order $order one row (item) in the table
  * @param string $column_name the column slug
  * @return string the column content
  */
 public function column_default($order, $column_name)
 {
     switch ($column_name) {
         case 'status':
             $actions = array();
             // base action url
             $action_url = add_query_arg('order_id[]', $order->id);
             // determine any available actions
             if (WC_Pre_Orders_Manager::can_pre_order_be_changed_to('cancelled', $order)) {
                 $actions['cancel'] = sprintf('<a href="%s">%s</a>', add_query_arg('action', 'cancel', $action_url), __('Cancel', 'wc-pre-orders'));
             }
             $column_content = sprintf('<mark class="%s tips" data-tip="%s">%s</mark>', WC_Pre_Orders_Order::get_pre_order_status($order), WC_Pre_Orders_Order::get_pre_order_status_to_display($order), WC_Pre_Orders_Order::get_pre_order_status_to_display($order));
             $column_content .= $this->row_actions($actions);
             break;
         case 'customer':
             if (0 !== $order->user_id) {
                 $column_content = sprintf('<a href="%s">%s</a>', get_edit_user_link($order->user_id), $order->billing_email);
             } else {
                 $column_content = $order->billing_email;
             }
             break;
         case 'product':
             $item = WC_Pre_Orders_Order::get_pre_order_item($order);
             $product_edit = get_edit_post_link($item['product_id']);
             $column_content = $product_edit ? sprintf('<a href="%s">%s</a>', $product_edit, $item['name']) : $item['name'];
             break;
         case 'order':
             $column_content = sprintf('<a href="%s">%s</a>', get_edit_post_link($order->id), sprintf(__('Order %s', 'wc-pre-orders'), $order->get_order_number()));
             break;
         case 'order_date':
             $column_content = date_i18n(woocommerce_date_format(), strtotime($order->order_date));
             break;
         case 'availability_date':
             $product = WC_Pre_Orders_Order::get_pre_order_product($order);
             $column_content = WC_Pre_Orders_Product::get_localized_availability_date($product, '--');
             break;
         default:
             $column_content = '';
             break;
     }
     return $column_content;
 }