function wa_save_setting()
 {
     if (!isset($_POST['wa_setting']) || count($_POST['wa_setting']) <= 0) {
         return;
     }
     // action before save setting
     do_action('wa_before_save_setting', $_POST);
     $options = $_POST['wa_setting'];
     $variable_default = array('wa_countdown_format' => isset($options['wa_countdown_format']) ? $options['wa_countdown_format'] : '%-w week%!w %-d day%!d %H:%M:%S', 'wa_display_owner_info' => isset($options['wa_display_owner_info']) ? $options['wa_display_owner_info'] : 0, 'wa_display_start_price' => isset($options['wa_display_start_price']) ? $options['wa_display_start_price'] : 0, 'wa_display_bid_increment' => isset($options['wa_display_bid_increment']) ? $options['wa_display_bid_increment'] : 0, 'wa_display_reserve_price' => isset($options['wa_display_reserve_price']) ? $options['wa_display_reserve_price'] : 0, 'wa_display_buy_now_price' => isset($options['wa_display_buy_now_price']) ? $options['wa_display_buy_now_price'] : 0);
     // not update if wa_mail_password empty
     if (empty($options['wa_mail_password'])) {
         unset($options['wa_mail_password']);
     }
     $options = WA_Helper::define_variable($options, $variable_default);
     foreach ($options as $f_name => $option) {
         update_option($f_name, $option, '');
     }
     // action after save setting
     do_action('wa_after_save_setting', $_POST);
 }
예제 #2
0
        function wa_mail_data($user_id, $bid_price, $product, $mailTemp = 'mail_won')
        {
            $this->user = get_userdata($user_id);
            $this->product_link = get_permalink($product->id);
            $this->to = $this->user->user_email;
            $this->subject = get_option('wa_mail_subject', 'Auction');
            $this->headers = array('Content-Type: text/html; charset=UTF-8');
            // body
            switch ($mailTemp) {
                case 'mail_lost':
                    $order = array('[username]', '[product_name]', '[price]', '[link]');
                    $replace = array($this->user->user_login, $product->post->post_title, WA_Helper::currency($bid_price), $this->product_link);
                    $temp_default = '<p>Hello [username],</p>
								<p>you\'ve lost in auctions: [product_name]</p>
								<p>Price: [price]</p>
								<p>Link product auction: [link]</p>
								&nbsp;
								<p>Thank you.</p>';
                    $this->body = str_replace($order, $replace, get_option('wa_content_mail_lost_template', $temp_default));
                    break;
                default:
                    $order = array('[username]', '[product_name]', '[price]', '[link]');
                    $replace = array($this->user->user_login, $product->post->post_title, WA_Helper::currency($bid_price), $this->product_link);
                    $temp_default = '<p>Hello [username],</p>
								<p>You are  the winner in the auction: [product_name]</p>
								<p>Price: [price]</p>
								<p>Link order: [link]</p>
								&nbsp;
								<p>Thank you.</p>';
                    $this->body = str_replace($order, $replace, get_option('wa_content_mail_won_template', $temp_default));
                    break;
            }
            return $this->wa_send_mail();
        }
							<i class="ion-ribbon-b"></i> <?php 
_e('Bids', 'wa');
?>
						</span> 
						<span class="wa-info-field-content">
							0
						</span>
					</li>
					<li>
						<span class="wa-info-field">
							<i class="ion-social-usd"></i> <?php 
_e('Current Bid', 'wa');
?>
						</span> 
						<span class="wa-info-field-content"><?php 
echo WA_Helper::currency($meta_fields['_wa_reserve_price'][0]);
?>
</span>
					</li>
					<li>
						<span class="wa-info-field">
							<i class="ion-clock"></i> <?php 
_e('Time Remaining', 'wa');
?>
						</span>
						<span class="countdown wa-info-field-content" data-datatime="<?php 
echo "{$dates['end']}";
?>
" data-format="%-w week%!w %-d day%!d %H:%M:%S">
						  	<span class="clock"></span>
						</span>
                                            <div class="wa-highest-bid-price-product"></div>
                                            <div class="wa-text-center">
                                                <p><label for="wa-product-bid-price"><?php 
    _e('Bid price', 'wa');
    ?>
 (<?php 
    echo WA_Helper::currency();
    ?>
)</label></p>
                                                <p style="width: 200px; margin: auto;">
                                                    <input type="number" name="price" class="form-control wa-text-center" id="wa-product-bid-price" placeholder="00.00" required>
                                                    <small><i>(<?php 
    _e('increment price');
    ?>
 <span><?php 
    echo WA_Helper::currency($meta_fields['_wa_bid_increment'][0]);
    ?>
)</i></span></small>
                                                </p>
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <input type="hidden" name="product_id" value="<?php 
    echo esc_attr($post->ID);
    ?>
