• Resolved Roelf Keulder

    (@roelfk7)


    Good Day, Thank you for an excellent plugin.

    I’m busy learning how to write plugins for WordPress and I have learned a lot from your plugin.

    I’m trying to add some quick bid buttons on the single auction page, in the auction-shortcode.php file.

    The code I want to add look something like this.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "https://www.w3.org/TR/html4/strict.dtd"> 
    <html lang="en-GB"> 
     <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>Quick Button Bid</title> 
     <script type="text/javascript">
    function transferField(someval) { 
      document.bidform.bidval.value = someval; 
      } 
    </script>
    <style> 
    input[type=text] {
      width: 130px;
      box-sizing: border-box;
      border: 2px solid #ccc;
      border-radius: 9px;
      font-size: 16px;
      background-color: white;
      padding: 12px 20px;
      transition: width 0.4s ease-in-out;
      
    }
    input[type=text]:focus {
      width: 10%;
    }
    
    input[type=button], input[type=submit], input[type=reset] {
      background-color: #4CAF50;
      border: none;
      border-radius: 9px;
      box-shadow: 5px 5px 10px #ccc;
      color: white;
      font-size: 16px;
      padding: 15px 20px;
      text-decoration: none;
      margin: 4px 2px;
      cursor: pointer;
    }
    input[type=reset]:hover  {
      background-color: #d61536;
      padding: 16px 21px;
    }
    input[type=button]:hover  {
      background-color: #1920e3;
      padding: 16px 21px;
    }
    
    </style>
    </head> 
    <body> 
     <form name="bidform">
    <input type="text" id="bidval" value="">
    <input type="reset" value="Reset">
    </form>
    
    <input type="button" onclick="transferField(this.value)" value="1500.00">
    <input type="button" onclick="transferField(this.value)" value="1000.00">
    <input type="button" onclick="transferField(this.value)" value="500.00">
    
     </body> 
    </html>

    So I have created a javascript file in the js folder. and I call it up in the shortcode.php file.

    The js file called ( quick-button-script.js) look now like this.

    <script type="text/javascript">
    function transferField(someval) { 
      document.wdmua-singleauc-bidform.wdm-bidder-bidval.value = someval; 
      } 
    </script>

    And I call it in the file like this

    function wdm_enqueue_front_script() {
    
        if (isset($_GET["ult_auc_id"]) && $_GET["ult_auc_id"]) {
            wp_enqueue_style('wdm_lightbox_css', plugins_url('lightbox/jquery.fs.boxer.css', __FILE__));
            wp_enqueue_script('wdm-lightbox-js', plugins_url('lightbox/jquery.fs.boxer.js', __FILE__), array('jquery'));
            wp_enqueue_script('wdm-block-ui-js', plugins_url('js/wdm-jquery.blockUI.js', __FILE__), array('jquery'));
            wp_enqueue_script('wdm-custom-js', plugins_url('js/wdm-custom-js.js', __FILE__), array('jquery'));
            wp_enqueue_style( 'heart', plugins_url('css/heart.css', __FILE__));
            wp_enqueue_script('quick-button-script', plugins_url('js/quick-button-script.js', __FILE__), array('jquery'));
        }
    }

    And then I have added the code in the file online 489

    ('wdm_ua_text_after_bid_form', $ehtml, $wdm_auction->ID);
                                                            echo $ehtml;
                                                            ?>
                                                        </small>
                                                    </span>
                                                </div>
                                                
    <input type="reset" value="Reset">
    
    <input type="button" onclick="transferField(this.value)" value="1500.00">
    <input type="button" onclick="transferField(this.value)" value="1000.00">
    <input type="button" onclick="transferField(this.value)" value="500.00">
    
                                                <div class="wdm_place_bid wdm-align
                                                -right clearfix">
                                                    <input type="submit" 
    													value="<?php echo apply_filters(		'wdm_ultimate_auction_bid_button_text', __( 'Place Bid', 'wdm-ultimate-auction' )); ?>" id="wdm-place-bid-now" />
    											
                                                </div>
                                            </div>
                                        </form>
                                        <?php

    But somehow I cant get it to work. Do you have any ideas what I can do to get it to work?

    Thank You

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Quick Bid Buttons’ is closed to new replies.