/**
     * 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 
    }
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);
}
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);
}
Esempio n. 4
0
/**
 * Price Section
 *
 * If variable pricing is not enabled, simply output a single input box.
 *
 * If variable pricing is enabled, outputs a table of all current prices.
 * Extensions can add column heads to the table via the `edd_download_file_table_head`
 * hook, and actual columns via `edd_download_file_table_row`
 *
 * @since 1.0
 *
 * @see edd_render_price_row()
 *
 * @param $post_id
 */
function edd_render_price_field($post_id)
{
    $price = edd_get_download_price($post_id);
    $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;"';
    $currency_position = edd_get_option('currency_position', 'before');
    ?>
	<p>
		<strong><?php 
    echo apply_filters('edd_price_options_heading', __('Pricing Options:', 'edd'));
    ?>
</strong>
	</p>

	<p>
		<label for="edd_variable_pricing">
			<input type="checkbox" name="_variable_pricing" id="edd_variable_pricing" value="1" <?php 
    checked(1, $variable_pricing);
    ?>
 />
			<?php 
    echo apply_filters('edd_variable_pricing_toggle_text', __('Enable variable pricing', 'edd'));
    ?>
		</label>
	</p>

	<div id="edd_regular_price_field" class="edd_pricing_fields" <?php 
    echo $price_display;
    ?>
>
		<?php 
    $price_args = array('name' => 'edd_price', 'value' => isset($price) ? esc_attr(edd_format_amount($price)) : '', 'class' => 'edd-price-field');
    ?>

		<?php 
    if ($currency_position == 'before') {
        ?>
			<?php 
        echo edd_currency_filter('');
        ?>
			<?php 
        echo EDD()->html->text($price_args);
        ?>
		<?php 
    } else {
        ?>
			<?php 
        echo EDD()->html->text($price_args);
        ?>
			<?php 
        echo edd_currency_filter('');
        ?>
		<?php 
    }
    ?>

		<?php 
    do_action('edd_price_field', $post_id);
    ?>
	</div>

	<?php 
    do_action('edd_after_price_field', $post_id);
    ?>

	<div id="edd_variable_price_fields" class="edd_pricing_fields" <?php 
    echo $variable_display;
    ?>
>
		<input type="hidden" id="edd_variable_prices" class="edd_variable_prices_name_field" value=""/>
		<p>
			<?php 
    echo EDD()->html->checkbox(array('name' => '_edd_price_options_mode', 'current' => $single_option_mode));
    ?>
			<label for="_edd_price_options_mode"><?php 
    echo apply_filters('edd_multi_option_purchase_text', __('Enable multi-option purchase mode. Allows multiple price options to be added to your cart at once', 'edd'));
    ?>
</label>
		</p>
		<div id="edd_price_fields" class="edd_meta_table_wrap">
			<table class="widefat edd_repeatable_table" width="100%" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th style="width: 20px"></th>
						<th><?php 
    _e('Option Name', 'edd');
    ?>
</th>
						<th style="width: 100px"><?php 
    _e('Price', 'edd');
    ?>
</th>
						<th class="edd_repeatable_default"><?php 
    _e('Default', 'edd');
    ?>
</th>
						<th style="width: 15px"><?php 
    _e('ID', 'edd');
    ?>
</th>
						<?php 
    do_action('edd_download_price_table_head', $post_id);
    ?>
						<th style="width: 2%"></th>
					</tr>
				</thead>
				<tbody>
					<?php 
    if (!empty($prices)) {
        foreach ($prices as $key => $value) {
            $name = isset($value['name']) ? $value['name'] : '';
            $amount = isset($value['amount']) ? $value['amount'] : '';
            $index = isset($value['index']) ? $value['index'] : $key;
            $args = apply_filters('edd_price_row_args', compact('name', 'amount'), $value);
            ?>
								<tr class="edd_variable_prices_wrapper edd_repeatable_row" data-key="<?php 
            echo esc_attr($key);
            ?>
">
									<?php 
            do_action('edd_render_price_row', $key, $args, $post_id, $index);
            ?>
								</tr>
							<?php 
        }
    } else {
        ?>
						<tr class="edd_variable_prices_wrapper edd_repeatable_row" data-key="1">
							<?php 
        do_action('edd_render_price_row', 1, array(), $post_id, 1);
        ?>
						</tr>
					<?php 
    }
    ?>

					<tr>
						<td class="submit" colspan="4" style="float: none; clear:both; background:#fff;">
							<a class="button-secondary edd_add_repeatable" style="margin: 6px 0;"><?php 
    _e('Add New Price', 'edd');
    ?>
</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div><!--end #edd_variable_price_fields-->
<?php 
}
/**
 * Display the quantity field for a variable price when multi-purchase mode is enabled
 *
 * @since 2.2
 * @param int $key Price ID
 * @param array $price price option array
 * @param int $download_id Download ID
 * @return void
 */
