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


PHP edd_get_variable_prices函数代码示例

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


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

示例1: edd_cr_check_for_download_price_variations

/**
 * Check for download price variations
 *
 * @since       2.0
 * @return      void
 */
function edd_cr_check_for_download_price_variations()
{
    if (!current_user_can('edit_products')) {
        die('-1');
    }
    $download_id = absint($_POST['download_id']);
    $key = isset($_POST['key']) ? absint($_POST['key']) : 0;
    $download = get_post($download_id);
    if ('download' != $download->post_type) {
        die('-2');
    }
    if (edd_has_variable_prices($download_id)) {
        $variable_prices = edd_get_variable_prices($download_id);
        if ($variable_prices) {
            $ajax_response = '<select class="edd_price_options_select edd-select edd-select edd_cr_download" name="edd_cr_download[' . $key . '][price_id]">';
            $ajax_response .= '<option value="all">' . esc_html(__('All prices', 'edd-cr')) . '</option>';
            foreach ($variable_prices as $price_id => $price) {
                $ajax_response .= '<option value="' . esc_attr($price_id) . '">' . esc_html($price['name']) . '</option>';
            }
            $ajax_response .= '</select>';
            echo $ajax_response;
        }
    }
    edd_die();
}
开发者ID:rohmann,项目名称:EDD-Content-Restriction,代码行数:31,代码来源:ajax-functions.php

示例2: atcf_update_backer_count

/**
 * Increment the backer count for every download in this payment. 
 *
 * @param 	int 		$payment_id
 * @param 	string 		$direction
 * @return 	void
 * @since 	0.9
 */
function atcf_update_backer_count($payment_id, $direction)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $downloads = maybe_unserialize($payment_data['downloads']);
    if (!is_array($downloads)) {
        return;
    }
    foreach ($downloads as $download) {
        $variable_pricing = edd_get_variable_prices($download['id']);
        foreach ($variable_pricing as $key => $value) {
            $what = isset($download['options']['price_id']) ? intval($download['options']['price_id']) : 0;
            if (!isset($variable_pricing[$what]['bought'])) {
                $variable_pricing[$what]['bought'] = 0;
            }
            $current = $variable_pricing[$what]['bought'];
            if ($key == $what) {
                if ('increase' == $direction) {
                    $variable_pricing[$what]['bought'] = $current + $download['quantity'];
                } else {
                    $variable_pricing[$what]['bought'] = $current - $download['quantity'];
                }
            }
        }
        update_post_meta($download['id'], 'edd_variable_prices', $variable_pricing);
    }
}
开发者ID:unclebrain,项目名称:appthemer-crowdfunding,代码行数:34,代码来源:checkout.php

示例3: 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

示例4: sumobi_edd_price_option_checked

/**
 * make sure the last option in array is checked (highest priced item)
*/
function sumobi_edd_price_option_checked($checked, $download_id, $key)
{
    $prices = edd_get_variable_prices($download_id);
    end($prices);
    $checked = key($prices);
    return $checked;
}
开发者ID:mintplugins,项目名称:library,代码行数:10,代码来源:reverse-variable-pricing.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: 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

示例7: atcf_purchase_variable_pricing

function atcf_purchase_variable_pricing($download_id)
{
    $variable_pricing = edd_has_variable_prices($download_id);
    if (!$variable_pricing) {
        return;
    }
    $prices = edd_get_variable_prices($download_id);
    $type = edd_single_price_option_mode($download_id) ? 'checkbox' : 'radio';
    do_action('edd_before_price_options', $download_id);
    do_action('atcf_campaign_contribute_options', $prices, $type, $download_id);
    do_action('edd_after_price_options', $download_id);
}
开发者ID:unclebrain,项目名称:appthemer-crowdfunding,代码行数:12,代码来源:deprecated.php

示例8: download_add_to_cart_function

