Beispiel #1
0
/**
 * Sends email with receipt to admin after completed purchase.
 *
 * @param object $order
 */
function cp_send_admin_receipt($order)
{
    global $cp_options;
    if (is_admin() && !defined('DOING_AJAX')) {
        return;
    }
    $moderation = $cp_options->post_status != 'publish';
    $items_html = '';
    foreach ($order->get_items() as $item) {
        $ptype_obj = get_post_type_object($item['post']->post_type);
        if (!$ptype_obj->public) {
            continue;
        }
        if ($order->get_id() != $item['post']->ID) {
            $items_html .= html('p', html_link(get_permalink($item['post']->ID), $item['post']->post_title));
        } else {
            $items_html .= html('p', APP_Item_Registry::get_title($item['type']));
        }
    }
    $table = new APP_Order_Summary_Table($order);
    ob_start();
    $table->show();
    $table_output = ob_get_clean();
    $content = '';
    $content .= html('p', __('Dear Admin,', APP_TD));
    $content .= html('p', __('You have received payment for the following items:', APP_TD));
    $content .= $items_html;
    if ($moderation && $order->get_items(CP_ITEM_LISTING)) {
        $content .= html('p', __('Please review submitted ad listing, and approve it.', APP_TD));
    }
    $content .= html('p', __('Order Summary:', APP_TD));
    $content .= $table_output;
    $blogname = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
    $subject = sprintf(__('[%1$s] Received payment for order #%2$d', APP_TD), $blogname, $order->get_id());
    $email = array('to' => get_option('admin_email'), 'subject' => $subject, 'message' => $content);
    $email = apply_filters('cp_email_admin_receipt', $email, $order);
    appthemes_send_email($email['to'], $email['subject'], $email['message']);
}
/**
 * Displays the order summary table for the current order
 * @uses APP_Order_Summary_Table
 * @return void
 */
function the_order_summary()
{
    $order = get_order();
    $table = new APP_Order_Summary_Table($order);
    $table->show();
}
Beispiel #3
0
/**
 * Displays the order summary table for the current order.
 * @uses APP_Order_Summary_Table
 *
 * @param int $order_id (optional) If given, uses the specified order id, otherwise uses the order currently being queried.
 *
 * @return void
 */
function the_order_summary($order_id = null)
{
    $order = get_order($order_id);
    do_action('appthemes_before_order_summary', $order);
    $table = new APP_Order_Summary_Table($order);
    $table->show();
    do_action('appthemes_after_order_summary', $order);
}