function edd_variable_price_quantity_field($key, $price, $download_id)
{
    if (!edd_item_quantities_enabled()) {
        return;
    }
    if (!edd_single_price_option_mode($download_id)) {
        return;
    }
    ob_start();
    ?>
	<div class="edd_download_quantity_wrapper edd_download_quantity_price_option_<?php 
    echo sanitize_key($price['name']);
    ?>
">
		<span class="edd_price_option_sep">&nbsp;x&nbsp;</span>
		<input type="number" min="1" step="1" name="edd_download_quantity_<?php 
    echo esc_attr($key);
    ?>
" class="edd-input edd-item-quantity" value="1" />
	</div>
<?php 
    $quantity_input = ob_get_clean();
    echo apply_filters('edd_purchase_form_variation_quantity_input', $quantity_input, $download_id, $key, $price);
}
/**
 * Override the standard quantity field for non-variably priced products
 *
 * @since       1.2.10
 * @param       int $download_id The ID of this download
 * @param       array $args Array of arguments
 * @return      void
 */
function edd_pl_download_purchase_form_quantity_field($download_id = 0, $args = array())
{
    global $edd_prices_sold_out;
    if (!edd_item_quantities_enabled()) {
        return;
    }
    if (edd_item_in_cart($download_id) && !edd_has_variable_prices($download_id)) {
        return;
    }
    if (edd_single_price_option_mode($download_id) && edd_has_variable_prices($download_id) && !edd_item_in_cart($download_id)) {
        return;
    }
    if (edd_single_price_option_mode($download_id) && edd_has_variable_prices($download_id) && edd_item_in_cart($download_id)) {
        return;
    }
    if (!edd_single_price_option_mode($download_id) && edd_has_variable_prices($download_id) && edd_item_in_cart($download_id)) {
        return;
    }
    // Get options
    $scope = edd_get_option('edd_purchase_limit_scope') ? edd_get_option('edd_purchase_limit_scope') : 'site-wide';
    $max_purchases = edd_pl_get_file_purchase_limit($download_id);
    $disabled = '';
    if ($scope == 'site-wide') {
        $purchases = edd_get_download_sales_stats($download_id);
    } elseif (is_user_logged_in()) {
        $purchases = edd_pl_get_user_purchase_count(get_current_user_id(), $download_id);
    }
    if ($purchases) {
        if ($max_purchases && $purchases >= $max_purchases || !empty($edd_prices_sold_out)) {
            $disabled = 'disabled="disabled"';
        }
    }
    $max = 'max="" ';
    if ($max_purchases) {
        $remaining = $max_purchases - $purchases;
        $max = 'max="' . $remaining . '" ';
    }
    echo '<div class="edd_download_quantity_wrapper">';
    echo '<input type="number" min="1" ' . $max . 'step="1" ' . $disabled . 'name="edd_download_quantity" class="edd-input edd-item-quantity" value="1" />';
    echo '</div>';
}
/**
 * Wish list item purchase link
 *
 * @since  1.0
 * @param  [type] $item [description]
 * @return [type]       [description]
 */
