Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Checkout_payement : $('.paymentSubmit').attr('disabled', true) - shouldn' be the ID ?

    Hi
    I had to change the relate main_jscript chechout_payment page, to load on the footer, since I have jquery at the footer.

    So I was using inside the $(document).ready, the <?php if ($current_page == 'checkout_payment') { ?>
    and all the code that uses jquery from chechout_payment (modules/page) was in there.

    But Looking at page speed in google, and all that webmaster slavery, I see now that I have to use some "defer" to load the page content faster.

    Anyway, as I was looking at the code again, I think I've spoted something ( or not ) :

    $('.paymentSubmit').attr('disabled', true);

    I don't see any class in tpl_checkout_payment_default.php ( the default file ) .

    Shouldn't this be targeting the ID instead of the class ?

    Another question, that maybe you can help me:

    I'm using a gulp file that compacts all the jquery to one file. So the $(document).ready is the last file to include.
    But at this piece on code ( the above one ) , there's a
    <?php if ($flagOnSubmit) { ?>

    Code:
    $(document).ready(function(){
          $('form[name="checkout_payment"]').submit(function() {
              $('.paymentSubmit').attr('disabled', true);
            <?php if ($flagOnSubmit) { ?>
              formPassed = check_form();
              if (formPassed == false) {
                  $('.paymentSubmit').attr('disabled', false);
              }
              return formPassed;
            <?php } ?>
          });
        });
    How can I detect the $flagOnSubmit in a "javascript way" , so I dont' need the php tag, and I can include all this stuff safely at the end of the y last include js file ?

    ok
    Thanks
    Last edited by mesnitu; 6 Oct 2016 at 11:07 AM.
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  2. #2
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Checkout_payement : $('.paymentSubmit').attr('disabled', true) - shouldn' be the

    moving a step futher ( I think )

    At the includes\modules\pages\checkout_payment\jscript_main.php
    I've added this :

    Code:
    <?php if ($flagOnSubmit) { ?>
        var flagOnSubmit = 1;        
    <?php } ?>
    So I can remove that bit of code with jquery that I mentioned to my last .js file to compacted since I have a var flagOnSubmit

    Code:
    if ( document.body.id == 'checkoutpaymentBody' ) {
         $('form[name="checkout_payment"]').submit(function() {
             $('.paymentSubmit').attr('disabled', true);
            if ( flagOnSubmit == 1 )
              formPassed = check_form();
              if (formPassed == false) {
                  //document.getElementsByClassName ('payment')
                  $('.paymentSubmit').attr('disabled', false);
              }
              return formPassed;
           
          });
      }
    But, I' not sure if it's working as expect :

    On checkout_payment page , ie: with 2 payment methods , if I select none , one pop up comes up , but then the page is reloaded , not sure if this is ok ... actually this site only has 1 payment method.

    In terms on attr disable, etc... I see no changes....

    Well, it's working, but I'm not sure if this is ok.

    Tahnks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

 

 

Similar Threads

  1. v150 Shouldn't ALL the pages say https:// ?
    By CultureClick in forum PayPal Website Payments Pro support
    Replies: 9
    Last Post: 22 Sep 2012, 08:46 PM
  2. is is true that can't override the pages under modules?
    By Cindy2010 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 1 Mar 2011, 07:20 AM
  3. Attribute Pricing of Attr Value * Attr Price
    By JedidiahReeser in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 10 Aug 2009, 08:15 PM
  4. how to add text input field in product attr to allow client to submit their request?
    By weber in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 8 Jun 2009, 10:34 AM
  5. Copy Only one Attr to Another Product?
    By gabstero in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 12 Feb 2008, 05:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR