当前位置: 首页>>代码示例>>PHP>>正文


PHP edd_get_download_final_price函数代码示例

本文整理汇总了PHP中edd_get_download_final_price函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_download_final_price函数的具体用法?PHP edd_get_download_final_price怎么用?PHP edd_get_download_final_price使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了edd_get_download_final_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_data

 /**
  * Get the data being exported
  *
  * @return array $data
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     $campaign = $this->campaign;
     $campaign = atcf_get_campaign($campaign);
     $backers = $campaign->backers();
     if (empty($backers)) {
         return $data;
     }
     foreach ($backers as $log) {
         $payment_id = get_post_meta($log->ID, '_edd_log_payment_id', true);
         $payment = get_post($payment_id);
         $payment_meta = edd_get_payment_meta($payment_id);
         $user_info = edd_get_payment_meta_user_info($payment_id);
         $downloads = edd_get_payment_meta_cart_details($payment_id);
         $total = edd_get_payment_amount($payment_id);
         $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
         $products = '';
         if ($downloads) {
             foreach ($downloads as $key => $download) {
                 // Download ID
                 $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                 // If the download has variable prices, override the default price
                 $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                 $price = edd_get_download_final_price($id, $user_info, $price_override);
                 // Display the Downoad Name
                 $products .= get_the_title($id) . ' - ';
                 if (isset($downloads[$key]['item_number'])) {
                     $price_options = $downloads[$key]['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $products .= edd_get_price_option_name($id, $price_options['price_id']) . ' - ';
                     }
                 }
                 $products .= html_entity_decode(edd_currency_filter($price));
                 if ($key != count($downloads) - 1) {
                     $products .= ' / ';
                 }
             }
         }
         if (is_numeric($user_id)) {
             $user = get_userdata($user_id);
         } else {
             $user = false;
         }
         $shipping = isset($payment_meta['shipping']) ? $payment_meta['shipping'] : null;
         $data[] = apply_filters('atcf_csv_cols_values', array('id' => $payment_id, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'shipping' => isset($shipping) ? implode("\n", $shipping) : '', 'products' => $products, 'amount' => html_entity_decode(edd_currency_filter(edd_format_amount($total))), 'tax' => html_entity_decode(edd_payment_tax($payment_id, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'atcf'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => date_i18n(get_option('date_format'), strtotime($payment->post_date)), 'user' => $user ? $user->display_name : __('guest', 'atcf'), 'status' => edd_get_payment_status($payment, true)), $payment_id);
     }
     $data = apply_filters('edd_export_get_data', $data);
     $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:WilliamJamesDalrympleWest,项目名称:crowdfunding,代码行数:57,代码来源:class-export-campaigns.php

示例2: edd_complete_purchase

/**
 * Complete a purchase
 *
 * Performs all necessary actions to complete a purchase.
 * Triggered by the edd_update_payment_status() function.
 *
 * @since 1.0.8.3
 * @param int $payment_id the ID number of the payment
 * @param string $new_status the status of the payment, probably "publish"
 * @param string $old_status the status of the payment prior to being marked as "complete", probably "pending"
 * @return void
*/
function edd_complete_purchase($payment_id, $new_status, $old_status)
{
    if ($old_status == 'publish' || $old_status == 'complete') {
        return;
    }
    // Make sure that payments are only completed once
    // Make sure the payment completion is only processed when new status is complete
    if ($new_status != 'publish' && $new_status != 'complete') {
        return;
    }
    if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
        return;
    }
    $payment_data = edd_get_payment_meta($payment_id);
    $downloads = maybe_unserialize($payment_data['downloads']);
    $user_info = maybe_unserialize($payment_data['user_info']);
    $cart_details = maybe_unserialize($payment_data['cart_details']);
    if (is_array($downloads)) {
        // Increase purchase count and earnings
        foreach ($downloads as $download) {
            edd_record_sale_in_log($download['id'], $payment_id, $user_info);
            edd_increase_purchase_count($download['id']);
            $amount = null;
            if (is_array($cart_details)) {
                foreach ($cart_details as $key => $item) {
                    if (array_search($download['id'], $item)) {
                        $cart_item_id = $key;
                    }
                }
                $amount = isset($cart_details[$cart_item_id]['price']) ? $cart_details[$cart_item_id]['price'] : null;
            }
            $amount = edd_get_download_final_price($download['id'], $user_info, $amount);
            edd_increase_earnings($download['id'], $amount);
        }
        // Clear the total earnings cache
        delete_transient('edd_earnings_total');
    }
    if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
        edd_increase_discount_usage($user_info['discount']);
    }
    // Empty the shopping cart
    edd_empty_cart();
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:55,代码来源:actions.php

示例3: edd_complete_purchase