function edd_wl_item_purchase($item, $args = array())
{
    global $edd_options;
    ob_start();
    $defaults = apply_filters('edd_wl_add_to_cart_defaults', array('download_id' => $item['id'], 'text' => !empty($edd_options['edd_wl_add_to_cart']) ? $edd_options['edd_wl_add_to_cart'] : __('Add to cart', 'edd-wish-lists'), 'checkout_text' => __('Checkout', 'edd-wish-lists'), 'style' => edd_get_option('edd_wl_button_style', 'button'), 'color' => '', 'class' => 'edd-wl-action', 'wrapper' => 'span', 'wrapper_class' => '', 'link' => ''), $item['id']);
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $style = 'edd-wl-button';
    $variable_pricing = edd_has_variable_prices($download_id);
    $data_variable = $variable_pricing ? ' data-variable-price=yes' : 'data-variable-price=no';
    // price option
    $data_price_option = $variable_pricing ? ' data-price-option=' . $item['options']['price_id'] : '';
    $type = edd_single_price_option_mode($download_id) ? 'data-price-mode=multi' : 'data-price-mode=single';
    if (edd_item_in_cart($download_id) && !$variable_pricing) {
        // hide the 'add to cart' link
        $button_display = 'style="display:none;"';
        // show the 'checkout' link
        $checkout_display = '';
    } elseif ($variable_pricing && edd_item_in_cart($download_id, array('price_id' => $item['options']['price_id']))) {
        // hide the 'add to cart' link
        $button_display = 'style="display:none;"';
        // show the 'checkout' link
        $checkout_display = '';
    } else {
        // show the 'add to cart' link
        $button_display = '';
        // hide the 'checkout' link
        $checkout_display = 'style="display:none;"';
    }
    $button_size = '';
    // if link is specified, don't show spinner
    $loading = !$link ? '<span class="edd-loading"><i class="edd-icon-spinner edd-icon-spin"></i></span>' : '';
    $link = !$link ? '#' : $link;
    $form_id = !empty($form_id) ? $form_id : 'edd_purchase_' . $download_id;
    // add our default class
    $default_wrapper_class = ' edd-wl-item-purchase';
    $wrapper_class .= $wrapper_class ? $default_wrapper_class : trim($default_wrapper_class);
    $default_css_class = apply_filters('edd_wl_item_purchase_default_css_classes', 'edd-add-to-cart-from-wish-list', $download_id);
    ?>

	<form id="<?php 
    echo $form_id;
    ?>
" class="edd_download_purchase_form" method="post">
		<div class="edd_purchase_submit_wrapper">
		<?php 
    printf('<a href="%10$s" class="%11$s %1$s %8$s" data-action="edd_add_to_cart_from_wish_list" data-download-id="%3$s" %4$s %5$s %6$s %7$s><span class="label">%2$s</span>%9$s</a>', implode(' ', array($style, $color, trim($class))), esc_attr($text), esc_attr($download_id), esc_attr($data_variable), esc_attr($type), $button_display, esc_attr($data_price_option), $button_size, $loading, $link, $default_css_class);
    // checkout link that shows when item is added to the cart
    printf('<a href="%1$s" class="%2$s %3$s %5$s" %4$s>' . $checkout_text . '</a>', esc_url(edd_get_checkout_uri()), esc_attr('edd-go-to-checkout-from-wish-list'), implode(' ', array($style, $color, trim($class))), $checkout_display, $button_size);
    ?>
		</div>
	</form>
	
<?php 
    $html = '<' . $wrapper . ' class="' . $wrapper_class . '"' . '>' . ob_get_clean() . '</' . $wrapper . '>';
    return apply_filters('edd_wl_item_purchase', $html, $item);
}
/**
 * Variable price output
 *
 * Outputs variable pricing options for each download or a specified downloads in a list.
 * The output generated can be overridden by the filters provided or by removing
 * the action and adding your own custom action.
 *
 * @since 1.2.3
 * @param int $download_id Download ID
 * @return void
 */
function edd_purchase_variable_pricing($download_id = 0)
{
    global $edd_options;
    $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);
    ?>
	<div class="edd_price_options">
		<ul>
			<?php 
    if ($prices) {
        $checked_key = isset($_GET['price_option']) ? absint($_GET['price_option']) : 1;
        foreach ($prices as $key => $price) {
            echo '<li id="edd_price_option_' . $download_id . '_' . sanitize_key($price['name']) . '" itemprop="offers" itemscope itemtype="http://schema.org/Offer">';
            echo '<label for="' . esc_attr('edd_price_option_' . $download_id . '_' . $key) . '">';
            echo '<input type="' . $type . '" ' . checked(apply_filters('edd_price_option_checked', $checked_key, $download_id, $key), $key, false) . ' name="edd_options[price_id][]" id="' . esc_attr('edd_price_option_' . $download_id . '_' . $key) . '" class="' . esc_attr('edd_price_option_' . $download_id) . '" value="' . esc_attr($key) . '"/>&nbsp;';
            echo '<span class="edd_price_option_name" itemprop="description">' . esc_html($price['name']) . '</span><span class="edd_price_option_sep">&nbsp;&ndash;&nbsp;</span><span class="edd_price_option_price" itemprop="price">' . edd_currency_filter(edd_format_amount($price['amount'])) . '</span>';
            echo '</label>';
            do_action('edd_after_price_option', $key, $price, $download_id);
            echo '</li>';
        }
    }
    do_action('edd_after_price_options_list', $download_id, $prices, $type);
    ?>
		</ul>
	</div><!--end .edd_price_options-->
<?php 
    do_action('edd_after_price_options', $download_id);
}
    function sf_campaign_sidebar()
    {
        global $post;
        $campaign = new ATCF_Campaign($post->ID);
        $download_id = $post->ID;
        $prices = edd_get_variable_prices($download_id);
        $type = edd_single_price_option_mode($download_id) ? 'checkbox' : 'radio';
        $extra_class = "";
        if ($campaign->is_donations_only()) {
            $extra_class = 'project-donate-only';
        }
        ?>
            <div id="back-this-project" class="campaign-sidebar <?php 
        echo esc_attr($extra_class);
        ?>
 col-sm-4">
                <?php 
        if ($campaign->is_active()) {
            if ($campaign->is_donations_only()) {
                echo '<p class="donate-only">' . __('This project is donation only, and you can donate using the button below.', 'swiftframework') . '</p>';
                echo edd_get_purchase_link(array('download_id' => $post->ID, 'class' => 'accent sf-button contribute-now', 'price' => false, 'text' => __('Donate Now', 'swiftframework')));
            } else {
                echo edd_get_purchase_link(array('download_id' => $post->ID, 'class' => 'accent sf-button contribute-now', 'price' => false, 'text' => __('Contribute Now', 'swiftframework')));
            }
        } else {
            // Inactive, just show options with no button
            if ($campaign->is_donations_only()) {
                echo '<p class="project-ended">' . __('This project has ended.', 'swiftframework') . '</p>';
            } else {
                atcf_campaign_contribute_options($prices, $type, $download_id);
            }
        }
        ?>
            </div>
        <?php 
    }
