/**
  * 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;
 }
コード例 #2
0
/**
 * 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();
}
コード例 #3
0
/**
 * 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();
}
コード例 #4
0
/**
 * 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']);
            }
        }
    }
}
コード例 #5
0
/**
 * Sales Summary Dashboard Widget
 *
 * @access      private
 * @author      Sunny Ratilal
 * @since       1.2.2
*/
function edd_dashboard_sales_widget()
{
    $top_selling_args = array('post_type' => 'download', 'posts_per_page' => 1, 'post_status' => 'publish', 'meta_key' => '_edd_download_sales', 'meta_compare' => '>', 'meta_value' => 0, 'orderby' => 'meta_value_num', 'cache_results' => false, 'update_post_term_cache' => false, 'no_found_rows' => true, 'order' => 'DESC');
    $top_selling = get_posts($top_selling_args);
    ?>
	<div class="table table_current_month">
		<p class="sub"><?php 
    _e('Current Month', 'edd');
    ?>
</p>
		<table>
			<tbody>
				<tr class="first">
					<td class="first b"><?php 
    echo edd_currency_filter(edd_format_amount(edd_get_earnings_by_date(null, date('n'), date('Y'))));
    ?>
</td>
					<td class="t monthly_earnings"><?php 
    _e('Earnings', 'edd');
    ?>
</td>
				</tr>
				<tr>
					<?php 
    $monthly_sales = edd_get_sales_by_date(null, date('n'), date('Y'));
    ?>
					<td class="first b"><?php 
    echo $monthly_sales;
    ?>
</td>
					<td class="t monthly_sales"><?php 
    echo _n('Sale', 'Sales', $monthly_sales, 'edd');
    ?>
</td>
				</tr>
			</tbody>
		</table>
		<p class="label_heading"><?php 
    _e('Last Month', 'edd');
    ?>
</p>
		<div>
			<?php 
    echo __('Earnings', 'edd') . ':&nbsp;<span class="edd_price_label">' . edd_currency_filter(edd_format_amount(edd_get_earnings_by_date(null, date('n') - 1, date('Y')))) . '</span>';
    ?>
		</div>
		<div>
			<?php 
    $last_month_sales = edd_get_sales_by_date(null, date('n') - 1, date('Y'));
    ?>
			<?php 
    echo _n('Sale', 'Sales', $last_month_sales, 'edd') . ':&nbsp;' . '<span class="edd_price_label">' . $last_month_sales . '</span>';
    ?>
		</div>
	</div>
	<div class="table table_totals">
		<p class="sub"><?php 
    _e('Totals', 'edd');
    ?>
</p>
		<table>
			<tbody>
				<tr class="first">
					<td class="b b-earnings"><?php 
    echo edd_currency_filter(edd_format_amount(edd_get_total_earnings()));
    ?>
</td>
					<td class="last t earnings"><?php 
    _e('Total Earnings', 'edd');
    ?>
</td>
				</tr>
				<tr>
					<td class="b b-sales"><?php 
    echo edd_get_total_sales();
    ?>
</td>
					<td class="last t sales"><?php 
    _e('Total Sales', 'edd');
    ?>
</td>
				</tr>
			</tbody>
		</table>
		<?php 
    if ($top_selling) {
        foreach ($top_selling as $list) {
            ?>
				<p class="lifetime_best_selling label_heading"><?php 
            _e('Lifetime Best Selling', 'edd');
            ?>
</p>
				<p><span class="lifetime_best_selling_label"><?php 
            echo edd_get_download_sales_stats($list->ID);
            ?>
</span> <a href="<?php 
            echo get_permalink($list->ID);
            ?>
"><?php 
            echo get_the_title($list->ID);
            ?>
</a></p>
		<?php 
        }
    }
    ?>
	</div>
	<div style="clear: both"></div>
	<?php 
    $payments = edd_get_payments(array('number' => 5, 'mode' => 'live', 'orderby' => 'post_date', 'order' => 'DESC', 'user' => null, 'status' => 'publish', 'meta_key' => null));
    if ($payments) {
        ?>
	<p class="edd_dashboard_widget_subheading"><?php 
        _e('Recent Purchases', 'edd');
        ?>
</p>
	<div class="table recent_purchases">
		<table>
			<tbody>
				<?php 
        foreach ($payments as $payment) {
            $payment_meta = edd_get_payment_meta($payment->ID);
            ?>
				<tr>
					<td><?php 
            echo get_the_title($payment->ID);
            ?>
 - (<?php 
            echo $payment_meta['email'];
            ?>
) - <span class="edd_price_label"><?php 
            echo edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment->ID)));
            ?>
</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)));
            ?>
</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>
							<?php 
            $gateway = edd_get_payment_gateway($payment->ID);
            if ($gateway) {
                ?>
							<div class="payment-method">
								<h4><?php 
                _e('Payment Method:', 'edd');
                ?>
</h4>
								<span class="payment-method-name"><?php 
                echo edd_get_gateway_admin_label($gateway);
                ?>
</span>
							</div>
							<?php 
            }
            ?>
							<div class="purchase-key-wrap">
								<h4><?php 
            _e('Purchase Key', 'edd');
            ?>
</h4>
								<span class="purchase-key"><?php 
            echo $payment_meta['key'];
            ?>
</span>
							</div>
							<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php 
            _e('Close', 'edd');
            ?>
"><?php 
            _e('Close', 'edd');
            ?>