function download_add_to_cart_function($atts, $content)
{
    $atts = shortcode_atts(array('id' => '', 'style' => 'button', 'option' => '', 'price' => '1', 'text' => 'Add to Cart', 'color' => '', 'class' => '', 'direct' => '', 'show' => ''), $atts, 'download_url_addtocart');
    if ($atts['id'] != '') {
        $download_id = $atts['id'];
    } else {
        $download_id = get_the_ID();
    }
    global $post, $download_loop, $current_price, $global_checkout_price_id;
    $external = get_post_meta($download_id, '_edd_external_url', true);
    if (isset($external) && $external != '' && $atts['show'] != 'button') {
        return $external;
    }
    if (isset($global_checkout_price_id) && $global_checkout_price_id != '' && $global_checkout_price_id != null) {
        $price_id = $global_checkout_price_id;
    } else {
        if (isset($current_price) && $current_price != '' && $current_price != null) {
            $price_id = $current_price['price_id'];
        } else {
            if (edd_has_variable_prices($download_id)) {
                $price_id = edd_get_default_variable_price($download_id);
            }
        }
    }
    if ($atts['option'] > 0) {
        $price_list_temp = edd_get_variable_prices($download_id);
        if (array_key_exists($atts['option'], $price_list_temp)) {
            $price_id = $atts['option'];
        }
    }
    if (edd_has_variable_prices($download_id) && $atts['option'] != 'list') {
        if ($atts['show'] != 'url') {
            $content = '[purchase_link class="blue edd-submit ' . $atts['class'] . '" color="' . $atts['color'] . '" direct="' . $atts['direct'] . '" price="' . $atts['price'] . '"  text="' . $atts['text'] . '" id="' . $download_id . '" price_id="' . $price_id . '" style="' . $atts['style'] . '" ]';
            return do_shortcode($content);
        } else {
            return site_url() . "?edd_action=add_to_cart&download_id={$download_id}&edd_options[price_id]={$price_id}";
        }
    } else {
        if ($atts['show'] != 'url') {
            return do_shortcode('[purchase_link  class=" blue edd-submit ' . $atts['class'] . '" color="' . $atts['color'] . '" direct="' . $atts['direct'] . '" price="' . $atts['price'] . '"  text="' . $atts['text'] . '" id="' . $download_id . '"  style="' . $atts['style'] . '" ]');
        } else {
            return site_url() . "?edd_action=add_to_cart&download_id={$download_id}";
        }
    }
}
开发者ID:Bento4Extend,项目名称:EDD-Download-Shortcodes,代码行数:45,代码来源:download_add_to_cart.php

示例9: 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

示例10: shoestrap_edd_purchase_variable_pricing

function shoestrap_edd_purchase_variable_pricing($download_id)
{
    $variable_pricing = edd_has_variable_prices($download_id);
    if (!$variable_pricing) {
        return;
    }
    $prices = apply_filters('edd_purchase_variable_prices', edd_get_variable_prices($download_id), $download_id);
    $type = edd_single_price_option_mode($download_id) ? 'checkbox' : 'radio';
    do_action('edd_before_price_options', $download_id);
    echo '<div class="edd_price_options">';
    if ($prices) {
        echo '<select name="edd_options[price_id][]">';
        foreach ($prices as $key => $price) {
            printf('<option for="%3$s" name="edd_options[price_id][]" id="%3$s" class="%4$s" value="%5$s" %7$s> %6$s</option>', checked(0, $key, false), $type, esc_attr('edd_price_option_' . $download_id . '_' . $key), esc_attr('edd_price_option_' . $download_id), esc_attr($key), esc_html($price['name'] . ' - ' . edd_currency_filter(edd_format_amount($price['amount']))), selected(isset($_GET['price_option']), $key, false));
            do_action('edd_after_price_option', $key, $price, $download_id);
        }
        echo '</select>';
    }
    do_action('edd_after_price_options_list', $download_id, $prices, $type);
    echo '</div><!--end .edd_price_options-->';
    do_action('edd_after_price_options', $download_id);
}
开发者ID:mintplugins,项目名称:library,代码行数:22,代码来源:variable-pricing-dropdown.php

示例11: defined

 * License: 

 */
