Exemplo n.º 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 
}
/**
 * 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;
        }
    }
}
/**
 * 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;
        }
    }
}
    /**
     * Display the widget content.
     *
     * @since 1.0
     *
     * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
     * @param array $instance The settings for the particular instance of the widget
     */
    function widget($args, $instance)
    {
        // Merge with defaults
        $instance = wp_parse_args((array) $instance, $this->defaults);
        // Return early if we have no download ID or no variable prices
        if (!isset($instance['download'])) {
            return;
        }
        // Set the download ID
        $download_id = absint($instance['download']);
        // Get the featured price option
        $featured = isset($instance['featured']) && !empty($instance['featured']) ? 'featured' : null;
        // Set the title
        $title = get_the_title($download_id);
        echo $args['before_widget'];
        ?>
		<div itemscope class="pricing-table <?php 
        echo $featured;
        ?>
">
			<div class="pricing-table-top">
				<div class="pricing-table-price">
					<?php 
        edd_price($download_id);
        ?>
				</div>
				<div class="pricing-table-price-desc"><?php 
        echo esc_html($title);
        ?>
</div>
			</div>
			<div class="pricing-table-features">
				<?php 
        checkout_edd_download_details($download_id);
        ?>
				<a class="button" href="<?php 
        echo edd_get_checkout_uri();
        ?>
?edd_action=add_to_cart&amp;download_id=<?php 
        echo absint($download_id);
        ?>
" title="<?php 
        echo esc_attr($title);
        ?>
">
					<?php 
        _e('Buy Now', 'checkout');
        ?>
				</a>
			</div>
		</div>

		<?php 
        echo $args['after_widget'];
    }