Esempio n. 10
0
/**
 * Get lists for post ID
 *
 * @since 1.0
*/
function edd_wl_get_wish_lists($download_id, $price_ids, $items, $price_option_single)
{
    ob_start();
    $messages = edd_wl_messages();
    global $edd_options;
    $text = !empty($edd_options['edd_wl_add_to_wish_list']) ? $edd_options['edd_wl_add_to_wish_list'] : sprintf(__('Add to %s', 'edd-wish-lists'), edd_wl_get_label_singular(true));
    ?>

<div class="modal-header">

	<h2 id="edd-wl-modal-label">
		<?php 
    echo esc_attr($text);
    ?>
	</h2>

   <?php 
    $download = $download_id ? get_the_title($download_id) : '';
    // price variations
    // EG: Download Name - Option 1, Option 2, Option 3
    if (edd_has_variable_prices($download_id)) {
        $price_options = array();
        foreach ($items as $item) {
            $price_options[] = edd_get_price_name($item['id'], $item['options']);
        }
    }
    $options = !empty($price_options) ? ' - ' . implode(', ', $price_options) : '';
    // show user what they have selected
    echo '<p>' . sprintf('%1$s%2$s', $download, $options) . '</p>';
    ?>

	<a class="edd-wl-close" href="#" data-dismiss="modal">
		<i class="glyphicon glyphicon-remove"></i>
		<span class="hide-text"><?php 
    _e('Close', 'edd-wish-lists');
    ?>
</span>
	</a>
	
</div>

<div class="modal-body">
	<?php 
    // show lists this item is already included in
    echo edd_wl_lists_included($download_id, $items[0]['options']);
    ?>

	<?php 
    if (!edd_wl_allow_guest_creation()) {
        ?>
		<?php 
        echo '<p>' . $messages['must_login'] . '</p>';
        ?>
	<?php 
    } else {
        ?>
		
		<?php 
        $list_query = edd_wl_get_query();
        $private = edd_wl_get_query('private');
        $public = edd_wl_get_query('public');
        $variable_pricing = edd_has_variable_prices($download_id);
        $data_variable = $variable_pricing ? ' data-variable-price=yes' : 'data-variable-price=no';
        $type = edd_single_price_option_mode($download_id) ? 'data-price-mode=multi' : 'data-price-mode=single';
        ?>

		<form method="post" action="" class="form-modal">
		      
			<?php 
        if ($list_query) {
            ?>
		            <p id="current_lists">
		            <input type="radio" checked="" id="existing-list" value="existing-list" name="list-options">
		            <label for="existing-list"><?php 
            echo $messages['modal_option_add_to_existing'];
            ?>
</label>

		              <select id="user-lists" name="user-lists">
		            	
		            	<?php 
            /**
             * Public lists
             */
            if ($public) {
                ?>

		            	  <optgroup label="Public">
		            	 
		            	  <?php 
                foreach ($public as $id) {
                    ?>
		            	    <option value="<?php 
                    echo $id;
                    ?>
"><?php 
                    echo get_the_title($id) . ' ' . edd_wl_get_item_count($id);
                    ?>
</option>  
		            	 <?php 
                }
                ?>
		            	  
		            	   </optgroup>

		            	<?php 
            }
            ?>

		               <?php 
            /**
             * Private lists
             */
            if ($private) {
                ?>

		                <optgroup label="Private">
		               
		                <?php 
                foreach ($private as $id) {
                    ?>
		                  <option value="<?php 
                    echo $id;
                    ?>
"><?php 
                    echo get_the_title($id) . ' ' . edd_wl_get_item_count($id);
                    ?>
</option> 
		                <?php 
                }
                ?>
		                
		                 </optgroup>
		              <?php 
            }
            ?>

		              </select>

		            </p>

		    <?php 
        }
        ?>

		             <p>
						<input type="radio" id="new-list" value="new-list" name="list-options">
						<label for="new-list"><?php 
        echo $messages['modal_option_add_new'];
        ?>
</label>

						<input type="text" id="list-name" name="list-name" placeholder="<?php 
        echo $messages['modal_option_title'];
        ?>
">

						<select id="list-status" name="list-status">
							<option value="private"><?php 
        echo $messages['list_option_private'];
        ?>
</option>
							<option value="publish"><?php 
        echo $messages['list_option_public'];
        ?>
</option>
						</select>
		            </p>

		              </div>

		         <?php 
        // add a hidden input field for each price ID which our next ajax function will grab
        foreach ($price_ids as $id) {
            ?>
		         		<input name="edd-wish-lists-post-id" type="hidden" value="<?php 
            echo $id;
            ?>
">
		         	<?php 
        }
        ?>
     

		        
		         <?php 
        if ($price_option_single) {
            ?>
		         <input name="edd-wl-single-price-option" type="hidden" value="yes">
		     	<?php 
        }
        ?>

		         <div class="modal-footer"> 			
        				<?php 
        $args = array('download_id' => $download_id, 'text' => $messages['modal_option_save'], 'icon' => '', 'action' => 'edd_add_to_wish_list', 'class' => 'edd-wl-save edd-wl-action', 'style' => 'button');
        edd_wl_wish_list_link($args);
        ?>

        				<a class="edd-wl-button edd-wl-success edd-wl-action" href="#" data-dismiss="modal" style="display:none;">
        					<?php 
        echo $messages['modal_option_close'];
        ?>
        				</a>
	
      				</div>

		            </form>
	<?php 
    }
    ?>
 	
  </div>
	<?php 
    $html = ob_get_clean();
    return apply_filters('edd_wl_get_wish_lists', $html);
}
    /**
     * Display variable price.
     *
     * Display the variable price with a strikethrough in the list.
     * NOTE! This function replaces an entire EDD function!
     *
     * @since 1.0.0
     *
     * @param	int		$download_id	ID of the download to get the labels for.
     * @param	array	$args			Array of arguments related to the download price.
     */
    public function edd_purchase_variable_pricing($download_id = 0, $args = array())
    {
        global $edd_options;
        $variable_pricing = edd_has_variable_prices($download_id);
        $prices = apply_filters('edd_purchase_variable_prices', edd_get_variable_prices($download_id), $download_id);
        if (!$variable_pricing || false !== $args['price_id'] && isset($prices[$args['price_id']])) {
            return;
        }
        if (edd_item_in_cart($download_id) && !edd_single_price_option_mode($download_id)) {
            return;
        }
        $type = edd_single_price_option_mode($download_id) ? 'checkbox' : 'radio';
        $mode = edd_single_price_option_mode($download_id) ? 'multi' : 'single';
        do_action('edd_before_price_options', $download_id);
        ?>
		<div class="edd_price_options edd_<?php 
        echo esc_attr($mode);
        ?>
_mode">
			<ul>
				<?php 
        if ($prices) {
            $checked_key = isset($_GET['price_option']) ? absint($_GET['price_option']) : edd_get_default_variable_price($download_id);
            foreach ($prices as $key => $price) {
                ?>
<li id="edd_price_option_<?php 
                echo $download_id . '_' . sanitize_key($price['name']);
                ?>
" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
							<label for="<?php 
                echo esc_attr('edd_price_option_' . $download_id . '_' . $key);
                ?>
">
								<input type="<?php 
                echo $type;
                ?>
" <?php 
                checked(apply_filters('edd_price_option_checked', $checked_key, $download_id, $key), $key);
                ?>
									name="edd_options[price_id][]" id="<?php 
                echo esc_attr('edd_price_option_' . $download_id . '_' . $key);
                ?>
"
									class="<?php 
                echo esc_attr('edd_price_option_' . $download_id);
                ?>
" value="<?php 
                echo esc_attr($key);
                ?>
"/>
									<span class='edd_price_option_wrap'>
										<span class="edd_price_option_name" itemprop="description"><?php 
                echo esc_html($price['name']);
                ?>
</span>
										<span class="edd_price_option_sep">&ndash;</span>&nbsp;<?php 
                if (isset($price['sale_price']) && !empty($price['sale_price']) && isset($price['regular_amount'])) {
                    ?>
<span class="edd_price_option_price regular_price" itemprop="price"><del><?php 
                    echo edd_currency_filter(edd_format_amount($price['regular_amount']));
                    ?>
</del></span>&nbsp;<?php 
                }
                ?>
<span class="edd_price_option_price" itemprop="price"><?php 
                echo edd_currency_filter(edd_format_amount($price['amount']));
                ?>
</span>
									</span>
							</label><?php 
                do_action('edd_after_price_option', $key, $price, $download_id);
                ?>
</li><?php 
            }
        }
        do_action('edd_after_price_options_list', $download_id, $prices, $type);
        ?>
			</ul>
		</div><!--end .edd_price_options-->
		<?php 
        do_action('edd_after_price_options', $download_id);
    }
