Viewing 2 replies - 1 through 2 (of 2 total)
  • Have a look at plugins/paypal-express-checkout/views/frontendcode.php
    You can add a checkbox there plus a small javascript that check if ticked when submit is enabled.
    Code is currently as follows:

    <form method="post" action="<?php echo $config->getItem('plugin_form_handler_url'); ?>">
      <input type="hidden" name="AMT" value="<?php echo $atts['amount']; ?>" />
      <input type="hidden" name="CURRENCYCODE" value="<?php echo $atts['currency']; ?>" />
      <?php if ( isset($atts['description']) ) { ?>
        <input type="hidden" name="PAYMENTREQUEST_0_DESC" value="<?php echo $atts['description']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['tax']) ) { ?>
        <input type="hidden" name="TAXAMT" value="<?php echo $atts['tax']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['shipping']) ) { ?>
        <input type="hidden" name="SHIPPINGAMT" value="<?php echo $atts['shipping']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['handling']) ) { ?>
        <input type="hidden" name="HANDLINGAMT" value="<?php echo $atts['handling']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['qty']) ) { ?>
        <input type="hidden" name="PAYMENTREQUEST_0_QTY" value="<?php echo $atts['qty']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['return_url']) ) { ?>
        <input type="hidden" name="RETURN_URL" value="<?php echo $atts['return_url']; ?>" />
      <?php } ?>
    
      <?php if ( isset($atts['cancel_url']) ) { ?>
        <input type="hidden" name="CANCEL_URL" value="<?php echo $atts['cancel_url']; ?>" />
      <?php } ?>
    
      <input type="hidden" name="func" value="start" />
    
      <?php if ( isset($atts['button_style']) ) { ?>
        <?php if ( $atts['button_style'] == 'buy_now' ) { ?>
          <input type="image" value="" src="<?php echo $config->getItem('buy_now_button_src'); ?>" />
        <?php } elseif ( $atts['button_style'] == 'checkout' ) { ?>
          <input type="image" value="" src="<?php echo $config->getItem('checkout_button_src'); ?>" />
        <?php } ?>
      <?php } else { ?>
        <input type="submit" value="Pay with PayPal" />
      <?php } ?>
    </form>

    Add somewhere :

    <input type="checkbox" name="terms" value="agree">Agree terms and conditions<br>

    And add onsubmit=”return checkifagree()” also give it a name so the form header looks like this:

    <form name="paypal_form" method="post" action="<?php echo $config->getItem('plugin_form_handler_url'); ?> " onsubmit="return checkifagree()">

    finally define checkifagree() function and do the checks.

    function validateimeiWidget()
    {
    var checkbox=document.forms["paypal_form"]["terms"].value;
       if( checkbox == ''agree")
           {
               return true;
          }
    return false;
    
    }

    I am not a programmer; please test and bespoke the code as you wish; this is just to give you an idea. If you managed to get it to work please share your code ??

    sorry I pasted the wrong function name:
    function validateimeiWidget()
    should be
    function checkifagree()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘BuyNow button If terms and conditions checked’ is closed to new replies.