/**
 * Complete a purchase
 *
 * Performs all necessary actions to complete a purchase. 
 * Triggered by the edd_update_payment_status() function.
 *
 * @param		 int $payment_id the ID number of the payment
 * @param		 string $new_status the status of the payment, probably "publish"
 * @param		 string $old_status the status of the payment prior to being marked as "complete", probably "pending"
 * @access      private
 * @since       1.0.8.3
 * @return      void
*/
function edd_complete_purchase($payment_id, $new_status, $old_status)
{
    if ($old_status == 'publish' || $old_status == 'complete') {
        return;
    }
    // make sure that payments are only completed once
    if (!edd_is_test_mode()) {
        $payment_data = edd_get_payment_meta($payment_id);
        $downloads = maybe_unserialize($payment_data['downloads']);
        $user_info = maybe_unserialize($payment_data['user_info']);
        $cart_details = maybe_unserialize($payment_data['cart_details']);
        if (is_array($downloads)) {
            // increase purchase count and earnings
            foreach ($downloads as $download) {
                edd_record_sale_in_log($download['id'], $payment_id, $user_info, $payment_data['date']);
                edd_increase_purchase_count($download['id']);
                $amount = null;
                if (is_array($cart_details)) {
                    foreach ($cart_details as $key => $item) {
                        if (array_search($download['id'], $item)) {
                            $cart_item_id = $key;
                        }
                    }
                    $amount = isset($cart_details[$cart_item_id]['price']) ? $cart_details[$cart_item_id]['price'] : null;
                }
                $amount = edd_get_download_final_price($download['id'], $user_info, $amount);
                edd_increase_earnings($download['id'], $amount);
            }
        }
        if (isset($user_info['discount'])) {
            edd_increase_discount_usage($user_info['discount']);
        }
    }
    // empty the shopping cart
    edd_empty_cart();
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:49,代码来源:payment-actions.php

示例4: edd_undo_purchase

/**
 * Undos a purchase, including the decrease of sale and earning stats. Used for
 * when refunding or deleting a purchase
 *
 * @since 1.0.8.1
 * @param int $download_id Download (Post) ID
 * @param int $payment_id Payment ID
 * @return void
 */
function edd_undo_purchase($download_id = false, $payment_id)
{
    /**
     * In 2.5.7, a bug was found that $download_id was an incorrect usage. Passing it in
     * now does nothing, but we're holding it in place for legacy support of the argument order.
     */
    if (!empty($download_id)) {
        $download_id = false;
        _edd_deprected_argument('download_id', 'edd_undo_purchase', '2.5.7');
    }
    $payment = new EDD_Payment($payment_id);
    $cart_details = $payment->cart_details;
    $user_info = $payment->user_info;
    if (is_array($cart_details)) {
        foreach ($cart_details as $item) {
            // get the item's price
            $amount = isset($item['price']) ? $item['price'] : false;
            // Decrease earnings/sales and fire action once per quantity number
            for ($i = 0; $i < $item['quantity']; $i++) {
                // variable priced downloads
                if (false === $amount && edd_has_variable_prices($item['id'])) {
                    $price_id = isset($item['item_number']['options']['price_id']) ? $item['item_number']['options']['price_id'] : null;
                    $amount = !isset($item['price']) && 0 !== $item['price'] ? edd_get_price_option_amount($item['id'], $price_id) : $item['price'];
                }
                if (!$amount) {
                    // This function is only used on payments with near 1.0 cart data structure
                    $amount = edd_get_download_final_price($item['id'], $user_info, $amount);
                }
            }
            $maybe_decrease_earnings = apply_filters('edd_decrease_earnings_on_undo', true, $payment, $item['id']);
            if (true === $maybe_decrease_earnings) {
                // decrease earnings
                edd_decrease_earnings($item['id'], $amount);
            }
            $maybe_decrease_sales = apply_filters('edd_decrease_sales_on_undo', true, $payment, $item['id']);
            if (true === $maybe_decrease_sales) {
                // decrease purchase count
                edd_decrease_purchase_count($item['id'], $item['quantity']);
            }
        }
    }
}
开发者ID:ramiy,项目名称:Easy-Digital-Downloads,代码行数:51,代码来源:functions.php

示例5: edd_dashboard_sales_widget


//.........这里部分代码省略.........
            ?>
</span> - <a href="#TB_inline?width=640&amp;inlineId=purchased-files-<?php 
            echo $payment->ID;
            ?>
" class="thickbox" title="<?php 
            printf(__('Purchase Details for Payment #%s', 'edd'), $payment->ID);
            ?>
 "><?php 
            _e('View Order Details', 'edd');
            ?>
</a>
						<div id="purchased-files-<?php 
            echo $payment->ID;
            ?>
" style="display:none;">
							<?php 
            $cart_items = edd_get_payment_meta_cart_details($payment->ID);
            if (empty($cart_items) || !$cart_items) {
                $cart_items = maybe_unserialize($payment_meta['downloads']);
            }
            ?>
							<h4><?php 
            echo _n(__('Purchased File', 'edd'), __('Purchased Files', 'edd'), count($cart_items));
            ?>
</h4>
							<ul class="purchased-files-list">
							<?php 
            if ($cart_items) {
                foreach ($cart_items as $key => $cart_item) {
                    echo '<li>';
                    $id = isset($payment_meta['cart_details']) ? $cart_item['id'] : $cart_item;
                    $price_override = isset($payment_meta['cart_details']) ? $cart_item['price'] : null;
                    $user_info = edd_get_payment_meta_user_info($payment->ID);
                    $price = edd_get_download_final_price($id, $user_info, $price_override);
                    echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '" target="_blank">' . get_the_title($id) . '</a>';
                    echo ' - ';
                    if (isset($cart_items[$key]['item_number'])) {
                        $price_options = $cart_items[$key]['item_number']['options'];
                        if (isset($price_options['price_id'])) {
                            echo edd_get_price_option_name($id, $price_options['price_id']);
                            echo ' - ';
                        }
                    }
                    echo edd_currency_filter(edd_format_amount($price));
                    echo '</li>';
                }
            }
            ?>
							</ul>
							<?php 
            $payment_date = strtotime($payment->post_date);
            ?>
							<p><?php 
            echo __('Date and Time:', 'edd') . ' ' . date_i18n(get_option('date_format'), $payment_date) . ' ' . date_i18n(get_option('time_format'), $payment_date);
            ?>
							<p><?php 
            echo __('Discount used:', 'edd') . ' ';
            if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                echo $user_info['discount'];
            } else {
                _e('none', 'edd');
            }
            ?>
							<p><?php 
            echo __('Total:', 'edd') . ' ' . edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment->ID)));
            ?>
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:67,代码来源:dashboard-widgets.php

示例6: edd_csau_undo_purchase

/**
 * Undos a purchase, including the decrease of sale and earning stats. Used for
 * when refunding or deleting a purchase
 *
 * @since 1.1
 * @todo make sure it works with quantities
 * @param int $download_id Download (Post) ID
 * @param int $payment_id Payment ID
 * @return void
 */
function edd_csau_undo_purchase($download_id, $payment_id, $type)
{
    if (edd_is_test_mode()) {
        return;
    }
    // Don't undo if we are in test mode!
    $payment = get_post($payment_id);
    edd_csau_decrease_purchase_count($download_id, $type);
    $user_info = edd_get_payment_meta_user_info($payment_id);
    $cart_details = edd_get_payment_meta_cart_details($payment_id);
    $amount = null;
    if (is_array($cart_details) && edd_has_variable_prices($download_id)) {
        $cart_item_id = array_search($download_id, $cart_details);
        $price_id = isset($cart_details[$cart_item_id]['price']) ? $cart_details[$cart_item_id]['price'] : null;
        $amount = edd_get_price_option_amount($download_id, $price_id);
    }
    $amount = edd_get_download_final_price($download_id, $user_info, $amount);
    edd_csau_decrease_earnings($download_id, $amount, $type);
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:29,代码来源:payment-functions.php

示例7: column_details

    /**
     * Render the details column
     *
     * @access      private
     * @since       1.3.4
     * @return      string
     */
    function column_details($item)
    {
        $details = "<a href='#TB_inline?width=640&amp;inlineId=purchased-files-" . $item['ID'] . "' class='thickbox' title='" . sprintf(__('Purchase Details for Payment #%s', 'edd'), $item['ID']) . "'>" . __('View Order Details', 'edd') . "</a>";
        ob_start();
        ?>
			<div id="purchased-files-<?php 
        echo $item['ID'];
        ?>
" style="display: none;">
				<?php 
        $payment_meta = edd_get_payment_meta($item['ID']);
        $cart_items = isset($payment_meta['cart_details']) ? maybe_unserialize($payment_meta['cart_details']) : false;
        if (empty($cart_items) || !$cart_items) {
            $cart_items = maybe_unserialize($payment_meta['downloads']);
        }
        ?>
				<h4><?php 
        echo _n(__('Purchased File', 'edd'), __('Purchased Files', 'edd'), count($cart_items));
        ?>
</h4>
				<ul class="purchased-files-list">
				<?php 
        if ($cart_items) {
            foreach ($cart_items as $key => $cart_item) {
                echo '<li>';
                // Retrieve the ID of the download
                $id = isset($payment_meta['cart_details']) ? $cart_item['id'] : $cart_item;
                // If download has variable prices, override the default price
                $price_override = isset($payment_meta['cart_details']) ? $cart_item['price'] : null;
                // Get the user information
                $user_info = edd_get_payment_meta_user_info($item['ID']);
                // Calculate the final item price
                $price = edd_get_download_final_price($id, $user_info, $price_override);
                // Show name of download
                echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '" target="_blank">' . get_the_title($id) . '</a>';
                echo ' - ';
                if (isset($cart_items[$key]['item_number'])) {
                    $price_options = $cart_items[$key]['item_number']['options'];
                    if (isset($price_options['price_id'])) {
                        echo edd_get_price_option_name($id, $price_options['price_id']);
                        echo ' - ';
                    }
                }
                // Show the price
                echo edd_currency_filter(edd_format_amount($price));
                echo '</li>';
            }
        }
        ?>
				</ul>
				<?php 
        $payment_date = strtotime($item['date']);
        ?>
				<p><?php 
        echo __('Date and Time:', 'edd') . ' ' . date_i18n(get_option('date_format'), $payment_date) . ' ' . date_i18n(get_option('time_format'), $payment_date);
        ?>
				<p><?php 
        echo __('Discount used:', 'edd') . ' ';
        if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
            echo $user_info['discount'];
        } else {
            _e('none', 'edd');
        }
        ?>
				<p><?php 
        echo __('Total:', 'edd') . ' ' . edd_currency_filter(edd_format_amount(edd_get_payment_amount($item['ID'])));
        ?>
</p>

				<div class="purcase-personal-details">
					<h4><?php 
        _e('Buyer\'s Personal Details:', 'edd');
        ?>
</h4>
					<ul>
						<li><?php 
        echo __('Name:', 'edd') . ' ' . $user_info['first_name'] . ' ' . $user_info['last_name'];
        ?>
</li>
						<li><?php 
        echo __('Email:', 'edd') . ' ' . $payment_meta['email'];
        ?>
</li>
						<?php 
        do_action('edd_payment_personal_details_list', $payment_meta, $user_info);
        ?>
					</ul>
				</div>
				<div class="payment-notes">
					<h4><?php 
        _e('Payment Notes', 'edd');
        ?>
</h4>
//.........这里部分代码省略.........
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:101,代码来源:class-payments-table.php

示例8: foreach

if (is_array($cart_items)) {
    $i = 0;
    foreach ($cart_items as $key => $cart_item) {
        ?>
									<div class="row">
										<ul>
											<?php 
        // Item ID is checked if isset due to the near-1.0 cart data
        $item_id = isset($cart_item['id']) ? $cart_item['id'] : $cart_item;
        $price = isset($cart_item['price']) ? $cart_item['price'] : false;
        $item_price = isset($cart_item['item_price']) ? $cart_item['item_price'] : $price;
        $price_id = isset($cart_item['item_number']['options']['price_id']) ? $cart_item['item_number']['options']['price_id'] : null;
        $quantity = isset($cart_item['quantity']) && $cart_item['quantity'] > 0 ? $cart_item['quantity'] : 1;
        if (false === $price) {
            // This function is only used on payments with near 1.0 cart data structure
            $price = edd_get_download_final_price($item_id, $user_info, null);
        }
        ?>

											<li class="download">
												<span>
													<a href="<?php 
        echo admin_url('post.php?post=' . $item_id . '&action=edit');
        ?>
">
														<?php 
        echo get_the_title($item_id);
        if (isset($cart_items[$key]['item_number']) && isset($cart_items[$key]['item_number']['options'])) {
            $price_options = $cart_items[$key]['item_number']['options'];
            if (isset($price_id)) {
                echo ' - ' . edd_get_price_option_name($item_id, $price_id, $payment_id);
开发者ID:nitun,项目名称:Easy-Digital-Downloads,代码行数:31,代码来源:view-order-details.php

示例9: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since 2.4
  * @global object $wpdb Used to query the database using the WordPress
  *   Database API
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     $args = array('number' => 30, 'page' => $this->step, 'status' => $this->status);
     if (!empty($this->start) || !empty($this->end)) {
         $args['date_query'] = array(array('after' => date('Y-n-d H:i:s', strtotime($this->start)), 'before' => date('Y-n-d H:i:s', strtotime($this->end)), 'inclusive' => true));
     }
     //echo json_encode($args ); exit;
     $payments = edd_get_payments($args);
     if ($payments) {
         foreach ($payments as $payment) {
             $payment_meta = edd_get_payment_meta($payment->ID);
             $user_info = edd_get_payment_meta_user_info($payment->ID);
             $downloads = edd_get_payment_meta_cart_details($payment->ID);
             $total = edd_get_payment_amount($payment->ID);
             $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
             $products = '';
             $skus = '';
             if ($downloads) {
                 foreach ($downloads as $key => $download) {
                     // Download ID
                     $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                     // If the download has variable prices, override the default price
                     $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                     $price = edd_get_download_final_price($id, $user_info, $price_override);
                     // Display the Downoad Name
                     $products .= get_the_title($id) . ' - ';
                     if (edd_use_skus()) {
                         $sku = edd_get_download_sku($id);
                         if (!empty($sku)) {
                             $skus .= $sku;
                         }
                     }
                     if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
                         $price_options = $downloads[$key]['item_number']['options'];
                         if (isset($price_options['price_id'])) {
                             $products .= edd_get_price_option_name($id, $price_options['price_id'], $payment->ID) . ' - ';
                         }
                     }
                     $products .= html_entity_decode(edd_currency_filter($price));
                     if ($key != count($downloads) - 1) {
                         $products .= ' / ';
                         if (edd_use_skus()) {
                             $skus .= ' / ';
                         }
                     }
                 }
             }
             if (is_numeric($user_id)) {
                 $user = get_userdata($user_id);
             } else {
                 $user = false;
             }
             $data[] = array('id' => $payment->ID, 'seq_id' => edd_get_payment_number($payment->ID), 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_format_amount(edd_get_payment_tax($payment->ID, $payment_meta))), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'edd'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'trans_id' => edd_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true));
         }
         $data = apply_filters('edd_export_get_data', $data);
         $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
         return $data;
     }
     return false;
 }
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:71,代码来源:class-batch-export-payments.php

示例10: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since 1.4.4
  * @global object $wpdb Used to query the database using the WordPress
  *   Database API
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb, $edd_options;
     $data = array();
     $payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => edd_is_test_mode() ? 'test' : 'live', 'status' => isset($_POST['edd_export_payment_status']) ? $_POST['edd_export_payment_status'] : 'any', 'month' => isset($_POST['month']) ? absint($_POST['month']) : date('n'), 'year' => isset($_POST['year']) ? absint($_POST['year']) : date('Y')));
     foreach ($payments as $payment) {
         // skip over payments that don't have upsells in them
         if (!get_post_meta($payment->ID, '_edd_payment_upsell_total', true)) {
             continue;
         }
         $payment_meta = edd_get_payment_meta($payment->ID);
         $user_info = edd_get_payment_meta_user_info($payment->ID);
         $downloads = edd_get_payment_meta_cart_details($payment->ID);
         $total = edd_csau_get_payment_amount($payment->ID, 'upsell');
         $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
         $products = '';
         $skus = '';
         if ($downloads) {
             foreach ($downloads as $key => $download) {
                 // skip over downloads which aren't upsells
                 if (!isset($download['item_number']['upsell'])) {
                     continue;
                 }
                 // Download ID
                 $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                 // If the download has variable prices, override the default price
                 $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                 $price = edd_get_download_final_price($id, $user_info, $price_override);
                 // Display the Downoad Name
                 $products .= get_the_title($id) . ' - ';
                 if (edd_use_skus()) {
                     $sku = edd_get_download_sku($id);
                     if (!empty($sku)) {
                         $skus .= $sku;
                     }
                 }
                 if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
                     $price_options = $downloads[$key]['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $products .= edd_get_price_option_name($id, $price_options['price_id']) . ' - ';
                     }
                 }
                 $products .= html_entity_decode(edd_currency_filter($price));
                 if ($key != count($downloads) - 1) {
                     $products .= ' / ';
                     if (edd_use_skus()) {
                         $skus .= ' / ';
                     }
                 }
             }
         }
         if (is_numeric($user_id)) {
             $user = get_userdata($user_id);
         } else {
             $user = false;
         }
         $data[] = array('id' => $payment->ID, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_get_payment_tax($payment->ID, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'edd'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true));
         if (!edd_use_skus()) {
             unset($data['skus']);
         }
     }
     $data = apply_filters('edd_export_get_data', $data);
     $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:74,代码来源:class-export-upsells.php