/**
 * Variable price output
 *
 * Outputs variable pricing options for each download or a specified downloads in a list.
 * The output generated can be overriden by the filters provided or by removing
 * the action and adding your own custom action.
 *
 * @since 1.2.3
 * @param int $download_id Download ID
 * @param bool $show_price
 * @return void
 */
function edd_purchase_variable_pricing($download_id = 0, $show_price = true)
{
    $variable_pricing = edd_has_variable_prices($download_id);
    if (!$variable_pricing || empty($show_price)) {
        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);
    ?>
	<div class="edd_price_options">
		<ul>
			<?php 
    if ($prices) {
        foreach ($prices as $key => $price) {
            echo '<li id="edd_price_option_' . $download_id . '_' . sanitize_key($price['name']) . '">';
            printf('<label for="%3$s"><input type="%2$s" %1$s name="edd_options[price_id][]" id="%3$s" class="%4$s" value="%5$s" %7$s/> %6$s</label>', checked(0, $key, false), $type, esc_attr('edd_price_option_' . $download_id . '_' . $key), esc_attr('edd_price_option_' . $download_id), esc_attr($key), '<span class="edd_price_option_name">' . esc_html($price['name']) . '</span><span class="edd_price_option_sep">&nbsp;&ndash;&nbsp;</span><span class="edd_price_option_price">' . edd_currency_filter(edd_format_amount($price['amount'])) . '</span>', checked(isset($_GET['price_option']), $key, false));
            do_action('edd_after_price_option', $key, $price, $download_id);
            echo '</li>';
        }
    }
    do_action('edd_after_price_options_list', $download_id, $prices, $type);
    ?>
		</ul>
	</div><!--end .edd_price_options-->
<?php 
    do_action('edd_after_price_options', $download_id);
}
/**
 * Price Section
 *
 * If variable pricing is not enabled, simply output a single input box.
 *
 * If variable pricing is enabled, outputs a table of all current prices.
 * Extensions can add column heads to the table via the `edd_download_file_table_head`
 * hook, and actual columns via `edd_download_file_table_row`
 *
 * @since 1.0
 * @see edd_render_price_row()
 * @return void
 */