"/>
                                            
                                            <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    _e('Close', 'wa');
    ?>
</button>
 function wa_page_orders()
 {
     $query = array("tableName" => "wa_product_orders AS a", "select" => "a.date AS order_date, a.status AS order_status, a.extra_fields AS order_extra_fields, b.*", "join" => array(array("tableName" => "woocommerce_order_items AS b", "on" => "a.order_id = b.order_id")), "orderField" => "a.id DESC", "where" => "b.order_item_type = 'line_item'");
     $params = array("manage_post_per_page" => 10, "manage_header_columns" => array("Order", "Order status", "Order date"), "manage_content_columns" => array("order_id", "order_status", "order_date"), "filter" => array(&$this, 'filter_order'), "manage_query" => $query);
     WA_Helper::create_list_page($params);
 }
예제 #6
0
									<label class="wa-label" for="<?php 
                        echo esc_attr($f_name);
                        ?>
"><?php 
                        echo "{$option['title']}";
                        ?>
</label>							
									<div class="wa-field"><?php 
                        echo WA_Helper::_HTML($f_name, $option);
                        ?>
</div>
									<?php 
                    } else {
                        ?>
									<div class="wa-field-full"><?php 
                        echo WA_Helper::_HTML($f_name, $option);
                        ?>
</div>
									<?php 
                    }
                    ?>
								</div>
								<?php 
                    break;
            }
        }
    }
    echo "</div>";
    array_push($body_tabs, ob_get_clean());
}
echo implode('', $header_tabs);
예제 #7
0
_e('Current price', 'wa');
?>
</p></div>
							<span class="wa-info-field-content">
								<?php 
echo empty($current_price) ? WA_Helper::currency($meta_fields['_wa_start_price'][0]) : WA_Helper::currency($current_price);
?>
							</span>
						</div>
						<div class="wa-buy-bow-content">
							<div><i class="ion-ios-heart-outline"></i> <p><?php 
_e('Buy now price', 'wa');
?>
</p></div>
							<span class="wa-info-field-content"><?php 
echo WA_Helper::currency($meta_fields['_wa_buy_it_now_price'][0]);
?>
</span>
						</div>
					</li>
				</ul>
			</div>
			<div class="col-md-4">
				<div class="wa-product-entry-title">
					<a class="wa-url" href="<?php 
echo esc_url(get_permalink($posts->ID));
?>
">
						<h2><?php 
the_title();
?>
예제 #8
0
 function wa_save_price_bid_product()
 {
     extract($_POST);
     $check_price = $this->wa_check_bid_product($product_id, $price);
     $result_arr = array();
     do_action('after_wa_bid');
     if ($check_price == false) {
         $next_price = $this->wa_next_price_bid_product(false);
         $highest_price = $this->wa_get_highest_bid_by_productid($product_id);
         $result_arr['st'] = 'fail';
         $result_arr['ico'] = '<i class="ion-ios-close" style="color: red"></i>';
         $result_arr['mess'] = 'Bid fail.';
         $result_arr['next_price'] = $next_price;
         $result_arr['highest_price'] = WA_Helper::currency($highest_price[0]['price']);
     } else {
         global $user_ID;
         require_once WA_PLUGIN_DIR . '/includes/class-wa-db.php';
         $db = new WA_Db();
         $arr_query = array("tableName" => "wa_product_bids", "arrItems" => array("product_id" => $product_id, "user_id" => $user_ID, "date" => date('Y-m-d H:i:s'), "price" => $price, "status" => 1));
         $rowID = $db->insert($arr_query);
         $result_arr['st'] = 'success';
         $result_arr['ico'] = '<i class="ion-ios-checkmark" style="color: green"></i>';
         $result_arr['mess'] = 'Bid success, thank you!';
     }
     do_action('before_wa_bid');
     echo json_encode(apply_filters('before_wa_result_bid_data', $result_arr));
     exit;
 }
<div id="woo_auction_tab" class="panel woocommerce_options_panel wc-metaboxes-wrapper">
	<?php 
foreach ($wa_fields as $f_name => $params) {
    ?>
		<div class="options_group">
			<p class="form-field">
				<label for="<?php 
    echo esc_attr($f_name);
    ?>
"><?php 
    echo "{$params['title']}";
    ?>
</label>
				<?php 
    echo WA_Helper::_HTML($f_name, $params);
    ?>
			</p>
		</div>
		<?php 
}
?>
</div>