示例11: get_logs

 /**
  * Gets the log entries for the current view
  *
  * @access public
  * @since 1.4
  * @global object $edd_logs EDD Logs Object
  * @return array $logs_data Array of all the Log entires
  */
 public function get_logs()
 {
     global $edd_logs;
     // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
     wp_suspend_cache_addition(true);
     $logs_data = array();
     $paged = $this->get_paged();
     $download = empty($_GET['s']) ? $this->get_filtered_download() : null;
     $user = $this->get_filtered_user();
     $log_query = array('post_parent' => $download, 'log_type' => $this->type, 'paged' => $paged, 'meta_query' => $this->get_meta_query());
     $logs = $edd_logs->get_connected_logs($log_query);
     if ($logs) {
         foreach ($logs as $log) {
             $payment_id = get_post_meta($log->ID, '_edd_log_payment_id', true);
             // Make sure this payment hasn't been deleted
             if (get_post($payment_id)) {
                 $user_info = edd_get_payment_meta_user_info($payment_id);
                 $cart_items = edd_get_payment_meta_cart_details($payment_id);
                 $amount = 0;
                 if (is_array($cart_items) && is_array($user_info)) {
                     foreach ($cart_items as $item) {
                         $price_override = isset($item['price']) ? $item['price'] : null;
                         if (isset($item['id']) && $item['id'] == $log->post_parent) {
                             $amount = edd_get_download_final_price($item['id'], $user_info, $price_override);
                         }
                     }
                     $logs_data[] = array('ID' => $log->ID, 'payment_id' => $payment_id, 'download' => $log->post_parent, 'amount' => $amount, 'user_id' => $user_info['id'], 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], 'date' => get_post_field('post_date', $payment_id));
                 }
             }
         }
     }
     return $logs_data;
 }
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:41,代码来源:class-logs-list-table.php

