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


PHP edd_get_download_price函数代码示例

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


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

示例1: if_download_price_function

function if_download_price_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'equals' => '', 'greater' => '', 'less' => ''), $atts, 'if_download_price');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $price = '';
    if (edd_has_variable_prices($id)) {
        $get_default_price = edd_get_default_variable_price($id);
        $prices = edd_get_variable_prices($id);
        $price = $prices[$get_default_price]['amount'];
    } else {
        $price = edd_get_download_price($id);
    }
    if ($atts['not'] == 'yes' || $atts['not'] == '1') {
        if (!eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    } else {
        if (eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
开发者ID:Bento4Extend,项目名称:EDD-Download-Shortcodes,代码行数:32,代码来源:if_download_price.php

示例2: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        global $edd_options;
        $style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
        $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
        $purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                echo edd_get_download_sales_stats($post_id);
                break;
            case 'earnings':
                echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:42,代码来源:dashboard-columns.php

示例3: edd_price

/**
 * Price
 *
 * Displays a formatted price for a download.
 *
 * @access      public
 * @since       1.0
 * @param       int $download_id the ID of the download price to show
 * @param		bool whether to echo or return the results
* @return       void
*/
function edd_price($download_id, $echo = true)
{
    if (edd_has_variable_prices($download_id)) {
        $prices = edd_get_variable_prices($download_id);
        // return the lowest price
        $price_float = 0;
        foreach ($prices as $key => $value) {
            if ((double) $prices[$key]['amount'] < $price_float or $price_float == 0) {
                $price_float = (double) $prices[$key]['amount'];
            }
        }
        $price = edd_sanitize_amount($price_float);
    } else {
        $price = edd_get_download_price($download_id);
    }
    if (edd_use_taxes() && edd_taxes_on_prices()) {
        $price += edd_calculate_tax($price);
    }
    $price = apply_filters('edd_download_price', $price, $download_id);
    $price = '<span class="edd_price" id="edd_price_' . $download_id . '">' . $price . '</span>';
    if ($echo) {
        echo $price;
    } else {
        return $price;
    }
}
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:37,代码来源:download-functions.php

示例4: edd_render_download_columns

/**
 * Render Donwload Columns
 *
 * Render the custom columns content.
 *
 * @access      private
 * @since       1.0 
 * @return      void
*/
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        $sales = edd_get_download_sales_stats($post_id);
        $earnings = edd_get_download_earnings_stats($post_id);
        $color = get_post_meta($post_id, '_edd_purchase_color', true);
        $color = $color ? $color : 'blue';
        $purchase_text = get_post_meta($post_id, '_edd_purchase_text', true);
        $purchase_text = $purchase_text && '' !== $purchase_text ? $purchase_text : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                echo edd_price($post_id, false);
                if (!edd_has_variable_prices($post_id)) {
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                echo $sales;
                break;
            case 'earnings':
                echo edd_currency_filter($earnings);
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="button" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:43,代码来源:dashboard-columns.php

示例5: simple_sale_price_field

    /**
     * Sale price field.
     *
     * Display the simple sale price field below the normal price field.
     *
     * @since 1.0.0
     *
     * @param int $post_id ID of the current download being edited.
     */
    public function simple_sale_price_field($post_id)
    {
        $price = edd_get_download_price($post_id);
        $sale_price = get_post_meta($post_id, 'edd_sale_price', true);
        $variable_pricing = edd_has_variable_prices($post_id);
        $prices = edd_get_variable_prices($post_id);
        $single_option_mode = edd_single_price_option_mode($post_id);
        $price_display = $variable_pricing ? ' style="display:none;"' : '';
        $variable_display = $variable_pricing ? '' : ' style="display:none;"';
        ?>
<div id="edd_regular_sale_price_field" class="edd_pricing_fields" <?php 
        echo $price_display;
        ?>
><?php 
        $price_args = array('name' => 'edd_sale_price', 'value' => !empty($sale_price) ? esc_attr(edd_format_amount($sale_price)) : '', 'class' => 'edd-price-field edd-sale-price-field');
        $currency_position = edd_get_option('currency_position');
        if (empty($currency_position) || $currency_position == 'before') {
            echo edd_currency_filter('') . ' ' . EDD()->html->text($price_args) . ' ';
        } else {
            echo EDD()->html->text($price_args) . ' ' . edd_currency_filter('') . ' ';
        }
        ?>
<label class="edd-label" for="edd_sale_price"><?php 
        _e('Sale price', 'edd-sale-price');
        ?>
</label>&nbsp;<?php 
        ?>
</div><?php 
    }
开发者ID:gelther,项目名称:EDD-Sale-Price,代码行数:38,代码来源:class-eddsp-admin-product.php

示例6: if_download_lowest_price_function

function if_download_lowest_price_function($atts, $content)
{
    $atts = shortcode_atts(array('not' => 'no', 'id' => '', 'equals' => '', 'greater' => '', 'less' => ''), $atts, 'if_download_price_lowest');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    ob_start();
    $price = '';
    $price = edd_get_download_price($id);
    // echo $price;
    if ($atts['not'] == 'yes' || $atts['not'] == '1') {
        if (!eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    } else {
        if (eval_condition($price, $atts['equals'], $atts['greater'], $atts['less'])) {
            echo do_shortcode($content);
        } else {
            echo '';
        }
    }
    return ob_get_clean();
}
开发者ID:Bento4Extend,项目名称:EDD-Download-Shortcodes,代码行数:27,代码来源:if_download_lowest_price.php

示例7: download_lowest_price_function

function download_lowest_price_function($atts)
{
    $atts = shortcode_atts(array('limit' => -1, 'id' => ''), $atts, 'download_price_lowest');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    return edd_currency_filter(edd_format_amount(edd_get_download_price($id, false)));
}
开发者ID:Bento4Extend,项目名称:EDD-Download-Shortcodes,代码行数:10,代码来源:download_lowest_price.php

示例8: set_price

 /**
  * Setup the variable and prices properties
  *
  * @since 0.0.9
  *
  * @access protected
  */
 protected function set_price()
 {
     if (edd_has_variable_prices($this->product->ID)) {
         $this->variable = true;
         $this->prices = edd_get_variable_prices($this->product->ID);
     } else {
         $this->variable = false;
         $this->prices = edd_get_download_price($this->product->ID);
     }
 }
开发者ID:Ramoonus,项目名称:ingot,代码行数:17,代码来源:edd.php

示例9: edd_wp_downloads_text_args

/**
 * Change the button text of a free download. Default is "Free - Add to Cart"
 *
 * @since 1.0.0
 */
function edd_wp_downloads_text_args($args)
{
    $free_download_text = edd_get_option('edd_wp_downloads_button_text', __('Free Download', 'edd-wp-downloads'));
    $variable_pricing = edd_has_variable_prices($args['download_id']);
    if ($args['price'] && $args['price'] !== 'no' && !$variable_pricing) {
        $price = edd_get_download_price($args['download_id']);
        if (0 == $price) {
            $wp_downloads_url = get_post_meta($args['download_id'], '_edd_wp_downloads_url', true);
            if ($wp_downloads_url) {
                $args['text'] = $free_download_text;
            }
        }
    }
    return $args;
}
开发者ID:expandedfronts,项目名称:edd-wp-downloads,代码行数:20,代码来源:functions.php

示例10: edd_rp_generate_stats

/**
 * edd_rp_generate_stats
 *
 * Generates the full relational data array for all downloads
 * *
 * @since       1.0
*/
function edd_rp_generate_stats()
{
    $defaults = array('number' => 250);
    // Data is acquired from the most recent 250 purchase logs to protect performance. If you need to increase or decrease this, use the following filter
    $log_query = apply_filters('edd_rp_log_query_args', $defaults);
    $edd_payments_query = new EDD_Payments_Query($log_query);
    $edd_payments = $edd_payments_query->get_payments();
    // Determine what users have purchased what products
    if (!empty($edd_payments)) {
        foreach ($edd_payments as $payment) {
            $user_email = strtolower($payment->user_info['email']);
            $cart_items = $payment->cart_details;
            if (is_array($cart_items)) {
                foreach ($cart_items as $item) {
                    $logs_data[md5($user_email)][] = $item['id'];
                }
            }
        }
        foreach ($logs_data as &$log) {
            $log = array_unique($log);
        }
        // Itterate through each download and find users who have purchased it, then if they have purhcased any other downloads
        // add those to the count.
        $downloads = get_posts(array('post_type' => 'download', 'posts_per_page' => '-1', 'fields' => 'ids'));
        $relation_array = array();
        $display_free = edd_get_option('edd_rp_show_free', 1);
        foreach ($downloads as $download) {
            $relation_array[$download] = array();
            foreach ($logs_data as $log) {
                if (in_array($download, $log)) {
                    foreach ($log as $item) {
                        if ($display_free && !edd_has_variable_prices($item) && absint(edd_get_download_price($item)) === 0) {
                            continue;
                        }
                        if (!isset($relation_array[$download][$item])) {
                            $relation_array[$download][$item] = 0;
                        }
                        $relation_array[$download][$item]++;
                    }
                }
            }
            // Since the data inherintly includes itself in it's own array, just unset it.
            unset($relation_array[$download][$download]);
            arsort($relation_array[$download]);
        }
        update_option('_edd_rp_master_array', $relation_array);
    }
}
开发者ID:SelaInc,项目名称:eassignment,代码行数:55,代码来源:recommendation-functions.php

示例11: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        global $edd_options;
        $style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
        $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
        $color = $color == 'inherit' ? '' : $color;
        $purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
                    echo edd_get_download_sales_stats($post_id);
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'earnings':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
                    echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'shortcode':
                echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
                break;
        }
    }
}
开发者ID:Bragi26,项目名称:Easy-Digital-Downloads,代码行数:55,代码来源:dashboard-columns.php

示例12: vp_edd_fd_get_calculated_price

/**
 * Get final price of a download after discount
 * 
 * Modified From:
 * includes/download-functions.php -> edd_price()
 * Modified Parts:
 * Remove the price as a number, without the html formatting.
 * 
 * @param  int   $download_id ID of the download
 * @return float              Download price
 */
function vp_edd_fd_get_calculated_price($download_id)
{
    if (edd_has_variable_prices($download_id)) {
        $prices = edd_get_variable_prices($download_id);
        // Return the lowest price
        $price_float = 0;
        foreach ($prices as $key => $value) {
            if ((double) $prices[$key]['amount'] < $price_float or $price_float == 0) {
                $price_float = (double) $prices[$key]['amount'];
            }
        }
        $price = edd_sanitize_amount($price_float);
    } else {
        $price = edd_get_download_price($download_id);
    }
    if (edd_use_taxes() && edd_taxes_on_prices()) {
        $price += edd_calculate_tax($price);
    }
    return $price;
}
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:31,代码来源:edd-functions.php

示例13: edd_render_download_columns

/**
 * Render Download Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_download_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'download') {
        switch ($column_name) {
            case 'download_category':
                echo get_the_term_list($post_id, 'download_category', '', ', ', '');
                break;
            case 'download_tag':
                echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
                break;
            case 'price':
                if (edd_has_variable_prices($post_id)) {
                    echo edd_price_range($post_id);
                } else {
                    echo edd_price($post_id, false);
                    echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
                }
                break;
            case 'sales':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&tab=logs&view=sales&download=' . $post_id)) . '">';
                    echo edd_get_download_sales_stats($post_id);
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
            case 'earnings':
                if (current_user_can('view_product_stats', $post_id)) {
                    echo '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $post_id)) . '">';
                    echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
                    echo '</a>';
                } else {
                    echo '-';
                }
                break;
        }
    }
}
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:47,代码来源:dashboard-columns.php

示例14: testPriceTrackingNonVariableProduct

 /**
  * Test that EDD sale of non-variable product is properly priced/recorded
  *
  * @since 1.1.0
  *
  * @group pricez
  * @group edd_price
  *
  * @covers \ingot\testing\tests\price\plugins\edd
  */
 public function testPriceTrackingNonVariableProduct()
 {
     $price_is = 10;
     $product = ingot_test_data_price::edd_create_simple_download($price_is);
     $group_id = \ingot\testing\crud\group::create(['type' => 'price', 'sub_type' => 'edd', 'meta' => ['product_ID' => $product->ID], 'wp_ID' => $product->ID], true);
     $variant_one = \ingot\testing\crud\variant::create(['group_ID' => $group_id, 'type' => 'price', 'meta' => ['price' => [0.5]], 'content' => $product->ID], true);
     $variant_two = \ingot\testing\crud\variant::create(['group_ID' => $group_id, 'type' => 'price', 'meta' => ['price' => [0.5]], 'content' => $product->ID], true);
     $group = \ingot\testing\crud\group::read($group_id);
     $group['variants'] = [$variant_one, $variant_two];
     \ingot\testing\crud\group::update($group, $group_id, true);
     $cookie_class = new \ingot\testing\cookies\price([]);
     $price_cookie = $cookie_class->get_cookie();
     $this->assertArrayHasKey('edd', $price_cookie);
     $this->assertFalse(empty($price_cookie['edd']));
     $this->assertInternalType('array', $price_cookie['edd']);
     $product_id = \ingot\testing\utility\price::get_product_ID($group);
     $this->assertEquals($product_id, $product->ID);
     $this->assertArrayHasKey($product_id, $price_cookie['edd']);
     new \ingot\testing\tests\price\plugins\edd($price_cookie['edd']);
     $test = \ingot\testing\utility\price::get_price_test_from_cookie('edd', $product->ID, $price_cookie);
     $this->assertInternalType('object', $test);
     $price_should_be = $test->get_price();
     //NOTE: USING edd_get_download_price here is to ensure we don't have recursion
     $this->assertEquals(edd_get_download_price($product->ID), $price_should_be);
     $group_obj = new \ingot\testing\object\group($group_id);
     $lever = $group_obj->get_lever($test->ID);
     $this->assertInternalType('object', $lever);
     $before_wins = $lever->getNumerator();
     $payment_id = ingot_test_data_price::edd_create_simple_payment($product);
     edd_complete_purchase($payment_id, 'publish', 'pending');
     $group_obj = new \ingot\testing\object\group($group_id);
     $lever = $group_obj->get_lever($test->ID);
     $this->assertInternalType('object', $lever);
     $after_wins = $lever->getNumerator();
     $this->assertEquals($before_wins + 1, $after_wins);
 }
开发者ID:rene-hermenau,项目名称:ingot,代码行数:46,代码来源:tests-price-edd.php

示例15: edd_wallet_item_incentive_amount

/**
 * Maybe add incentive discounts
 *
 * @since		1.0.1
 * @param		float $discount The current discount amount
 * @param		array $item The cart item array
 * @return		float $discount The updated discount amount
 */
function edd_wallet_item_incentive_amount($discount, $item)
{
    $incentive_amount = edd_get_option('edd_wallet_incentive_amount', 0);
    if ($incentive_amount <= 0) {
        return $discount;
    }
    if (!EDD()->session->get('wallet_has_incentives')) {
        return $discount;
    }
    if (edd_has_variable_prices($item['id'])) {
        $prices = edd_get_variable_prices($item['id']);
        $price_id = isset($item['options']['price_id']) ? $item['options']['price_id'] : 0;
        if ($price_id !== false && $price_id !== '' && isset($prices[$price_id])) {
            $price = edd_get_price_option_amount($item['id'], $price_id);
        } else {
            $price = edd_get_lowest_price_option($item['id']);
        }
    } else {
        $price = edd_get_download_price($item['id']);
    }
    $incentive_type = edd_get_option('edd_wallet_incentive_type', 'flatrate');
    if ($incentive_type == 'percent') {
        $incentive_amount /= 100;
        $incentive_amount = $price * $incentive_amount;
        if (edd_item_quantities_enabled() && edd_get_option('edd_wallet_incentive_quantities', false)) {
            $incentive_amount *= $item['quantity'];
        }
        $incentive_amount = number_format($incentive_amount, 2, '.', '');
    } else {
        if (edd_item_quantities_enabled() && edd_get_option('edd_wallet_incentive_quantities', false)) {
            $incentive_amount *= $item['quantity'];
        }
    }
    $discount += $incentive_amount;
    return $discount;
}
开发者ID:easydigitaldownloads,项目名称:edd-wallet,代码行数:44,代码来源:incentive-functions.php


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