</a></p>
						</div>
					</td>
				</tr>
				<?php 
        }
        // end foreach
        ?>
			</tbody>
		</table>
	</div>
	<?php 
    }
    // end if
}
コード例 #6
0
/**
 * 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);
}
コード例 #7
0
    /**
     * 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>
					<?php 
        $notes = edd_get_payment_notes($item['ID']);
        if (!empty($notes)) {
            echo '<ul id="payment-notes">';
            foreach ($notes as $note) {
                if (!empty($note->user_id)) {
                    $user = get_userdata($note->user_id);
                    $user = $user->display_name;
                } else {
                    $user = __('EDD Bot', 'edd');
                }
                echo '<div class="edd-payment-note"><strong>' . $user . '</strong>&nbsp;<em>' . $note->comment_date . '</em>&nbsp;&mdash;' . $note->comment_content . '</div>';
            }
            echo '</ul>';
        } else {
            echo '<p>' . __('No payment notes', 'edd') . '</p>';
        }
        ?>
				</div>
				<?php 
        $gateway = edd_get_payment_gateway($item['ID']);
        if ($gateway) {
            ?>
				<div class="payment-method">
					<h4><?php 
            _e('Payment Method:', 'edd');
            ?>
</h4>
					<span class="payment-method-name"><?php 
            echo edd_get_gateway_admin_label($gateway);
            ?>
</span>
				</div>
				<?php 
        }
        ?>
				<div class="purchase-key-wrap">
					<h4><?php 
        _e('Purchase Key', 'edd');
        ?>
</h4>
					<span class="purchase-key"><?php 
        echo $payment_meta['key'];
        ?>
</span>
				</div>
				<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php 
        _e('Close', 'edd');
        ?>
"><?php 
        _e('Close', 'edd');
        ?>
</a></p>
			</div>
<?php 
        $details .= ob_get_clean();
        return $details;
    }
コード例 #8
0
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);
コード例 #9
0
 /**
  * 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;
 }
コード例 #10
0
 /**
  * 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;
 }
コード例 #11
0
 /**
  * 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;
 }
コード例 #12
0
/**
 * Payment History Page
 *
 * Renders the payment history page contents.
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_payment_history_page()
{
    global $edd_options;
    if (isset($_GET['edd-action']) && $_GET['edd-action'] == 'edit-payment') {
        include_once EDD_PLUGIN_DIR . '/includes/admin-pages/forms/edit-payment.php';
    } else {
        $current_page = admin_url('edit.php?post_type=download&page=edd-payment-history');
        ?>
		<div class="wrap">
			<?php 
        if (isset($_GET['p'])) {
            $page = $_GET['p'];
        } else {
            $page = 1;
        }
        $per_page = 20;
        if (isset($_GET['show']) && $_GET['show'] > 0) {
            $per_page = intval($_GET['show']);
        }
        $total_pages = 1;
        $offset = $per_page * ($page - 1);
        $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'] : 'any';
        $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
        $payments = edd_get_payments(array('offset' => $offset, 'number' => $per_page, 'mode' => $mode, 'orderby' => $orderby, 'order' => $order, 'user' => $user, 'status' => $status, 'meta_key' => $meta_key));
        $payment_count = wp_count_posts('edd_payment');
        $total_count = $payment_count->publish + $payment_count->pending + $payment_count->refunded + $payment_count->trash;
        switch ($status) {
            case 'publish':
                $current_count = $payment_count->publish;
                break;
            case 'pending':
                $current_count = $payment_count->pending;
                break;
            case 'refunded':
                $current_count = $payment_count->refunded;
                break;
            case 'any':
                $current_count = $total_count;
                break;
        }
        $total_pages = ceil($current_count / $per_page);
        ?>
			<h2><?php 
        _e('Payment History', 'edd');
        ?>
</h2>
			<?php 
        do_action('edd_payments_page_top');
        ?>
			<ul class="subsubsub">
				<li class="all">
					<a href="<?php 
        echo remove_query_arg('status');
        ?>
" <?php 
        echo !isset($_GET['status']) ? 'class="current"' : '';
        ?>
>
						<?php 
        _e('All', 'edd');
        ?>
 
						<span class="count">(<?php 
        echo $total_count;
        ?>
)</span>
					</a> |
				</li>
				<li class="publish">
					<a href="<?php 
        echo add_query_arg('status', 'publish');
        ?>
" <?php 
        echo isset($_GET['status']) && $_GET['status'] == 'publish' ? 'class="current"' : '';
        ?>
><?php 
        _e('Completed', 'edd');
        ?>
 <span class="count">(<?php 
        echo $payment_count->publish;
        ?>
)</span></a> |
				</li>
				<li class="pending">
					<a href="<?php 
        echo add_query_arg('status', 'pending');
        ?>
" <?php 
        echo isset($_GET['status']) && $_GET['status'] == 'pending' ? 'class="current"' : '';
        ?>
><?php 
        _e('Pending', 'edd');
        ?>
 <span class="count">(<?php 
        echo $payment_count->pending;
        ?>
)</span></a> |
				</li>
				<li class="refunded">
					<a href="<?php 
        echo add_query_arg('status', 'refunded');
        ?>
" <?php 
        echo isset($_GET['status']) && $_GET['status'] == 'refunded' ? 'class="current"' : '';
        ?>
><?php 
        _e('Refunded', 'edd');
        ?>
 <span class="count">(<?php 
        echo $payment_count->refunded;
        ?>
)</span></a> |
				</li>
				<?php 
        do_action('edd_payments_page_statuses');
        ?>
			</ul>
			<ul class="subsubsub edd-export-payments">
				<li>&nbsp;<?php 
        _e('Export', 'edd');
        ?>
: <a href="<?php 
        echo add_query_arg('export', 'csv');
        ?>
">CSV</a></li>
				<?php 
        do_action('edd_payments_page_export_options');
        ?>
			</ul>	
			<form id="payments-filter" action="<?php 
        echo admin_url('edit.php');
        ?>
" method="get" style="float: right; margin-bottom: 5px;">
				<label for="edd-mode"><?php 
        _e('Payment mode', 'edd');
        ?>
</label>
				<select name="mode" id="edd-mode">
					<option value="live" <?php 
        selected('live', $mode);
        ?>
><?php 
        _e('Live', 'edd');
        ?>
</option>
					<option value="test" <?php 
        selected('test', $mode);
        ?>
><?php 
        _e('Test', 'edd');
        ?>
</option>
				</select>
				<input type="hidden" name="page" value="edd-payment-history"/>
				<input type="hidden" name="post_type" value="download"/>
				<?php 
        if (isset($_GET['user'])) {
            ?>
					<input type="hidden" name="user" value="<?php 
            echo $_GET['user'];
            ?>
"/>
				<?php 
        }
        ?>
				<?php 
        if (isset($_GET['status'])) {
            ?>
					<input type="hidden" name="status" value="<?php 
            echo $_GET['status'];
            ?>
"/>
				<?php 
        }
        ?>
				<label for="edd_show"><?php 
        _e('Payments per page', 'edd');
        ?>
</label>
				<input type="text" class="regular-text" style="width:30px;" id="edd_show" name="show" value="<?php 
        echo isset($_GET['show']) ? $_GET['show'] : '';
        ?>
"/>
				<input type="submit" class="button-secondary" value="<?php 
        _e('Show', 'edd');
        ?>
"/>
			</form>
			<?php 
        if (isset($_GET['user'])) {
            $user = is_numeric($user) ? get_userdata($user) : $user;
            $user = is_object($user) ? $user->display_name : $user;
            ?>
				<p class="clear"><?php 
            echo __('Showing payments for: ', 'edd') . '&nbsp' . $user;
            ?>
&nbsp;-&nbsp;<a href="<?php 
            echo remove_query_arg('user');
            ?>
"><?php 
            _e('clear', 'edd');
            ?>
</a></div>
			<?php 
        }
        ?>
			<table class="wp-list-table widefat fixed posts edd-payments">
				<thead>
					<tr>
						<th style="width: 60px;" class="manage-column column-title sortable <?php 
        echo $order_class;
        echo $orderby == 'ID' ? ' sorted' : '';
        ?>
">
						    <a href="<?php 
        echo add_query_arg(array('orderby' => 'ID', 'order' => $order_inverse));
        ?>
" title="<?php 
        _e('ID', 'edd');
        ?>
"><span><?php 
        _e('ID', 'edd');
        ?>
</span> <span class="sorting-indicator"></span></a>
						</th>
						<th style="width: 250px;"><?php 
        _e('Email', 'edd');
        ?>
</th>
						<th><?php 
        _e('Products', 'edd');
        ?>
</th>
						<th>
							<a href="<?php 
        echo add_query_arg(array('meta_key' => '_edd_payment_total', 'order' => $order_inverse, 'orderby' => 'meta_value_num'));
        ?>
" title="<?php 
        _e('Price', 'edd');
        ?>
"><span><?php 
        _e('Price', 'edd');
        ?>
</span> <span class="sorting-indicator"></span></a>
						</th>
						<th class="manage-column column-title sortable <?php 
        echo $order_class;
        echo $orderby == 'Date' ? ' sorted' : '';
        ?>
">
						    <a href="<?php 
        echo add_query_arg(array('orderby' => 'post_date', 'order' => $order_inverse));
        ?>
" title="<?php 
        _e('Date', 'edd');
        ?>
"><span><?php 
        _e('Date', 'edd');
        ?>
</span> <span class="sorting-indicator"></span></a>
						</th>
						<th><?php 
        _e('User', 'edd');
        ?>
</span></th>
						<th class="manage-column column-title sortable <?php 
        echo $order_class;
        echo $orderby == 'Status' ? ' sorted' : '';
        ?>
">
						    <a href="<?php 
        echo add_query_arg(array('orderby' => 'post_status', 'order' => $order_inverse));
        ?>
" title="<?php 
        _e('Status', 'edd');
        ?>
"><span><?php 
        _e('Status', 'edd');
        ?>
</span> <span class="sorting-indicator"></span></a>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<th style="width: 40px;"><?php 
        _e('ID', 'edd');
        ?>
</th>
						<th style="width: 250px;"><?php 
        _e('Email', 'edd');
        ?>
</th>
						<th><?php 
        _e('Products', 'edd');
        ?>
</th>
						<th><?php 
        _e('Price', 'edd');
        ?>
</th>
						<th><?php 
        _e('Date', 'edd');
        ?>
</th>
						<th><?php 
        _e('User', 'edd');
        ?>
</th>
						<th><?php 
        _e('Status', 'edd');
        ?>
</th>
					</tr>
				</tfoot>
				<tbody>
					<?php 
        if ($payments) {
            $i = 0;
            foreach ($payments as $payment) {
                ?>
							
								<?php 
                $payment_meta = get_post_meta($payment->ID, '_edd_payment_meta', true);
                $user_info = maybe_unserialize($payment_meta['user_info']);
                $classes = array();
                $classes[] = edd_is_odd($i) ? 'alternate' : '';
                $payment_classes = get_post_class(apply_filters('edd_payment_row_classes', $classes), $payment->ID);
                ?>
								<tr class="edd_payment <?php 
                echo implode(' ', $payment_classes);
                ?>
">
									<td>
										<?php 
                echo $payment->ID;
                ?>
									</td>
									<td>
										<?php 
                echo $payment_meta['email'];
                ?>
										<div class="row-actions">
											<?php 
                $row_actions = array('edit' => '<a href="' . add_query_arg(array('edd-action' => 'edit-payment', 'purchase_id' => $payment->ID)) . '">' . __('Edit', 'edd') . '</a>', 'email_links' => edd_is_payment_complete($payment->ID) ? '<a href="' . add_query_arg(array('edd-action' => 'email_links', 'purchase_id' => $payment->ID)) . '">' . __('Resend Purchase Receipt', 'edd') . '</a>' : NULL, 'delete' => '<a href="' . wp_nonce_url(add_query_arg(array('edd-action' => 'delete_payment', 'purchase_id' => $payment->ID)), 'edd_payment_nonce') . '">' . __('Delete', 'edd') . '</a>');
                $row_actions = apply_filters('edd_payment_row_actions', $row_actions, $payment);
                $action_count = count($row_actions);
                $i = 1;
                foreach ($row_actions as $key => $action) {
                    if ($action_count == $i) {
                        $sep = '';
                    } else {
                        $sep = ' | ';
                    }
                    echo !is_null($action) ? '<span class="' . $key . '">' . $action . '</span>' . $sep : '';
                    $i++;
                }
                ?>
										</div>
									</td>
									<td><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 
                $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 
                _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>
											
											<?php 
                $gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
                if ($gateway) {
                    ?>
											<div class="payment-method">
												<h4><?php 
                    _e('Payment Method:', 'edd');
                    ?>
</h4>
												<span class="payment-method-name"><?php 
                    echo edd_get_gateway_admin_label($gateway);
                    ?>
</span>
											</div>
											<?php 
                }
                ?>
											<div class="purchase-key-wrap">
												<h4><?php 
                _e('Purchase Key', 'edd');
                ?>
</h4>
												<span class="purchase-key"><?php 
                echo $payment_meta['key'];
                ?>
</span>
											</div>
											<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php 
                _e('Close', 'edd');
                ?>
"><?php 
                _e('Close', 'edd');
                ?>
</a></p>
										</div>
									</td>
									<td style="text-transform:uppercase;"><?php 
                echo edd_currency_filter($payment_meta['amount']);
                ?>
</td>
									<td><?php 
                echo date(apply_filters('edd_payments_page_date_format', get_option('date_format')), strtotime($payment->post_date));
                ?>
</td>
									<td>
										<?php 
                $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
                ?>
										<a href="<?php 
                echo remove_query_arg('p', add_query_arg('user', $user_id));
                ?>
">
											<?php 
                if (is_numeric($user_id)) {
                    $user = get_user_by('id', $user_id);
                    echo is_object($user) ? $user->display_name : __('guest', 'edd');
                } else {
                    echo __('guest', 'edd');
                }
                ?>
										</a>
									</td>
									<td><?php 
                echo edd_get_payment_status($payment, true);
                ?>
</td>
								</tr>
							<?php 
                $i++;
            }
        } else {
            ?>
						<tr><td colspan="7"><?php 
            _e('No payments recorded yet', 'edd');
            ?>
</td></tr>
					<?php 
        }
        ?>
				</table>
				<div class="tablenav">

					<div class="left edd-total-earnings">
						<p><?php 
        _e('Total Earnings:', 'edd');
        ?>
&nbsp;<strong><?php 
        echo edd_get_total_earnings();
        ?>
</strong></p>
						<?php 
        do_action('edd_payments_page_earnings');
        ?>
					</div>
					<?php 
        if ($total_pages > 1) {
            ?>
						<div class="tablenav-pages alignright">
							<?php 
            $query_string = $_SERVER['QUERY_STRING'];
            $base = 'edit.php?' . remove_query_arg('p', $query_string) . '%_%';
            echo paginate_links(array('base' => $base, 'format' => '&p=%#%', 'prev_text' => '&laquo; ' . __('Previous', 'edd'), 'next_text' => __('Next', 'edd') . ' &raquo;', 'total' => $total_pages, 'current' => $page, 'end_size' => 1, 'mid_size' => 5));
            ?>
	
						</div>
					<?php 
        }
        ?>
				</div><!--end .tablenav-->
				<?php 
        do_action('edd_payments_page_bottom');
        ?>
		</div><!--end wrap-->
		<?php 
    }
}
コード例 #13
0
 /**
  * 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;
 }
コード例 #14
0
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 {
            echo __('No payments recorded yet', 'edd');
        }
    }
    die;
}
コード例 #15
0
/**
 * 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');
    }
    die;
}
コード例 #16
0
 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.5
  * @return array
  */
 public function get_recent_sales()
 {
     $sales = array();
     $query = edd_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             $payment_meta = edd_get_payment_meta($payment->ID);
             $user_info = edd_get_payment_meta_user_info($payment->ID);
             $cart_items = edd_get_payment_meta_cart_details($payment->ID);
             $sales['sales'][$i]['ID'] = $payment->ID;
             $sales['sales'][$i]['key'] = edd_get_payment_key($payment->ID);
             $sales['sales'][$i]['subtotal'] = edd_get_payment_subtotal($payment->ID);
             $sales['sales'][$i]['tax'] = edd_get_payment_tax($payment->ID);
             $sales['sales'][$i]['fees'] = edd_get_payment_fees($payment->ID);
             $sales['sales'][$i]['total'] = edd_get_payment_amount($payment->ID);
             $sales['sales'][$i]['gateway'] = edd_get_payment_gateway($payment->ID);
             $sales['sales'][$i]['email'] = edd_get_payment_user_email($payment->ID);
             $sales['sales'][$i]['date'] = $payment->post_date;
             $sales['sales'][$i]['products'] = array();
             $c = 0;
             foreach ($cart_items as $key => $item) {
                 $price_override = isset($payment_meta['cart_details']) ? $item['price'] : null;
                 $price = edd_get_download_final_price($item['id'], $user_info, $price_override);
                 if (isset($cart_items[$key]['item_number'])) {
                     $price_name = '';
                     $price_options = $cart_items[$key]['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $price_name = edd_get_price_option_name($item['id'], $price_options['price_id'], $payment->ID);
                     }
                 }
                 $sales['sales'][$i]['products'][$c]['name'] = get_the_title($item['id']);
                 $sales['sales'][$i]['products'][$c]['price'] = $price;
                 $sales['sales'][$i]['products'][$c]['price_name'] = $price_name;
                 $c++;
             }
             $i++;
         }
     }
     return $sales;
 }