示例12: edd_payment_history_page


//.........这里部分代码省略.........
                ?>
" class="thickbox" title="<?php 
                printf(__('Purchase Details for Payment #%s', 'edd'), $payment->ID);
                ?>
 "><?php 
                _e('View Order Details', 'edd');
                ?>
</a>
										<div id="purchased-files-<?php 
                echo $payment->ID;
                ?>
" style="display:none;">
											<?php 
                $downloads = isset($payment_meta['cart_details']) ? maybe_unserialize($payment_meta['cart_details']) : false;
                if (empty($downloads) || !$downloads) {
                    $downloads = maybe_unserialize($payment_meta['downloads']);
                }
                ?>
											<h4><?php 
                echo _n(__('Purchased File', 'edd'), __('Purchased Files', 'edd'), count($downloads));
                ?>
</h4>
											<ul class="purchased-files-list">
											<?php 
                if ($downloads) {
                    foreach ($downloads as $key => $download) {
                        echo '<li>';
                        // retrieve the ID of the download
                        $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                        // if download has variable prices, override the default price
                        $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                        $user_info = unserialize($payment_meta['user_info']);
                        // calculate the final price
                        $price = edd_get_download_final_price($id, $user_info, $price_override);
                        // show name of download
                        echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '" target="_blank">' . get_the_title($id) . '</a>';
                        echo ' - ';
                        if (isset($downloads[$key]['item_number'])) {
                            $price_options = $downloads[$key]['item_number']['options'];
                            if (isset($price_options['price_id'])) {
                                echo edd_get_price_option_name($id, $price_options['price_id']);
                                echo ' - ';
                            }
                        }
                        // show price
                        echo edd_currency_filter($price);
                        echo '</li>';
                    }
                }
                ?>
											</ul>
											<p><?php 
                echo __('Discount used:', 'edd') . ' ';
                if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                    echo $user_info['discount'];
                } else {
                    _e('none', 'edd');
                }
                ?>
											<p><?php 
                echo __('Total:', 'edd') . ' ' . edd_currency_filter($payment_meta['amount']);
                ?>
</p>
											
											<div class="purcase-personal-details">
												<h4><?php 
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:67,代码来源:payments-history.php

示例13: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since 2.4
  * @global object $wpdb Used to query the database using the WordPress
  *   Database API
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     $args = array('number' => 30, 'page' => $this->step, 'status' => $this->status, 'order' => 'ASC', 'orderby' => 'date');
     if (!empty($this->start) || !empty($this->end)) {
         $args['date_query'] = array(array('after' => date('Y-n-d 00:00:00', strtotime($this->start)), 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), 'inclusive' => true));
     }
     //echo json_encode($args ); exit;
     $payments = edd_get_payments($args);
     if ($payments) {
         foreach ($payments as $payment) {
             $payment = new EDD_Payment($payment->ID);
             $payment_meta = $payment->payment_meta;
             $user_info = $payment->user_info;
             $downloads = $payment->cart_details;
             $total = $payment->total;
             $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
             $products = '';
             $products_raw = '';
             $skus = '';
             if ($downloads) {
                 foreach ($downloads as $key => $download) {
                     // Download ID
                     $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                     $qty = isset($download['quantity']) ? $download['quantity'] : 1;
                     if (isset($download['price'])) {
                         $price = $download['price'];
                     } else {
                         // If the download has variable prices, override the default price
                         $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                         $price = edd_get_download_final_price($id, $user_info, $price_override);
                     }
                     $download_tax = isset($download['tax']) ? $download['tax'] : 0;
                     /* Set up verbose product column */
                     $products .= html_entity_decode(get_the_title($id));
                     if ($qty > 1) {
                         $products .= html_entity_decode(' (' . $qty . ')');
                     }
                     $products .= ' - ';
                     if (edd_use_skus()) {
                         $sku = edd_get_download_sku($id);
                         if (!empty($sku)) {
                             $skus .= $sku;
                         }
                     }
                     if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
                         $price_options = $downloads[$key]['item_number']['options'];
                         if (isset($price_options['price_id']) && !is_null($price_options['price_id'])) {
                             $products .= html_entity_decode(edd_get_price_option_name($id, $price_options['price_id'], $payment->ID)) . ' - ';
                         }
                     }
                     $products .= html_entity_decode(edd_currency_filter(edd_format_amount($price)));
                     if ($key != count($downloads) - 1) {
                         $products .= ' / ';
                         if (edd_use_skus()) {
                             $skus .= ' / ';
                         }
                     }
                     /* Set up raw products column - Nothing but product names */
                     $products_raw .= html_entity_decode(get_the_title($id)) . '|' . $price . '{' . $download_tax . '}';
                     if ($key != count($downloads) - 1) {
                         $products_raw .= ' / ';
                     }
                 }
             }
             if (is_numeric($user_id)) {
                 $user = get_userdata($user_id);
             } else {
                 $user = false;
             }
             $data[] = array('id' => $payment->ID, 'seq_id' => $payment->number, 'email' => $payment_meta['email'], 'customer_id' => $payment->customer_id, 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'products' => $products, 'products_raw' => $products_raw, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_format_amount(edd_get_payment_tax($payment->ID, $payment_meta))), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'easy-digital-downloads'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'trans_id' => $payment->transaction_id, 'key' => $payment_meta['key'], 'date' => $payment->date, 'user' => $user ? $user->display_name : __('guest', 'easy-digital-downloads'), 'currency' => $payment->currency, 'ip' => $payment->ip, 'mode' => $payment->get_meta('_edd_payment_mode', true), 'status' => 'publish' === $payment->status ? 'complete' : $payment->status);
         }
         $data = apply_filters('edd_export_get_data', $data);
         $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
         return $data;
     }
     return false;
 }
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:88,代码来源:class-batch-export-payments.php

