コード例 #1
0
/**
 * Returns an instance of APP_Order for the given Post ID connected to Order
 * @param int $post_id				An post ID
 * @param  array $args (optional)	Additional params to pass to the WP_Query
 * @return APP_Order				An order object representing the order last connected to the post
 */
function appthemes_get_order_connected_to($post_id, $args = array())
{
    $connected = _appthemes_orders_get_connected($post_id, $args);
    if (!$connected->posts) {
        return false;
    }
    return appthemes_get_order($connected->post->ID);
}
コード例 #2
0
 /**
  * Retrieves an array of an order's items
  * @param int $order_id The Order ID
  * @return array
  */
 protected static function get_order_items($order_id)
 {
     $items = array();
     foreach (_appthemes_orders_get_connected($order_id)->posts as $post) {
         $meta = p2p_get_meta($post->p2p_id);
         $items[] = array('type' => $meta['type'][0], 'price' => $meta['price'][0], 'post_id' => $post->ID, 'post' => $post, 'unique_id' => $post->p2p_id);
     }
     return $items;
 }
コード例 #3
0
    public static function display()
    {
        global $post_ID;
        $user = get_current_user_id();
        $orders_shown = get_user_meta($user, 'appthemes_connected_orders_per_post_page', true);
        $orders = _appthemes_orders_get_connected($post_ID)->posts;
        $visible_orders = array_slice($orders, 0, $orders_shown);
        if (count($visible_orders) == 0) {
            return;
        }
        echo <<<EOF
<style type="text/css">
\t.connected-orders{
\t\tmargin-bottom: 20px;
\t}
</style>
EOF;
        $table = new APP_Connected_Orders_Table($visible_orders);
        $table->show();
    }