Advertisement
Guest User

fund-campaign-btn

a guest
Oct 8th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.07 KB | None | 0 0
  1. <?php
  2. defined( 'ABSPATH' ) || exit;
  3. ?>
  4. <div class="wpneo-single-sidebar">
  5.     <?php
  6.     global $post, $product;
  7.     $currency = '$';
  8.  
  9.     if (!empty($product->get_type())) {
  10.         if ($product->get_type() == 'crowdfunding') {
  11.             if (wpcf_function()->is_campaign_valid()) {
  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.                 if(function_exists( 'get_woocommerce_currency_symbol' )){
  21.                     $currency = get_woocommerce_currency_symbol();
  22.                 }
  23.  
  24.                 if (! empty($_GET['reward_min_amount'])){
  25.                     $recomanded_price = (int) esc_html($_GET['reward_min_amount']);
  26.                 } ?>
  27.  
  28.                 <span class="wpneo-tooltip">
  29.                     <span class="wpneo-tooltip-min"><?php _e('Minimum amount is ','wp-crowdfunding'); echo $currency.$min_price; ?></span>
  30.                     <span class="wpneo-tooltip-max"><?php _e('Maximum amount is ','wp-crowdfunding'); echo $currency.$max_price; ?></span>
  31.                 </span>
  32.  
  33.                 <?php
  34.                 if (is_array($predefined_price) && count($predefined_price)){
  35.                     echo '<ul class="wpcf_predefined_pledge_amount">';
  36.                     foreach ($predefined_price as $price){
  37.                         $price = trim($price);
  38.                         $wooPrice = wc_price($price);
  39.                         echo " <li><a href='javascript:;' data-predefined-price='{$price}'> {$wooPrice}</a> </li> ";
  40.                     }
  41.                     echo "</ul>";
  42.                 }
  43.                 ?>
  44.  
  45.                 <form enctype="multipart/form-data" method="post" class="cart AA">
  46.                     <?php do_action('before_wpneo_donate_field'); ?>
  47.                     <?php echo get_woocommerce_currency_symbol(); ?>
  48.                    
  49.                     <input oninput="this.value = this.value.replace(/[^0-9\.]/g, '').split(/\./).slice(0, 2).join('.')" 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 ?>" >
  50.  
  51.                     <?php do_action('after_wpneo_donate_field'); ?>
  52.                     <input type="hidden" value="<?php echo esc_attr($post->ID); ?>" name="add-to-cart">
  53.                     <button type="submit" class="<?php echo apply_filters('add_to_donate_button_class', 'wpneo_donate_button'); ?>"><?php _e('Back Campaign', 'wp-crowdfunding'); ?></button>
  54.                 </form>
  55.  
  56.             <?php
  57.             } else {
  58.                 if ( ! wpcf_function()->is_campaign_started()){
  59.                     wpcf_function()->campaign_start_countdown();
  60.                 }else{
  61.                     if( wpcf_function()->is_reach_target_goal() ){
  62.                         _e('The campaign is successful.','wp-crowdfunding');
  63.                     }else{
  64.                         _e('This campaign has been invalid or not started yet.','wp-crowdfunding');
  65.                     }
  66.                 }
  67.             }
  68.         }
  69.     }
  70.  
  71.     ?>
  72. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement