Advertisement
fahimmurshed

fund-campaign-btn.php

Jan 3rd, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.13 KB | None | 0 0
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3.     exit; // Exit if accessed directly
  4. }
  5. ?>
  6. <div class="wpneo-single-sidebar">
  7.     <?php
  8.     global $post, $woocommerce, $product;
  9.     $currency = '$';
  10.     if ($product->get_type() == 'crowdfunding') {
  11.         if (WPNEOCF()->campaignValid()) {
  12.             $recomanded_price = get_post_meta($post->ID, 'wpneo_funding_recommended_price', true);
  13.             $min_price = get_post_meta($post->ID, 'wpneo_funding_minimum_price', true);
  14.             $max_price = get_post_meta($post->ID, 'wpneo_funding_maximum_price', true);
  15.             $predefined_price = get_post_meta($post->ID, 'wpcf_predefined_pledge_amount', true);
  16.             if ( ! empty($predefined_price)){
  17.                 $predefined_price = apply_filters('wpcf_predefined_pledge_amount_array_a', explode(',', $predefined_price));
  18.             }
  19.  
  20.             //print_r($predefined_price);
  21.  
  22.             if(function_exists( 'get_woocommerce_currency_symbol' )){
  23.                 $currency = get_woocommerce_currency_symbol();
  24.             }
  25.  
  26.             if (! empty($_GET['reward_min_amount'])){
  27.                 $recomanded_price = (int) esc_html($_GET['reward_min_amount']);
  28.             } ?>
  29.  
  30.             <span class="wpneo-tooltip">
  31.                 <span class="wpneo-tooltip-min"><?php _e('Minimum amount is ','backer'); echo $currency.$min_price; ?></span>
  32.                 <span class="wpneo-tooltip-max"><?php _e('Maximum amount is ','backer'); echo $currency.$max_price; ?></span>
  33.             </span>
  34.  
  35.             <?php
  36.             if (is_array($predefined_price) && count($predefined_price)){
  37.                 echo '<ul class="wpcf_predefined_pledge_amount">';
  38.                 foreach ($predefined_price as $price){
  39.                     $price = trim($price);
  40.                     $wooPrice = wc_price($price);
  41.                     echo " <li><a href='javascript:;' data-predefined-price='{$price}'> {$wooPrice}</a> </li> ";
  42.                 }
  43.                 echo "</ul>";
  44.             }
  45.  
  46.             $wpneo_campaign_end_method = get_post_meta(get_the_ID(), 'wpneo_campaign_end_method', true);
  47.             if ( $wpneo_campaign_end_method == 'target_goal' && $wpneo_campaign_end_method == 'target_date' && $wpneo_campaign_end_method == 'target_goal_and_date' ) {
  48.                 ?>
  49.  
  50.                 <form enctype="multipart/form-data" method="post" class="cart Ahamed">
  51.                     <?php do_action('before_wpneo_donate_field'); ?>
  52.                     <?php echo get_woocommerce_currency_symbol(); ?>
  53.                     <input type="number" step="any" min="0" placeholder="<?php echo $recomanded_price; ?>" name="wpneo_donate_amount_field" class="input-text amount wpneo_donate_amount_field text" value="<?php echo $recomanded_price; ?>" data-min-price="<?php echo $min_price ?>" data-max-price="<?php echo $max_price ?>" >
  54.                     <?php do_action('after_wpneo_donate_field'); ?>
  55.  
  56.                     <input type="hidden" value="<?php echo esc_attr($post->ID); ?>" name="add-to-cart">
  57.                     <button type="submit" class="<?php echo apply_filters('add_to_donate_button_class', 'wpneo_donate_button'); ?>"><?php _e('Back Campaign', 'backer'); ?></button>
  58.                 </form>
  59.  
  60.                 <?php
  61.             }else {
  62.                 echo '<span>'.__('Campaign is over', 'backer').'<span>';       
  63.             }
  64.  
  65.         } else {
  66.             if ( ! WPNEOCF()->is_campaign_started()){
  67.                 WPNEOCF()->campaign_start_countdown();
  68.             }else{
  69.                 _e('This campaign has been invalid or not started yet.','backer');
  70.             }
  71.         }
  72.     }
  73.  
  74.     ?>
  75. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement