Jump to content

Le bouton commander reste inactif après la saisie bancaire et l'acceptation des conditions PrestaShop Checkout v2.15.5 and Prestashop 1.7.8.1


yto

Recommended Posts

After update Prestashop 1.7.7.8 to 1.7.8.1 

PrestaShop Checkout v2.15.5

Lors de l'étape de paiement et de la saisie des informations de la carte bancaire et de l'acception des conditions de ventes 

le boutons commander reste inactif (Gris)

 

J'ai ajouter le code suivant dans un fichier custom.js en attendant qui permet d'activer le bouton en jouant avec la class disabled

 

    // Add to 
    if($('#checkout').length>0){
   
        const targetCardNumber = document.getElementById('ps_checkout-hosted-fields-card-number');
        const targetCardExpiration = document.getElementById('ps_checkout-hosted-fields-card-expiration-date');
        const targetCardCVV = document.getElementById('ps_checkout-hosted-fields-card-cvv');
        const config = { attributes: true, childList: false, subtree: false };

        const observerCardNumber = new MutationObserver(verifCbCheck);
        observerCardNumber.observe(targetCardNumber, config);

        const observerCardExpiration = new MutationObserver(verifCbCheck);
        observerCardExpiration.observe(targetCardExpiration, config);

        const observerCardCVV = new MutationObserver(verifCbCheck);
        observerCardCVV.observe(targetCardCVV, config);

        $('#conditions-to-approve .custom-checkbox input').change(function(){
            verifCbCheck();
        });
    }

    function verifCbCheck(){
        if($('#conditions-to-approve .custom-checkbox input').prop('checked') && $('#ps_checkout-hosted-fields-card-number').hasClass('braintree-hosted-fields-valid') 
        && $('#ps_checkout-hosted-fields-card-expiration-date').hasClass('braintree-hosted-fields-valid') && $('#ps_checkout-hosted-fields-card-cvv').hasClass('braintree-hosted-fields-valid') ){
            $('#ps_checkout-card-buttons-container button').removeClass('disabled');
        }else{
            $('#ps_checkout-card-buttons-container button').addClass('disabled');
        }
    }

 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...