コード例 #17
0
/**
 * 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, $payment_id)
{
    $cart_details = edd_get_payment_meta_cart_details($payment_id);
    $user_info = edd_get_payment_meta_user_info($payment_id);
    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($download_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($download_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($download_id, $user_info, $amount);
                }
            }
            // decrease earnings
            edd_decrease_earnings($download_id, $amount);
            // decrease purchase count
            edd_decrease_purchase_count($download_id, $item['quantity']);
        }
    }
}
コード例 #18
0
function eddpdfi_pdf_template_vat($eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $eddpdfi_payment_gateway, $eddpdfi_payment_method, $address_line_2_line_height, $company_name, $eddpdfi_payment_date, $eddpdfi_payment_status)
{
    global $edd_options;
    if (!isset($edd_options['eddpdfi_templates'])) {
        $edd_options['eddpdfi_templates'] = 'default';
    }
    $color = empty($edd_options['edd_vat_pdf_colors']) ? "blue" : $edd_options['edd_vat_pdf_colors'];
    switch ($color) {
        case 'blue':
            $colors = array('body' => array(8, 75, 110), 'emphasis' => array(71, 155, 198), 'title' => array(0, 127, 192), 'header' => array(202, 226, 238), 'sub' => array(234, 242, 245), 'border' => array(166, 205, 226), 'notes' => array(7, 46, 66));
            break;
        case 'red':
            $colors = array('body' => array(110, 8, 8), 'emphasis' => array(198, 71, 71), 'title' => array(192, 0, 0), 'header' => array(238, 202, 202), 'sub' => array(245, 243, 243), 'border' => array(226, 166, 166), 'notes' => array(66, 7, 7));
            break;
        case 'green':
            $colors = array('body' => array(8, 110, 39), 'emphasis' => array(71, 198, 98), 'title' => array(0, 192, 68), 'header' => array(202, 238, 212), 'sub' => array(243, 245, 244), 'border' => array(166, 226, 179), 'notes' => array(7, 66, 28));
            break;
        case 'orange':
            $colors = array('body' => array(110, 54, 8), 'emphasis' => array(198, 134, 71), 'title' => array(192, 81, 0), 'header' => array(238, 219, 202), 'sub' => array(245, 245, 243), 'border' => array(226, 224, 166), 'notes' => array(65, 66, 7));
            break;
        case 'yellow':
            $colors = array('body' => array(109, 110, 8), 'emphasis' => array(197, 198, 71), 'title' => array(192, 190, 0), 'header' => array(238, 238, 202), 'sub' => array(245, 244, 243), 'border' => array(226, 193, 166), 'notes' => array(66, 38, 7));
            break;
        case 'purple':
            $colors = array('body' => array(66, 8, 110), 'emphasis' => array(137, 71, 198), 'title' => array(72, 0, 192), 'header' => array(208, 202, 238), 'sub' => array(244, 243, 245), 'border' => array(189, 166, 226), 'notes' => array(35, 7, 66));
            break;
        case 'pink':
            $colors = array('body' => array(110, 8, 82), 'emphasis' => array(198, 71, 152), 'title' => array(92, 0, 65), 'header' => array(238, 202, 232), 'sub' => array(245, 243, 245), 'border' => array(226, 166, 213), 'notes' => array(66, 7, 51));
            break;
    }
    $eddpdfi_pdf->AddFont('opensans', '');
    $eddpdfi_pdf->AddFont('opensansb', '');
    $font = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensans';
    $fontb = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensansb';
    $eddpdfi_pdf->SetMargins(8, 8, 8);
    $eddpdfi_pdf->SetX(8);
    $eddpdfi_pdf->AddPage();
    $eddpdfi_pdf->Ln(5);
    $eddpdfi_logo_size = 0;
    if (isset($eddpdfi_logo_size) && isset($edd_options['eddpdfi_logo_upload']) && !empty($edd_options['eddpdfi_logo_upload'])) {
        // $file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()
        $eddpdfi_pdf->Image($edd_options['eddpdfi_logo_upload'], 8, 10, 0, '25', '', false, 'LTR', false, 96);
    } else {
        $eddpdfi_pdf->SetFont($font, '', 22);
        $eddpdfi_pdf->SetTextColor(50, 50, 50);
        $eddpdfi_pdf->Cell(0, 0, $company_name, 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetFont($font, '', 18);
    $eddpdfi_pdf->SetTextColor($colors['title'][0], $colors['title'][1], $colors['title'][2]);
    $eddpdfi_pdf->SetY(45);
    if ($eddpdfi_payment_status === 'Refunded') {
        $eddpdfi_pdf->Cell(0, 0, 'Invoice Correction', 0, 2, 'L', false);
    } else {
        $eddpdfi_pdf->Cell(0, 0, __('Invoice', 'eddpdfi'), 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->SetXY(8, 60);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(0, 6, __('From', 'eddpdfi'), 0, 2, 'L', false);
    $eddpdfi_pdf->SetFont($font, '', 10);
    if (!empty($edd_options['edd_vat_company_name'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['edd_vat_company_name']), $edd_options['edd_vat_company_name'], 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_name'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_name']), eddpdfi_get_settings($eddpdfi_pdf, 'name'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_line1'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line1']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line1'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_line2'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line2']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line2'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_city_state_zip'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_city_state_zip']), eddpdfi_get_settings($eddpdfi_pdf, 'city_state_zip'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['base_country'])) {
        $countries = edd_get_country_list();
        $countries['UK'] = $countries['GB'];
        $country = $countries[$edd_options['base_country']];
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($country), $country, 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_email_address'])) {
        $eddpdfi_pdf->SetTextColor(41, 102, 152);
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_email_address']), eddpdfi_get_settings($eddpdfi_pdf, 'email'), 0, 2, 'L', false);
    }
    if (isset($edd_options['eddpdfi_url']) && $edd_options['eddpdfi_url']) {
        $eddpdfi_pdf->SetTextColor(41, 102, 152);
        $eddpdfi_pdf->Cell(0, 6, get_option('siteurl'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['edd_vat_number'])) {
        $vat_number = maybe_unserialize($edd_options['edd_vat_number']);
        if (!empty($vat_number['number'])) {
            //$vat_number = __(sprintf('%s ID ', apply_filters('lsl_tax_label','Tax')), 'edd_vat') . $vat_number['number'];
            $vat_number = 'VAT No. ' . $vat_number['number'];
            $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($vat_number), $vat_number, 0, 2, 'L', false);
        }
    }
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Ln(12);
    $eddpdfi_pdf->Ln();
    $eddpdfi_pdf->SetXY(60, 60);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(0, 6, __('To', 'eddpdfi'), 0, 2, 'L', false);
    $eddpdfi_pdf->SetFont($font, '', 10);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_buyer_info['first_name'] . ' ' . $eddpdfi_buyer_info['last_name'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetTextColor(41, 102, 152);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['email'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetTextColor(50, 50, 50);
    $eddpdfi_pdf->Ln(4);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Invoice Date', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_date, 0, 2, 'L', false);
    $eddpdfi_pdf->SetXY(60, 92);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Invoice ID', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    if (function_exists('eddpdfi_get_payment_number') && isset($edd_options['edd_vat_invoice_number'])) {
        $eddpdfi_pdf->Cell(0, 6, eddpdfi_get_payment_number($eddpdfi_payment->ID), 0, 2, 'L', false);
    } else {
        $eddpdfi_pdf->Cell(0, 6, '#' . $eddpdfi_payment->ID, 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Purchase Key', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['key'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Payment Status', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_status, 0, 2, 'L', false);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Payment Method', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_method, 0, 2, 'L', false);
    $offset = apply_filters('eddpdfi_pdf_template_extra_fields', 0, 'color', $eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $colors);
    $eddpdfi_pdf->SetXY(61, 120 + $offset);
    $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]);
    $eddpdfi_pdf->SetDrawColor($colors['border'][0], $colors['border'][1], $colors['border'][2]);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(140, 8, __('Invoice Items', 'eddpdfi'), 1, 2, 'C', true);
    $eddpdfi_pdf->Ln(0.2);
    $eddpdfi_pdf->SetX(61);
    $eddpdfi_pdf->SetFillColor($colors['sub'][0], $colors['sub'][1], $colors['sub'][2]);
    $eddpdfi_pdf->SetFont($font, '', 9);
    $qenabled = version_compare(EDD_VERSION, "1.9") >= 0 ? true : (function_exists('edd_item_quanities_enabled') ? edd_item_quanities_enabled() : false);
    $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 7, __('PRODUCT NAME', 'eddpdfi'), 'BL', 0, 'L', true);
    if ($qenabled) {
        $eddpdfi_pdf->Cell(10, 7, __('#', 'eddpdfi'), 'B', 0, 0, true);
    }
    $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 7, __('PRICE', 'eddpdfi'), 'BR', 0, 'R', true);
    $eddpdfi_pdf->Ln(0.2);
    $eddpdfi_pdf_downloads = isset($eddpdfi_payment_meta['cart_details']) ? maybe_unserialize($eddpdfi_payment_meta['cart_details']) : false;
    $eddpdfi_pdf->Ln();
    if ($eddpdfi_pdf_downloads) {
        $eddpdfi_pdf->SetX(61);
        $includes_taxes = edd_prices_include_tax();
        foreach ($eddpdfi_pdf_downloads as $key => $download) {
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->SetFont($font, '', 10);
            $eddpdfi_download_id = isset($eddpdfi_payment_meta['cart_details']) ? $download['id'] : $download;
            $eddpdfi_price_override = isset($eddpdfi_payment_meta['cart_details']) ? $download['price'] : null;
            $user_info = maybe_unserialize($eddpdfi_payment_meta['user_info']);
            $eddpdfi_final_download_price = edd_get_download_final_price($eddpdfi_download_id, $user_info, $eddpdfi_price_override);
            if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                $eddpdfi_discount = $user_info['discount'];
            } else {
                $eddpdfi_discount = __('None', 'eddpdfi');
            }
            // $eddpdfi_total_price = html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_payment_meta['amount'] ) ) );
            $eddpdfi_download_title = html_entity_decode(get_the_title($eddpdfi_download_id), ENT_COMPAT, 'UTF-8');
            if (edd_has_variable_prices($eddpdfi_download_id)) {
                $eddpdfi_download_title .= ' - ' . edd_get_cart_item_price_name($download);
                $options = $download['item_number']['options'];
            }
            // error_log(print_r($download,true));
            $options['is_item'] = $eddpdfi_download_id;
            $price = edd_get_cart_item_price($eddpdfi_download_id, $options, $includes_taxes);
            $eddpdfi_download_price = ' ' . html_entity_decode(edd_currency_filter(edd_format_amount($price)), ENT_COMPAT, 'UTF-8');
            //			$eddpdfi_download_price = ' ' . html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_final_download_price ) ), ENT_COMPAT, 'UTF-8' );
            $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 8, $eddpdfi_download_title, 'B', 0, 'L', false);
            if ($qenabled) {
                $quantity = is_array($download) ? $download['quantity'] : 1;
                $eddpdfi_pdf->Cell(10, 8, $quantity, 'B', 0, 'C', false);
            }
            $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 8, $eddpdfi_download_price, 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->Ln(5);
        $eddpdfi_pdf->SetX(61);
        $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]);
        $eddpdfi_pdf->SetFont($fontb, '', 10);
        $eddpdfi_pdf->Cell(140, 8, __('Invoice Totals', 'eddpdfi'), 1, 2, 'C', true);
        $eddpdfi_pdf->Ln(0.2);
        $eddpdfi_pdf->SetX(61);
        if (edd_use_taxes()) {
            //$taxrate = (edd_get_payment_amount( $eddpdfi_payment->ID ) - round(edd_get_payment_subtotal( $eddpdfi_payment->ID ))) / round(edd_get_payment_subtotal( $eddpdfi_payment->ID )) * 100;
            switch ($eddpdfi_buyer_info['address']['country']) {
                case 'BE':
                    $taxrate = '21%';
                    break;
                case 'BG':
                    $taxrate = '20%';
                    break;
                case 'CZ':
                    $taxrate = '21%';
                    break;
                case 'DK':
                    $taxrate = '25%';
                    break;
                case 'GB':
                    $taxrate = '20%';
                    break;
                case 'UK':
                    $taxrate = '20%';
                    break;
                case 'DE':
                    $taxrate = '19%';
                    break;
                case 'EE':
                    $taxrate = '20%';
                    break;
                case 'EL':
                    $taxrate = '23%';
                    break;
                case 'ES':
                    $taxrate = '21%';
                    break;
                case 'FR':
                    $taxrate = '20%';
                    break;
                case 'HR':
                    $taxrate = '25%';
                    break;
                case 'IE':
                    $taxrate = '23%';
                    break;
                case 'IT':
                    $taxrate = '22%';
                    break;
                case 'CY':
                    $taxrate = '19%';
                    break;
                case 'LV':
                    $taxrate = '21%';
                    break;
                case 'LT':
                    $taxrate = '21%';
                    break;
                case 'LU':
                    $taxrate = '17%';
                    break;
                case 'HU':
                    $taxrate = '27%';
                    break;
                case 'MT':
                    $taxrate = '18%';
                    break;
                case 'NL':
                    $taxrate = '21%';
                    break;
                case 'AT':
                    $taxrate = '20%';
                    break;
                case 'PL':
                    $taxrate = '23%';
                    break;
                case 'PT':
                    $taxrate = '23%';
                    break;
                case 'RO':
                    $taxrate = '24%';
                    break;
                case 'SI':
                    $taxrate = '22%';
                    break;
                case 'SK':
                    $taxrate = '20%';
                    break;
                case 'FI':
                    $taxrate = '24%';
                    break;
                case 'SE':
                    $taxrate = '25%';
                    break;
                default:
                    $taxrate = '0%';
            }
            $eddpdfi_pdf->Cell(102, 8, __('Subtotal', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_subtotal($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __(apply_filters('lsl_tax_label', 'Tax'), 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_tax($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __('VAT RATE', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, $taxrate, 'B', 2, 'R', false);
        }
        $fees = edd_get_payment_fees($eddpdfi_payment->ID);
        if (!empty($fees)) {
            foreach ($fees as $fee) {
                $eddpdfi_pdf->SetX(61);
                $eddpdfi_pdf->Cell(102, 8, $fee['label'], 'B', 0, 'L', false);
                $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_currency_filter($fee['amount']), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', true);
            }
        }
        if ($eddpdfi_discount !== __('None', 'eddpdfi')) {
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __('Discount Used', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, $eddpdfi_discount, 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->SetX(61);
        $eddpdfi_pdf->SetFont($fontb, '', 11);
        $eddpdfi_pdf->Cell(102, 10, __('Total Due', 'eddpdfi'), 'B', 0, 'L', false);
        if ($eddpdfi_payment_status === 'Refunded') {
            $eddpdfi_pdf->Cell(38, 10, '-' . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
        } else {
            $eddpdfi_pdf->Cell(38, 10, html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->Ln(10);
        if (isset($edd_options['eddpdfi_additional_notes']) && !empty($edd_options['eddpdfi_additional_notes'])) {
            $eddpdfi_pdf->SetX(60);
            $eddpdfi_pdf->SetFont($font, '', 13);
            $eddpdfi_pdf->Cell(0, 6, __('Additional Notes', 'eddpdfi'), 0, 2, 'L', false);
            $eddpdfi_pdf->Ln(2);
            $eddpdfi_pdf->SetX(60);
            $eddpdfi_pdf->SetFont($font, '', 10);
            $eddpdfi_pdf->SetTextColor($colors['notes'][0], $colors['notes'][1], $colors['notes'][2]);
            $eddpdfi_pdf->MultiCell(0, 6, eddpdfi_get_settings($eddpdfi_pdf, 'notes'), 0, 'L', false);
        }
    }
}
コード例 #19
0
 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.5
  * @return array
  */
 public function get_recent_sales()
 {
     global $wp_query;
     $sales = array();
     if (!user_can($this->user_id, 'view_shop_reports') && !$this->override) {
         return $sales;
     }
     if (isset($wp_query->query_vars['id'])) {
         $query = array();
         $query[] = new EDD_Payment($wp_query->query_vars['id']);
     } elseif (isset($wp_query->query_vars['purchasekey'])) {
         $query = array();
         $query[] = edd_get_payment_by('key', $wp_query->query_vars['purchasekey']);
     } elseif (isset($wp_query->query_vars['email'])) {
         $query = edd_get_payments(array('fields' => 'ids', 'meta_key' => '_edd_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     } else {
         $query = edd_get_payments(array('fields' => 'ids', 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     }
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             if (is_numeric($payment)) {
                 $payment = new EDD_Payment($payment);
             }
             $payment_meta = $payment->get_meta();
             $user_info = $payment->user_info;
             $sales['sales'][$i]['ID'] = $payment->number;
             $sales['sales'][$i]['transaction_id'] = $payment->transaction_id;
             $sales['sales'][$i]['key'] = $payment->key;
             $sales['sales'][$i]['discount'] = !empty($payment->discounts) ? explode(',', $payment->discounts) : array();
             $sales['sales'][$i]['subtotal'] = $payment->subtotal;
             $sales['sales'][$i]['tax'] = $payment->tax;
             $sales['sales'][$i]['fees'] = $payment->fees;
             $sales['sales'][$i]['total'] = $payment->total;
             $sales['sales'][$i]['gateway'] = $payment->gateway;
             $sales['sales'][$i]['email'] = $payment->email;
             $sales['sales'][$i]['date'] = $payment->date;
             $sales['sales'][$i]['products'] = array();
             $c = 0;
             foreach ($payment->cart_details as $key => $item) {
                 $item_id = isset($item['id']) ? $item['id'] : $item;
                 $price = isset($item['price']) ? $item['price'] : false;
                 $price_id = isset($item['item_number']['options']['price_id']) ? $item['item_number']['options']['price_id'] : null;
                 $quantity = isset($item['quantity']) && $item['quantity'] > 0 ? $item['quantity'] : 1;
                 if (!$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);
                 }
                 $price_name = '';
                 if (isset($item['item_number']) && isset($item['item_number']['options'])) {
                     $price_options = $item['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $price_name = edd_get_price_option_name($item_id, $price_options['price_id'], $payment->ID);
                     }
                 }
                 $sales['sales'][$i]['products'][$c]['id'] = $item_id;
                 $sales['sales'][$i]['products'][$c]['quantity'] = $quantity;
                 $sales['sales'][$i]['products'][$c]['name'] = get_the_title($item_id);
                 $sales['sales'][$i]['products'][$c]['price'] = $price;
                 $sales['sales'][$i]['products'][$c]['price_name'] = $price_name;
                 $c++;
             }
             $i++;
         }
     }
     return $sales;
 }
コード例 #20
0
/**
 * Undos a purchase, including the decrease of sale and earning stats
 *
 * Used for when refunding or deleting a purchase
 *
 * @access      public
 * @since       1.0.8.1
 * @param       int $download_id - the ID number of the download
 * @param       int $payment_id - the ID number of the purchase
 * @return      
*/
function edd_undo_purchase($download_id, $payment_id)
{
    $payment = get_post($payment_id);
    if (edd_get_payment_status($payment) == 'refunded') {
        return;
    }
    // payment has already been reversed
    edd_decrease_purchase_count($download_id);
    $purchase_meta = edd_get_payment_meta($payment_id);
    $user_purchase_info = maybe_unserialize($purchase_meta['user_info']);
    $cart_details = maybe_unserialize($purchase_meta['cart_details']);
    $amount = null;
    if (is_array($cart_details)) {
        $cart_item_id = array_search($download_id, $cart_details);
        $amount = isset($cart_details[$cart_item_id]['price']) ? $cart_details[$cart_item_id]['price'] : null;
    }
    $amount = edd_get_download_final_price($download_id, $user_purchase_info, $amount);
    edd_decrease_earnings($download_id, $amount);
}
コード例 #21
0
/**
 * Add upsells to order details screen
 *
 * @since 1.0
*/
function edd_csau_view_order_details_upsells($payment_id)
{
    $item = get_post($payment_id);
    $payment_meta = edd_get_payment_meta($payment_id);
    $cart_items = edd_get_payment_meta_cart_details($payment_id);
    $user_info = edd_get_payment_meta_user_info($payment_id);
    $user_id = edd_get_payment_user_id($payment_id);
    $payment_date = strtotime($item->post_date);
    if (!get_post_meta($payment_id, '_edd_payment_upsell_total', true)) {
        return;
    }
    ?>
<div id="edd-purchased-files" class="postbox">
	<h3 class="hndle"><?php 
    _e('Upsells included with this payment', 'edd-csau');
    ?>
</h3>
	<div class="inside">
		<table class="wp-list-table widefat fixed" cellspacing="0">
			<tbody id="the-list">
				<?php 
    if ($cart_items) {
        $i = 0;
        foreach ($cart_items as $key => $cart_item) {
            $id = isset($payment_meta['cart_details']) ? $cart_item['id'] : $cart_item;
            $price_override = isset($payment_meta['cart_details']) ? $cart_item['price'] : null;
            $price = edd_get_download_final_price($id, $user_info, $price_override);
            if (!isset($cart_item['item_number']['upsell'])) {
                continue;
            }
            ?>
						<tr class="<?php 
            if ($i % 2 == 0) {
                echo 'alternate';
            }
            ?>
">
							<td class="name column-name">
								<?php 
            echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '">' . get_the_title($id) . '</a>';
            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'], $payment_id);
                }
            }
            ?>
							</td>
						</tr>
						<?php 
            $i++;
        }
    }
    ?>
			</tbody>
		</table>
	</div>
</div>
<?php 
}
コード例 #22
0
					<div id="edd-purchased-files" class="postbox">
						<h3 class="hndle"><?php 
_e('Purchased Files', 'edd');
?>
</h3>
						<div class="inside">
							<table class="wp-list-table widefat fixed" cellspacing="0">
								<tbody id="the-list">
									<?php 
if ($cart_items) {
    $i = 0;
    foreach ($cart_items as $key => $cart_item) {
        $id = isset($payment_meta['cart_details']) ? $cart_item['id'] : $cart_item;
        $price_override = isset($payment_meta['cart_details']) ? $cart_item['price'] : null;
        $price = edd_get_download_final_price($id, $user_info, $price_override);
        ?>
											<tr class="<?php 
        if ($i % 2 == 0) {
            echo 'alternate';
        }
        ?>
">
												<td class="name column-name">
													<?php 
        echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '">' . get_the_title($id) . '</a>';
        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'], $payment_id);
            }