function download_price_function($atts)
{
    $atts = shortcode_atts(array('limit' => -1, 'id' => ''), $atts, 'download_price');
    if ($atts['id'] != '') {
        $id = $atts['id'];
    } else {
        $id = get_the_id();
    }
    if (edd_has_variable_prices($id)) {
        $get_default_price = edd_get_default_variable_price($id);
        return edd_price($id, false, $get_default_price);
    } else {
        return edd_price($id, false);
    }
}
/**
 * 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;
        }
    }
}
/**
 * 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;
        }
    }
}
Exemplo n.º 8
0
function edd_rp_render_shortcode($attributes, $content = null)
{
    global $post;
    extract(shortcode_atts(array('ids' => $post->id, 'user' => 'false', 'count' => 3, 'title' => __('Recommended Products', EDD_RP_TEXT_DOMAIN)), $attributes, 'recommended_products'));
    $ids = str_replace(' ', '', $ids);
    $ids = explode(',', $ids);
    $count = absint($count);
    $user_id = $user == 'true' ? get_current_user_id() : false;
    $suggestions = edd_rp_get_multi_suggestions($ids, $user_id, $count);
    if (is_array($suggestions) && !empty($suggestions)) {
        $suggestions = array_keys($suggestions);
        $suggested_downloads = new WP_Query(array('post__in' => $suggestions, 'post_type' => 'download'));
        if ($suggested_downloads->have_posts()) {
            ?>
			<div id="edd-rp-single-wrapper">
				<h5 id="edd-rp-single-header"><?php 
            echo $title;
            ?>
</h5>
				<div id="edd-rp-items-wrapper" class="edd-rp-single">
					<?php 
            while ($suggested_downloads->have_posts()) {
                ?>
						<?php 
                $suggested_downloads->the_post();
                ?>
						<div class="edd-rp-item <?php 
                echo !current_theme_supports('post-thumbnails') ? 'edd-rp-nothumb' : '';
                ?>
">
							<a href="<?php 
                the_permalink();
                ?>
">
							<?php 
                the_title();
                ?>
							<?php 
                if (current_theme_supports('post-thumbnails') && has_post_thumbnail(get_the_ID())) {
                    ?>
								<div class="edd_cart_item_image">
									<?php 
                    echo get_the_post_thumbnail(get_the_ID(), apply_filters('edd_checkout_image_size', array(125, 125)));
                    ?>
								</div>
							<?php 
                } else {
                    ?>
								<br />
							<?php 
                }
                ?>
							</a>
							<?php 
                if (!edd_has_variable_prices(get_the_ID())) {
                    ?>
								<?php 
                    edd_price(get_the_ID());
                    ?>
							<?php 
                }
                ?>

							<?php 
                echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'price' => false, 'direct' => false));
                ?>
						</div>
					<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        ?>

		<?php 
        wp_reset_postdata();
        ?>

	<?php 
    }
}
Exemplo n.º 9
0
							<span class="tribe-tickets-remaining">
								<?php 
                echo sprintf(esc_html__('%1$s available', 'event-tickets-plus'), '<span class="available-stock" ' . $data_product_id . '>' . esc_html($remaining) . '</span>');
                ?>
							</span>
							<?php 
            }
        } else {
            echo '<span class="tickets_nostock">' . esc_html__('Out of stock!', 'event-tickets-plus') . '</span>';
        }
        echo '</td>';
        echo '<td class="tickets_name">';
        echo $ticket->name;
        echo '</td>';
        echo '<td class="tickets_price">';
        echo edd_price($product->ID);
        echo '</td>';
        echo '<td class="tickets_description">';
        echo $ticket->description;
        echo '</td>';
        echo '</tr>';
        echo '<tr class="tribe-tickets-attendees-list-optout">' . '<td colspan="4">' . '<input type="checkbox" name="optout_' . esc_attr($ticket->ID) . '" id="tribe-tickets-attendees-list-optout-edd">' . '<label for="tribe-tickets-attendees-list-optout-edd">' . esc_html__('Don\'t list me on the public attendee list', 'event-tickets') . '</label>' . '</td>' . '</tr>';
        include Tribe__Tickets_Plus__Main::instance()->get_template_hierarchy('meta.php');
    }
}
?>

		<?php 
if ($is_there_any_product_to_sell) {
    $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'gray';
    $color = $color == 'inherit' ? '' : $color;
Exemplo n.º 10
0
	<div class="entry-content single-content clearfix">
		<?php 
the_post_thumbnail('large');
?>

		<?php 
the_content();
?>
			<a class="btn btn-primary" role="button" href="<?php 
bloginfo('url');
?>
/checkout?edd_action=add_to_cart&download_id=<?php 
echo get_the_ID();
?>
"><?php 
edd_price($post->ID);
?>
 Buy the PDF</a>
			<?php 
if (get_field('books_amazon_print_link') !== '') {
    ?>
								<a role="button" class="btn btn-primary" href="<?php 
    the_field('books_amazon_print_link');
    ?>
" >Buy print edition</a>
							<?php 
}
?>

			<p id="history" class="description"><em>Sensitive Skin</em> features art, writing and music, without rules or boundaries, by both famous and emerging artists, writers, and musicians from around the globe.
Exemplo n.º 11
0
}
?>

		<?php 
if (get_field('pdf_link') !== '') {
    //enter the download ID in the pdf_link field for the book
    $postID = get_field('pdf_link');
    ?>
									<a class="btn btn-primary" role="button" href="<?php 
    bloginfo('url');
    ?>
/checkout?edd_action=add_to_cart&download_id=<?php 
    the_field('pdf_link');
    ?>
; ?>"><?php 
    edd_price($postID);
    ?>
 Buy the PDF</a>
							<?php 
}
?>
		
		<?php 
if (get_field('manual_link') !== '') {
    ?>
				<?php 
    the_field('manual_link');
    ?>
		<?php 
}
?>
 } elseif ($item_key == 'wc_sku') {
     $html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '"  >';
     $is_product = get_post_type(get_the_ID());
     $active_plugins = get_option('active_plugins');
     if (in_array('woocommerce/woocommerce.php', (array) $active_plugins) && $is_product == 'product') {
         global $woocommerce, $product;
         $sku = $product->get_sku();
         $html_content .= $sku;
     }
     $html_content .= '</div>';
 } elseif ($item_key == 'edd_price') {
     $html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '"  >';
     $is_download = get_post_type(get_the_ID());
     $active_plugins = get_option('active_plugins');
     if (in_array('easy-digital-downloads/easy-digital-downloads.php', (array) $active_plugins) && $is_download == 'download') {
         $edd_price = edd_price(get_the_ID(), false);
         $html_content .= $edd_price;
     }
     $html_content .= '</div>';
 } elseif ($item_key == 'edd_variable_prices') {
     $html_content .= '<div class="element element_' . $item_id . ' ' . $item_key . '"  >';
     $is_download = get_post_type(get_the_ID());
     $active_plugins = get_option('active_plugins');
     if (in_array('easy-digital-downloads/easy-digital-downloads.php', (array) $active_plugins) && $is_download == 'download') {
         $prices = edd_get_variable_prices(get_the_ID());
         if ($prices) {
             $html_price = '';
             $html_price .= '<ul>';
             foreach ($prices as $price_id => $price) {
                 $html_price .= '<li>' . $price['name'] . ': ' . $price['amount'] . '</li>';
                 //is the name of the price
Exemplo n.º 13
0
?>

		<div class="actions">
			<?php 
marketify_purchase_link(get_the_ID());
?>
			<a href="<?php 
the_permalink();
?>
" rel="bookmark" class="button"><?php 
_e('Details', 'marketify');
?>
</a>

			<strong class="item-price"><span><?php 
printf(__('Item Price: %s', 'marketify'), edd_price(get_the_ID(), false));
?>
</span></strong>

			<?php 
do_action('marketify_download_content_image_overlay_after');
?>
		</div>
	</div>

	<?php 
if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::get_the_post_thumbnail('download', 'grid-image')) {
    ?>
		<?php 
    MultiPostThumbnails::the_post_thumbnail('download', 'grid-image', null, 'content-grid-download');
    ?>
Exemplo n.º 14
0
 function wplms_edd_course_credits($credits, $course_id)
 {
     if (in_array('easy-digital-downloads/easy-digital-downloads.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $edd_product = get_post_meta($course_id, 'vibe_edd_download', true);
         if (isset($edd_product) && is_numeric($edd_product)) {
             ob_start();
             edd_price($edd_product);
             $price = ob_get_contents();
             ob_end_clean();
             $private = apply_filters('wplms_private_course_label', __('PRIVATE'));
             if (strpos($credits, $private) !== false) {
                 $credits = $price;
             } else {
                 $credits .= $price;
             }
         }
     }
     return $credits;
 }
/**
 * Price Shortcode
 *
 * Shows the price of a download.
 *
 * @since 1.1.3.3
 * @param array $atts Shortcode attributes
 * @param string $content
 * @return string
 */