defined('ABSPATH') or die("No script kiddies please!");
function edd_plans_load_multiple_license()
{
    wp_enqueue_script('edd_plans_multiple_license', plugins_url() . '/edd_plans/helpers/edd_plans.js', 'jquery', '', true);
}
function edd_plans_multiple_license_row($key, $args = array(), $post_id)
{
    $edd_plans_multiple_license = get_post_meta($post_id, 'edd_plans_multiple_license', true);
    $length_default = isset($edd_plans_multiple_license[$key]['length']) ? $edd_plans_multiple_license[$key]['length'] : '';
    $unit_default = isset($edd_plans_multiple_license[$key]['unit']) ? $edd_plans_multiple_license[$key]['unit'] : '';
    $variable_pricing = edd_has_variable_prices($post_id);
    if ($variable_pricing) {
        $prices = edd_get_variable_prices($post_id);
    } else {
        $prices = edd_get_download_price($post_id);
    }
    $enabled = isset($prices[$key]['renew']) ? true : false;
    echo '<td>';
开发者ID:jomsocial,项目名称:eddPlans,代码行数:21,代码来源:edd_plans.php

示例12: 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

示例13: edd_generate_pdf

/**
 * Generate PDF Reports
 *
 * Generates PDF report on sales and earnings for all downloads for the current year.
 *
 * @since 1.1.4.0
 * @param string $data
 * @uses edd_pdf
 * @author Sunny Ratilal
 */
function edd_generate_pdf($data)
{
    $edd_pdf_reports_nonce = $_GET['_wpnonce'];
    if (wp_verify_nonce($edd_pdf_reports_nonce, 'edd_generate_pdf')) {
        require_once EDD_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
        require_once EDD_PLUGIN_DIR . '/includes/libraries/fpdf/edd_pdf.php';
        $daterange = date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))) . ' ' . utf8_decode(__('to', 'edd')) . ' ' . date_i18n(get_option('date_format'));
        $pdf = new edd_pdf();
        $pdf->AddPage('L', 'A4');
        $pdf->SetTitle(utf8_decode(__('Sales and earnings reports for the current year for all products', 'edd')));
        $pdf->SetAuthor(utf8_decode(__('Easy Digital Downloads', 'edd')));
        $pdf->SetCreator(utf8_decode(__('Easy Digital Downloads', 'edd')));
        $pdf->Image(EDD_PLUGIN_URL . 'assets/images/edd-logo.png', 205, 10);
        $pdf->SetMargins(8, 8, 8);
        $pdf->SetX(8);
        $pdf->SetFont('Helvetica', '', 16);
        $pdf->SetTextColor(50, 50, 50);
        $pdf->Cell(0, 3, utf8_decode(__('Sales and earnings reports for the current year for all products', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 13);
        $pdf->Ln();
        $pdf->SetTextColor(150, 150, 150);
        $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'edd')) . $daterange, 0, 2, 'L', false);
        $pdf->Ln();
        $pdf->SetTextColor(50, 50, 50);
        $pdf->SetFont('Helvetica', '', 14);
        $pdf->Cell(0, 10, utf8_decode(__('Table View', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 12);
        $pdf->SetFillColor(238, 238, 238);
        $pdf->Cell(70, 6, utf8_decode(__('Product Name', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(30, 6, utf8_decode(__('Price', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(50, 6, utf8_decode(__('Categories', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(50, 6, utf8_decode(__('Tags', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(45, 6, utf8_decode(__('Number of Sales', 'edd')), 1, 0, 'L', true);
        $pdf->Cell(35, 6, utf8_decode(__('Earnings to Date', 'edd')), 1, 1, 'L', true);
        $year = date('Y');
        $downloads = get_posts(array('post_type' => 'download', 'year' => $year, 'posts_per_page' => -1));
        if ($downloads) {
            $pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
            foreach ($downloads as $download) {
                $pdf->SetFillColor(255, 255, 255);
                $title = utf8_decode(get_the_title($download->ID));
                if (edd_has_variable_prices($download->ID)) {
                    $prices = edd_get_variable_prices($download->ID);
                    $first = $prices[0]['amount'];
                    $last = array_pop($prices);
                    $last = $last['amount'];
                    if ($first < $last) {
                        $min = $first;
                        $max = $last;
                    } else {
                        $min = $last;
                        $max = $first;
                    }
                    $price = html_entity_decode(edd_currency_filter(edd_format_amount($min)) . ' - ' . edd_currency_filter(edd_format_amount($max)));
                } else {
                    $price = html_entity_decode(edd_currency_filter(edd_get_download_price($download->ID)));
                }
                $categories = get_the_term_list($download->ID, 'download_category', '', ', ', '');
                $categories = $categories ? strip_tags($categories) : '';
                $tags = get_the_term_list($download->ID, 'download_tag', '', ', ', '');
                $tags = $tags ? strip_tags($tags) : '';
                $sales = edd_get_download_sales_stats($download->ID);
                $link = get_permalink($download->ID);
                $earnings = html_entity_decode(edd_currency_filter(edd_get_download_earnings_stats($download->ID)));
                $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
            }
        } else {
            $pdf->SetWidths(array(280));
            $title = utf8_decode(sprintf(__('No %s found.', 'edd'), edd_get_label_plural()));
            $pdf->Row(array($title));
        }
        $pdf->Ln();
        $pdf->SetTextColor(50, 50, 50);
        $pdf->SetFont('Helvetica', '', 14);
        $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'edd')), 0, 2, 'L', false);
        $pdf->SetFont('Helvetica', '', 12);
        $image = html_entity_decode(urldecode(edd_draw_chart_image()));
        $image = str_replace(' ', '%20', $image);
        $pdf->SetX(25);
        $pdf->Image($image . '&file=.png');
        $pdf->Ln(7);
        $pdf->Output('edd-report-' . date_i18n('Y-m-d') . '.pdf', 'D');
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:94,代码来源:pdf-reports.php

示例14: get_price_is_lifetime

 function get_price_is_lifetime($download_id = 0, $price_id = null)
 {
     $prices = edd_get_variable_prices($download_id);
     if (!empty($prices[$price_id]['is_lifetime'])) {
         return true;
     }
     return false;
 }
开发者ID:SelaInc,项目名称:eassignment,代码行数:8,代码来源:edd-software-licenses.php

示例15: get_product_data

 /**
  * Given a download post object, generate the data for the API output
  *
  * @since  2.3.9
  * @param  object $product_info The Download Post Object
  * @return array                Array of post data to return back in the API
  */
 private function get_product_data($product_info)
 {
     $product = array();
     $product['info']['id'] = $product_info->ID;
     $product['info']['slug'] = $product_info->post_name;
     $product['info']['title'] = $product_info->post_title;
     $product['info']['create_date'] = $product_info->post_date;
     $product['info']['modified_date'] = $product_info->post_modified;
     $product['info']['status'] = $product_info->post_status;
     $product['info']['link'] = html_entity_decode($product_info->guid);
     $product['info']['content'] = $product_info->post_content;
     $product['info']['excerpt'] = $product_info->post_excerpt;
     $product['info']['thumbnail'] = wp_get_attachment_url(get_post_thumbnail_id($product_info->ID));
     $product['info']['category'] = get_the_terms($product_info, 'download_category');
     $product['info']['tags'] = get_the_terms($product_info, 'download_tag');
     if (user_can($this->user_id, 'view_shop_reports') || $this->override) {
         $product['stats']['total']['sales'] = edd_get_download_sales_stats($product_info->ID);
         $product['stats']['total']['earnings'] = edd_get_download_earnings_stats($product_info->ID);
         $product['stats']['monthly_average']['sales'] = edd_get_average_monthly_download_sales($product_info->ID);
         $product['stats']['monthly_average']['earnings'] = edd_get_average_monthly_download_earnings($product_info->ID);
     }
     if (edd_has_variable_prices($product_info->ID)) {
         foreach (edd_get_variable_prices($product_info->ID) as $price) {
             $product['pricing'][sanitize_key($price['name'])] = $price['amount'];
         }
     } else {
         $product['pricing']['amount'] = edd_get_download_price($product_info->ID);
     }
     if (user_can($this->user_id, 'view_shop_sensitive_data') || $this->override) {
         foreach (edd_get_download_files($product_info->ID) as $file) {
             $product['files'][] = $file;
         }
         $product['notes'] = edd_get_product_notes($product_info->ID);
     }
     return apply_filters('edd_api_products_product', $product);
 }
开发者ID:jplhomer,项目名称:Easy-Digital-Downloads,代码行数:43,代码来源:class-edd-api.php


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