示例#1
0
 function get_order_number()
 {
     return learn_press_transaction_order_number($this->post->ID);
 }
示例#2
0
        function order_details($post)
        {
            $user = learn_press_get_user(get_post_meta($post->ID, '_learn_press_customer_id', true));
            $order_items = learn_press_get_order_items($post->ID);
            $status = strtolower(get_post_meta($post->ID, '_learn_press_transaction_status', true));
            if ($status && !in_array($status, array('completed', 'pending'))) {
                $status = 'Pending';
            }
            $currency_symbol = learn_press_get_currency_symbol($order_items->currency);
            ?>
            <div class="order-details">
                <div class="order-data">
                    <div class="order-data-number"><?php 
            echo learn_press_transaction_order_number($post->ID);
            ?>
</div>
                    <div
                        class="order-data-date"><?php 
            echo learn_press_transaction_order_date($post->post_date);
            ?>
</div>
                    <div class="order-data-status <?php 
            echo sanitize_title($status);
            ?>
"><?php 
            echo $status;
            ?>
</div>
                    <div
                        class="order-data-payment-method"><?php 
            echo learn_press_payment_method_from_slug($post->ID);
            ?>
</div>
                </div>
                <div class="order-user-data clearfix">
                    <div class="order-user-avatar">
                        <?php 
            echo get_avatar($user->ID, 120);
            ?>
                    </div>
                    <div class="order-user-meta">
                        <h2 class="user-display-name">
                            <?php 
            echo empty($user->display_name) ? __('Unknown', 'learn_press') : $user->display_name;
            ?>
                        </h2>

                        <div class="user-email">
                            <?php 
            echo empty($user->user_email) ? __('Unknown', 'learn_press') : $user->user_email;
            ?>
                        </div>
                        <div class="user-ip-address">
                            <?php 
            echo get_post_meta($post->ID, '_learn_press_customer_ip', true);
            ?>
                        </div>
                    </div>
                </div>
                <div class="order-products">
                    <table>
                        <thead>
                        <tr>
                            <th colspan="2"><?php 
            _e('Courses', 'learn_press');
            ?>
</th>
                            <th class="align-right"><?php 
            _e('Amount', 'learn_press');
            ?>
</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php 
            if ($products = learn_press_get_transition_products($post->ID)) {
                foreach ($products as $pro) {
                    ?>
                            <tr>
                                <td colspan="2">
                                    <a href="<?php 
                    the_permalink($pro->ID);
                    ?>
"><?php 
                    echo get_the_title($pro->ID);
                    ?>
</a>
                                </td>
                                <td class="align-right"><?php 
                    echo $pro->amount ? learn_press_format_price($pro->amount, $currency_symbol) : __('Free!', 'learn_press');
                    ?>
</td>
                            </tr>
                        <?php 
                }
            }
            ?>
                        </tbody>
                        <tfoot>
                        <tr>
                            <td></td>
                            <td width="300" class="align-right"><?php 
            _e('Sub Total', 'learn_press');
            ?>
</td>
                            <td width="100"
                                class="align-right"><?php 
            echo learn_press_format_price($order_items->sub_total, $currency_symbol);
            ?>
</td>
                        </tr>
                        <tr>
                            <td></td>
                            <td class="align-right"><?php 
            _e('Total', 'learn_press');
            ?>
</td>
                            <td class="align-right total"><?php 
            echo learn_press_format_price($order_items->total, $currency_symbol);
            ?>
</td>
                        </tr>
                        <tr>
                            <td></td>
                            <td class="align-right" colspan="2">
                                <?php 
            _e('Status', 'learn_press');
            ?>
                                <select name="learn_press_order_status">
                                    <?php 
            foreach (learn_press_get_order_statuses() as $status => $label) {
                ?>
                                    <option value="<?php 
                echo $status;
                ?>
" <?php 
                selected($status == get_post_status($post->ID) ? 1 : 0, 1);
                ?>
><?php 
                echo $label;
                ?>
</option>
                                    <?php 
            }
            ?>
                                </select>
                                <button id="update-order-status" class="button button-primary" type="button"><?php 
            _e('Apply', 'learn_press');
            ?>
</button>
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        <?php 
        }
示例#3
0
        /**
         * Render column data
         *
         */
        function columns_content($column)
        {
            global $post;
            $the_order = learn_press_get_order($post->ID);
            //print_r($the_order->get_items());die();
            switch ($column) {
                case 'order_student':
                    if ($the_order->user_id) {
                        $user = learn_press_get_user($the_order->user_id);
                        printf('<a href="user-edit.php?user_id=%d">%s (%s)</a>', $the_order->user_id, $user->user_login, $user->display_name);
                        printf('<br /><span>%s</span>', $user->user_email);
                    } else {
                        _e('Guest', 'learn_press');
                    }
                    break;
                case 'order_status':
                    echo learn_press_get_order_status_label($post->ID);
                    break;
                case 'order_date':
                    $t_time = get_the_time('Y/m/d g:i:s a');
                    $m_time = $post->post_date;
                    $time = get_post_time('G', true, $post);
                    $time_diff = current_time('timestamp') - $time;
                    if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
                        $h_time = sprintf(__('%s ago', 'learn_press'), human_time_diff($time));
                    } else {
                        $h_time = mysql2date('Y/m/d', $m_time);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('learn_press_order_column_time', $h_time, $the_order)) . '</abbr>';
                    break;
                case 'order_items':
                    $links = array();
                    foreach ($the_order->get_items() as $item) {
                        $links[] = '<a href="' . get_the_permalink($item['course_id']) . '">' . get_the_title($item['course_id']) . '</a>';
                    }
                    echo join("<br />", $links);
                    break;
                case 'order_total':
                    echo learn_press_format_price($the_order->order_total, learn_press_get_currency_symbol($the_order->order_currency));
                    break;
                case 'order_title':
                    $order_number = sprintf("%'.010d", $the_order->ID);
                    ?>
					<div class="tips">
						<a href="post.php?post=<?php 
                    echo $the_order->ID;
                    ?>
&action=edit"><strong><?php 
                    echo learn_press_transaction_order_number($order_number);
                    ?>
</strong></a>

					</div>
					<?php 
                    break;
            }
        }