Beispiel #1
1
/**
 * Download meta list
 *
 * @since 1.0
 */
function checkout_download_meta()
{
    global $post;
    ?>

		<div class="download-meta">
			<div class="download-meta-price download-price-toggle">
				<div class="download-meta-price-details">

					<?php 
    if (edd_has_variable_prices(get_the_ID())) {
        ?>
						<!-- Get the price range -->
						<a href="<?php 
        the_permalink();
        ?>
" rel="bookmark"><?php 
        echo checkout_edd_price_range();
        ?>
</a>
					<?php 
    } else {
        if (edd_is_free_download(get_the_ID())) {
            ?>
						<!-- Get free download text -->
						<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark"><span class="edd_price"><?php 
            _e('Free', 'checkout');
            ?>
</span></a>
					<?php 
        } else {
            ?>
						<!-- Get the price range -->
						<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark"><?php 
            edd_price(get_the_ID());
            ?>
</a>
					<?php 
        }
    }
    ?>

					<span class="close-pricing"><?php 
    _e('Close', 'checkout');
    ?>
</span>
				</div>
			</div>

			<div class="download-meta-name">
				<?php 
    if (class_exists('EDD_Front_End_Submissions')) {
        ?>
					<?php 
        printf('<span class="author vcard"><a rel="author" class="fn" href="%1$s" title="%2$s">%3$s %4$s</a></span>', checkout_fes_author_url(get_the_author_meta('ID')), esc_attr(sprintf(__('View all posts by %s', 'checkout'), get_the_author())), get_avatar(get_the_author_meta('ID'), 20), esc_html(get_the_author_meta('display_name')));
        ?>

				<?php 
    } else {
        ?>
					<a href="<?php 
        the_permalink();
        ?>
" rel="bookmark"><?php 
        _e('View Details', 'checkout');
        ?>
</a>
				<?php 
    }
    ?>
			</div>
		</div><!-- .download-meta -->

	<?php 
}
Beispiel #2
1
										<?php 
    echo edd_price_range($download_id);
    ?>
									</div>
								<?php 
} else {
    if (function_exists('edd_cp_has_custom_pricing') && edd_cp_has_custom_pricing($download_id)) {
        ?>
									<div class="purchase-price name-price">
										<?php 
        _e('Name your price:', 'checkout');
        ?>
									</div>
								<?php 
    } else {
        if (edd_is_free_download($download_id)) {
            ?>
									<div class="purchase-price">
										<?php 
            _e('Free', 'checkout');
            ?>
									</div>
								<?php 
        } else {
            ?>
									<!-- Get the single price -->
									<div class="purchase-price">
										<?php 
            edd_price($download_id);
            ?>
									</div>
/**
 * Get Cart Item Price
 *
 * @since 1.0
 *
 * @param int   $item_id Download (cart item) ID number
 * @param array $options Optional parameters, used for defining variable prices
 * @return string Fully formatted price
 */
function edd_cart_item_price($item_id = 0, $options = array())
{
    $price = edd_get_cart_item_price($item_id, $options);
    $label = '';
    $price_id = isset($options['price_id']) ? $options['price_id'] : false;
    if (!edd_is_free_download($item_id, $price_id) && !edd_download_is_tax_exclusive($item_id)) {
        if (edd_prices_show_tax_on_checkout() && !edd_prices_include_tax()) {
            $price += edd_get_cart_item_tax($item_id, $options, $price);
        }
        if (!edd_prices_show_tax_on_checkout() && edd_prices_include_tax()) {
            $price -= edd_get_cart_item_tax($item_id, $options, $price);
        }
        if (edd_display_tax_rate()) {
            $label = '&nbsp;&ndash;&nbsp;';
            if (edd_prices_show_tax_on_checkout()) {
                $label .= sprintf(__('includes %s tax', 'edd'), edd_get_formatted_tax_rate());
            } else {
                $label .= sprintf(__('excludes %s tax', 'edd'), edd_get_formatted_tax_rate());
            }
            $label = apply_filters('edd_cart_item_tax_description', $label, $item_id, $options);
        }
    }
    $price = edd_currency_filter(edd_format_amount($price));
    return apply_filters('edd_cart_item_price_label', $price . $label, $item_id, $options);
}
 /**
  * Checkout sale price.
  *
  * Display the sale price, and the regular price with a strike at the checkout.
  * This requires a hook added in EDD 2.3.0
  *
  * @since 1.0.0, EDD 2.4.0
  *
  * @param	double 	$price 			Regular price of the product.
  * @param	int		$download_id	ID of the download we're changing the price for.
  * @return	double					The new price, if the product is in sale this will be the sale price.
  */
 public function checkout_maybe_display_sale_price($label, $item_id, $options)
 {
     global $edd_options;
     $download = new EDD_Download($item_id);
     $regular_price = get_post_meta($item_id, 'edd_price', true);
     $price = edd_get_cart_item_price($item_id, $options);
     // Get sale price if it exists
     if ($download->has_variable_prices()) {
         $prices = $download->get_prices();
         $regular_price = isset($prices[$options['price_id']]['regular_amount']) ? $prices[$options['price_id']]['regular_amount'] : $regular_price;
         $sale_price = $prices[$options['price_id']]['sale_price'];
     } else {
         $sale_price = get_post_meta($item_id, 'edd_sale_price', true);
     }
     // Bail if no sale price is set
     if (empty($sale_price)) {
         return $label;
     }
     $label = '';
     $price_id = isset($options['price_id']) ? $options['price_id'] : false;
     if (!edd_is_free_download($item_id, $price_id) && !edd_download_is_tax_exclusive($item_id)) {
         if (edd_prices_show_tax_on_checkout() && !edd_prices_include_tax()) {
             $regular_price += edd_get_cart_item_tax($item_id, $options, $regular_price);
             $price += edd_get_cart_item_tax($item_id, $options, $price);
         }
         if (!edd_prices_show_tax_on_checkout() && edd_prices_include_tax()) {
             $regular_price -= edd_get_cart_item_tax($item_id, $options, $regular_price);
             $price -= edd_get_cart_item_tax($item_id, $options, $price);
         }
         if (edd_display_tax_rate()) {
             $label = '&nbsp;&ndash;&nbsp;';
             if (edd_prices_show_tax_on_checkout()) {
                 $label .= sprintf(__('includes %s tax', 'edd'), edd_get_formatted_tax_rate());
             } else {
                 $label .= sprintf(__('excludes %s tax', 'edd'), edd_get_formatted_tax_rate());
             }
             $label = apply_filters('edd_cart_item_tax_description', $label, $item_id, $options);
         }
     }
     $regular_price = '<del>' . edd_currency_filter(edd_format_amount($regular_price)) . '</del>';
     $price = edd_currency_filter(edd_format_amount($price));
     return $regular_price . ' ' . $price . $label;
 }