function edd_render_price_field($post_id)
{
    global $edd_options;
    $price = edd_get_download_price($post_id);
    $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;"';
    ?>
	<p>
		<strong><?php 
    echo apply_filters('edd_price_options_heading', __('Pricing Options:', 'edd'));
    ?>
</strong>
	</p>

	<p>
		<label for="edd_variable_pricing">
			<input type="checkbox" name="_variable_pricing" id="edd_variable_pricing" value="1" <?php 
    checked(1, $variable_pricing);
    ?>
 />
			<?php 
    echo apply_filters('edd_variable_pricing_toggle_text', __('Enable variable pricing', 'edd'));
    ?>
		</label>
	</p>

	<div id="edd_regular_price_field" class="edd_pricing_fields" <?php 
    echo $price_display;
    ?>
>
		<?php 
    if (!isset($edd_options['currency_position']) || $edd_options['currency_position'] == 'before') {
        ?>
			<?php 
        echo edd_currency_filter('');
        ?>
<input type="text" name="edd_price" id="edd_price" value="<?php 
        echo isset($price) ? esc_attr(edd_format_amount($price)) : '';
        ?>
" size="30" style="width: 80px;" placeholder="9.99"/>
		<?php 
    } else {
        ?>
			<input type="text" name="edd_price" id="edd_price" value="<?php 
        echo isset($price) ? esc_attr(edd_format_amount($price)) : '';
        ?>
" size="30" style="width: 80px;" placeholder="9.99"/><?php 
        echo edd_currency_filter('');
        ?>
		<?php 
    }
    ?>

		<?php 
    do_action('edd_price_field', $post_id);
    ?>
	</div>

	<?php 
    do_action('edd_after_price_field', $post_id);
    ?>

	<div id="edd_variable_price_fields" class="edd_pricing_fields" <?php 
    echo $variable_display;
    ?>
>
		<input type="hidden" id="edd_variable_prices" class="edd_variable_prices_name_field" value=""/>
		<p>
			<input type="checkbox" name="_edd_price_options_mode" id="edd_price_options_mode"<?php 
    checked(1, $single_option_mode);
    ?>
 />
			<label for="edd_price_options_mode"><?php 
    apply_filters('edd_multi_option_purchase_text', _e('Enable multi option purchase mode. Leave unchecked to only permit a single price option to be purchased', 'edd'));
    ?>
</label>
		</p>
		<div id="edd_price_fields" class="edd_meta_table_wrap">
			<table class="widefat edd_repeatable_table" width="100%" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th style="width: 20px;"></th>
						<th><?php 
    _e('Option Name', 'edd');
    ?>
</th>
						<th style="width: 90px"><?php 
    _e('Price', 'edd');
    ?>
</th>
						<?php 
    do_action('edd_download_price_table_head', $post_id);
    ?>
						<th style="width: 2%"></th>
					</tr>
				</thead>
				<tbody>
					<?php 
    if (!empty($prices)) {
        foreach ($prices as $key => $value) {
            $name = isset($value['name']) ? $value['name'] : '';
            $amount = isset($value['amount']) ? $value['amount'] : '';
            $args = apply_filters('edd_price_row_args', compact('name', 'amount'), $value);
            ?>
						<tr class="edd_variable_prices_wrapper edd_repeatable_row">
							<?php 
            do_action('edd_render_price_row', $key, $args, $post_id);
            ?>
						</tr>
					<?php 
        }
    } else {
        ?>
						<tr class="edd_variable_prices_wrapper edd_repeatable_row">
							<?php 
        do_action('edd_render_price_row', 0, array(), $post_id);
        ?>
						</tr>
					<?php 
    }
    ?>

					<tr>
						<td class="submit" colspan="4" style="float: none; clear:both; background:#fff;">
							<a class="button-secondary edd_add_repeatable" style="margin: 6px 0;"><?php 
    _e('Add New Price', 'edd');
    ?>
</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div><!--end #edd_variable_price_fields-->
<?php 
}