function edd_download_price_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('id' => NULL), $atts));
    if (is_null($id)) {
        $id = get_the_ID();
    }
    return edd_price($id, false);
}
Exemplo n.º 16
0
 /**
  * Get's the product price html
  *
  * @param int|object $product
  *
  * @return string
  */
 public function get_price_html($product)
 {
     return edd_price($product);
 }
Exemplo n.º 17
0
/**
 * Add the Price to the download information at the top of the page.
 *
 * @since Marketify 1.0
 *
 * @return void
 */
function marketify_download_price()
{
    global $post;
    edd_price($post->ID);
}
Exemplo n.º 18
0
"><?php 
        the_title();
        ?>
	</a></h5>
                                                <p class="prod-price text-primary">
                                            <span class="price">
                                                <?php 
        if (function_exists('edd_price')) {
            ?>
                                                    <?php 
            if (edd_has_variable_prices(get_the_ID())) {
                // if the download has variable prices, show the first one as a starting price
                echo 'Starting at: ';
                edd_price(get_the_ID());
            } else {
                edd_price(get_the_ID());
            }
            ?>
                                                <?php 
        }
        ?>

                                            </span>
                                                </p>
                                                <div class="filter-list-disp">
                                                    <a href="<?php 
        the_permalink();
        ?>
" class="btn btn-default view-detail">Xem chi tiết</a>
                                                </div>
                                            </div>
/**
 * Adds Download product price to oembed display
 *
 * @since 2.6
 * @return void
 */
function edd_add_oembed_price()
{
    if ('download' !== get_post_type(get_the_ID())) {
        return;
    }
    $show = !get_post_meta(get_the_ID(), '_edd_hide_purchase_link', true);
    if (apply_filters('edd_show_oembed_purchase_links', $show)) {
        echo '<style>.wp-embed-edd-price { margin: 20px 0 0 0; }</style>';
        echo '<div class="wp-embed-edd-price">';
        if (edd_has_variable_prices(get_the_ID())) {
            echo edd_price_range(get_the_ID());
        } else {
            edd_price(get_the_ID(), true);
        }
        echo '</div>';
    }
}
Exemplo n.º 20
0
 public function product_list_price($product_id)
 {
     if (edd_has_variable_prices($product_id)) {
         $price = edd_price_range($product_id);
     } else {
         $price = edd_price($product_id);
     }
     $price = apply_filters('fes_product_list_price', $price, $product_id);
     return $price;
 }
Exemplo n.º 21
0
								<?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>
								<?php 
        }
    }
}
?>

								<?php 
// Get purchase button settings
$behavior = get_post_meta($download_id, '_edd_button_behavior', true);
$hide_button = get_post_meta($download_id, '_edd_hide_purchase_link', true) ? 1 : 0;
// If it's a direct purchase show this text
if ($behavior == 'direct') {
    $button_text = __('Buy Now', 'checkout');