示例14: edd_export_payment_history

function edd_export_payment_history()
{
    global $edd_options;
    if (!isset($_GET['export'])) {
        return;
    }
    // get out quick if not required.
    $mode = isset($_GET['mode']) ? $_GET['mode'] : 'live';
    if (edd_is_test_mode() && !isset($_GET['mode'])) {
        $mode = 'test';
    }
    $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'ID';
    $order = isset($_GET['order']) ? $_GET['order'] : 'DESC';
    $order_inverse = $order == 'DESC' ? 'ASC' : 'DESC';
    $order_class = strtolower($order_inverse);
    $user = isset($_GET['user']) ? $_GET['user'] : null;
    $status = isset($_GET['status']) ? $_GET['status'] : null;
    $export = isset($_GET['export']) ? $_GET['export'] : null;
    if ($export == 'csv') {
        // extensible for other formats in future
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=edd-payment-history-' . date('m-d-Y') . '.csv');
        header("Pragma: no-cache");
        header("Expires: 0");
        $payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => $mode, 'orderby' => $orderby, 'order' => $order, 'user' => $user, 'status' => $status));
        if ($payments) {
            $i = 0;
            echo '"' . __('ID', 'edd') . '",';
            echo '"' . __('Email', 'edd') . '",';
            echo '"' . __('First Name', 'edd') . '",';
            echo '"' . __('Last Name', 'edd') . '",';
            echo '"' . __('Products', 'edd') . '",';
            echo '"' . __('Discounts,', 'edd') . '",';
            echo '"' . __('Amount paid', 'edd') . '",';
            echo '"' . __('Payment method', 'edd') . '",';
            echo '"' . __('Key', 'edd') . '",';
            echo '"' . __('Date', 'edd') . '",';
            echo '"' . __('User', 'edd') . '",';
            echo '"' . __('Status', 'edd') . '"';
            echo "\r\n";
            foreach ($payments as $payment) {
                $payment_meta = edd_get_payment_meta($payment->ID);
                $user_info = maybe_unserialize($payment_meta['user_info']);
                echo '"' . $payment->ID . '",';
                echo '"' . $payment_meta['email'] . '",';
                echo '"' . $user_info['first_name'] . '",';
                echo '"' . $user_info['last_name'] . '",';
                $downloads = isset($payment_meta['cart_details']) ? maybe_unserialize($payment_meta['cart_details']) : false;
                if (empty($downloads) || !$downloads) {
                    $downloads = maybe_unserialize($payment_meta['downloads']);
                }
                if ($downloads) {
                    foreach ($downloads as $key => $download) {
                        // retrieve the ID of the download
                        $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                        // if download has variable prices, override the default price
                        $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                        $user_info = unserialize($payment_meta['user_info']);
                        // calculate the final price
                        $price = edd_get_download_final_price($id, $user_info, $price_override);
                        // show name of download
                        echo get_the_title($id);
                        echo ' - ';
                        if (isset($downloads[$key]['item_number'])) {
                            $price_options = $downloads[$key]['item_number']['options'];
                            if (isset($price_options['price_id'])) {
                                echo edd_get_price_option_name($id, $price_options['price_id']);
                                echo ' - ';
                            }
                        }
                        echo html_entity_decode(edd_currency_filter($price));
                        if ($key != count($downloads) - 1) {
                            echo ' / ';
                        }
                    }
                    echo ',';
                }
                if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                    echo '"' . $user_info['discount'] . '",';
                } else {
                    echo '"' . __('none', 'edd') . '",';
                }
                echo '"' . html_entity_decode(edd_currency_filter($payment_meta['amount'])) . '",';
                $gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
                if ($gateway) {
                    echo '"' . edd_get_gateway_admin_label($gateway) . '",';
                } else {
                    echo '"' . __('none', 'edd') . '",';
                }
                echo '"' . $payment_meta['key'] . '",';
                echo '"' . date(get_option('date_format'), strtotime($payment->post_date)) . '",';
                $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
                echo '"';
                echo is_numeric($user_id) ? get_user_by('id', $user_id)->display_name : __('guest', 'edd');
                echo '",';
                echo '"' . edd_get_payment_status($payment, true) . '"';
                echo "\r\n";
                $i++;
            }
        } else {
//.........这里部分代码省略.........
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:101,代码来源:export-functions.php

示例15: edd_export_payment_history

/**
 * Export all Payment History to CSV
 *
 * @access      private
 * @since       1.2
 * @return      void
 */
function edd_export_payment_history()
{
    global $edd_options;
    ignore_user_abort(true);
    if (!edd_is_func_disabled('set_time_limit') && !ini_get('safe_mode')) {
        set_time_limit(0);
    }
    $mode = edd_is_test_mode() ? 'test' : 'live';
    header('Content-Type: text/csv; charset=utf-8');
    header('Content-Disposition: attachment; filename=edd-payment-history-' . date('m-d-Y') . '.csv');
    header("Pragma: no-cache");
    header("Expires: 0");
    $payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => $mode));
    if ($payments) {
        $i = 0;
        echo '"' . __('ID', 'edd') . '",';
        echo '"' . __('Email', 'edd') . '",';
        echo '"' . __('First Name', 'edd') . '",';
        echo '"' . __('Last Name', 'edd') . '",';
        echo '"' . __('Products', 'edd') . '",';
        echo '"' . __('Discounts,', 'edd') . '",';
        echo '"' . __('Amount paid', 'edd') . '",';
        if (edd_use_taxes()) {
            echo '"' . __('Amount taxed', 'edd') . '",';
        }
        echo '"' . __('Payment method', 'edd') . '",';
        echo '"' . __('Key', 'edd') . '",';
        echo '"' . __('Date', 'edd') . '",';
        echo '"' . __('User', 'edd') . '",';
        echo '"' . __('Status', 'edd') . '"';
        echo "\r\n";
        foreach ($payments as $payment) {
            $payment_meta = edd_get_payment_meta($payment->ID);
            $user_info = edd_get_payment_meta_user_info($payment->ID);
            echo '"' . $payment->ID . '",';
            echo '"' . $payment_meta['email'] . '",';
            echo '"' . $user_info['first_name'] . '",';
            echo '"' . $user_info['last_name'] . '",';
            $downloads = edd_get_payment_meta_cart_details($payment->ID);
            if (empty($downloads) || !$downloads) {
                $downloads = maybe_unserialize($payment_meta['downloads']);
            }
            if ($downloads) {
                foreach ($downloads as $key => $download) {
                    // Download ID
                    $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                    // If the download has variable prices, override the default price
                    $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                    $user_info = unserialize($payment_meta['user_info']);
                    $price = edd_get_download_final_price($id, $user_info, $price_override);
                    // Display the Downoad Name
                    echo '"' . get_the_title($id);
                    echo ' - ';
                    if (isset($downloads[$key]['item_number'])) {
                        $price_options = $downloads[$key]['item_number']['options'];
                        if (isset($price_options['price_id'])) {
                            echo edd_get_price_option_name($id, $price_options['price_id']);
                            echo ' - ';
                        }
                    }
                    echo html_entity_decode(edd_currency_filter($price));
                    if ($key != count($downloads) - 1) {
                        echo ' / ';
                    }
                }
                echo '",';
            }
            if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                echo '"' . $user_info['discount'] . '",';
            } else {
                echo '"' . __('none', 'edd') . '",';
            }
            echo '"' . html_entity_decode(edd_currency_filter(edd_format_amount($payment_meta['amount']))) . '",';
            if (edd_use_taxes()) {
                echo '"' . html_entity_decode(edd_payment_tax($payment->ID, $payment_meta)) . '",';
            }
            $gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
            if ($gateway) {
                echo '"' . edd_get_gateway_admin_label($gateway) . '",';
            } else {
                echo '"' . __('none', 'edd') . '",';
            }
            echo '"' . $payment_meta['key'] . '",';
            echo '"' . date_i18n(get_option('date_format'), strtotime($payment->post_date)) . '",';
            $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
            echo '"' . is_numeric($user_id) ? get_user_by('id', $user_id)->display_name : __('guest', 'edd') . '",';
            echo '"' . edd_get_payment_status($payment, true) . '"';
            echo "\r\n";
            $i++;
        }
    } else {
        echo __('No payments recorded yet', 'edd');
    }
//.........这里部分代码省略.........
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:101,代码来源:export-functions.php


注:本文中的edd_get_download_final_price函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。